1 // Copyright 2013 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #import "chrome/browser/ui/cocoa/location_bar/mic_search_decoration.h" 6 7 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/browser/command_updater.h" 9 #import "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" 10 #include "grit/generated_resources.h" 11 #include "grit/theme_resources.h" 12 #include "ui/base/l10n/l10n_util_mac.h" 13 14 MicSearchDecoration::MicSearchDecoration(CommandUpdater* command_updater) 15 : command_updater_(command_updater) { 16 SetImage(OmniboxViewMac::ImageForResource(IDR_OMNIBOX_MIC_SEARCH)); 17 } 18 19 MicSearchDecoration::~MicSearchDecoration() { 20 } 21 22 bool MicSearchDecoration::AcceptsMousePress() { 23 return true; 24 } 25 26 bool MicSearchDecoration::OnMousePressed(NSRect frame, NSPoint location) { 27 command_updater_->ExecuteCommand(IDC_TOGGLE_SPEECH_INPUT); 28 return true; 29 } 30 31 NSString* MicSearchDecoration::GetToolTip() { 32 return l10n_util::GetNSStringWithFixup(IDS_TOOLTIP_MIC_SEARCH); 33 } 34