OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/speech/speech_input_bubble.h" | 5 #include "chrome/browser/speech/speech_input_bubble.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/gtk/browser_toolbar_gtk.h" | 10 #include "chrome/browser/ui/gtk/browser_toolbar_gtk.h" |
11 #include "chrome/browser/ui/gtk/browser_window_gtk.h" | 11 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
12 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h" | 12 #include "chrome/browser/ui/gtk/bubble/bubble_gtk.h" |
13 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" | 13 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" |
14 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 14 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
15 #include "chrome/browser/ui/gtk/gtk_util.h" | 15 #include "chrome/browser/ui/gtk/gtk_util.h" |
16 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" | 16 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" |
17 #include "content/browser/speech/speech_input_manager.h" | 17 #include "content/browser/speech/speech_input_manager.h" |
18 #include "content/public/browser/resource_context.h" | 18 #include "content/public/browser/resource_context.h" |
19 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
20 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
21 #include "grit/theme_resources.h" | 21 #include "grit/theme_resources.h" |
22 #include "media/audio/audio_manager.h" | |
23 #include "ui/base/gtk/gtk_hig_constants.h" | 22 #include "ui/base/gtk/gtk_hig_constants.h" |
24 #include "ui/base/gtk/owned_widget_gtk.h" | 23 #include "ui/base/gtk/owned_widget_gtk.h" |
25 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
26 #include "ui/base/resource/resource_bundle.h" | 25 #include "ui/base/resource/resource_bundle.h" |
27 #include "ui/gfx/gtk_util.h" | 26 #include "ui/gfx/gtk_util.h" |
28 #include "ui/gfx/rect.h" | 27 #include "ui/gfx/rect.h" |
29 | 28 |
30 using content::WebContents; | 29 using content::WebContents; |
31 | 30 |
32 namespace { | 31 namespace { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 103 |
105 void SpeechInputBubbleGtk::OnCancelClicked(GtkWidget* widget) { | 104 void SpeechInputBubbleGtk::OnCancelClicked(GtkWidget* widget) { |
106 delegate_->InfoBubbleButtonClicked(BUTTON_CANCEL); | 105 delegate_->InfoBubbleButtonClicked(BUTTON_CANCEL); |
107 } | 106 } |
108 | 107 |
109 void SpeechInputBubbleGtk::OnTryAgainClicked(GtkWidget* widget) { | 108 void SpeechInputBubbleGtk::OnTryAgainClicked(GtkWidget* widget) { |
110 delegate_->InfoBubbleButtonClicked(BUTTON_TRY_AGAIN); | 109 delegate_->InfoBubbleButtonClicked(BUTTON_TRY_AGAIN); |
111 } | 110 } |
112 | 111 |
113 void SpeechInputBubbleGtk::OnMicSettingsClicked(GtkWidget* widget) { | 112 void SpeechInputBubbleGtk::OnMicSettingsClicked(GtkWidget* widget) { |
114 speech_input::SpeechInputManager::ShowAudioInputSettingsFromUI( | 113 speech_input::SpeechInputManager::ShowAudioInputSettings(); |
115 web_contents()->GetBrowserContext()->GetResourceContext()); | |
116 Hide(); | 114 Hide(); |
117 } | 115 } |
118 | 116 |
119 void SpeechInputBubbleGtk::Show() { | 117 void SpeechInputBubbleGtk::Show() { |
120 if (bubble_) | 118 if (bubble_) |
121 return; // Nothing further to do since the bubble is already visible. | 119 return; // Nothing further to do since the bubble is already visible. |
122 | 120 |
123 // We use a vbox to arrange the controls (label, image, button bar) vertically | 121 // We use a vbox to arrange the controls (label, image, button bar) vertically |
124 // and the button bar is a hbox holding the 2 buttons (try again and cancel). | 122 // and the button bar is a hbox holding the 2 buttons (try again and cancel). |
125 // To get horizontal space around them we place this vbox with padding in a | 123 // To get horizontal space around them we place this vbox with padding in a |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 } | 291 } |
294 | 292 |
295 } // namespace | 293 } // namespace |
296 | 294 |
297 SpeechInputBubble* SpeechInputBubble::CreateNativeBubble( | 295 SpeechInputBubble* SpeechInputBubble::CreateNativeBubble( |
298 WebContents* web_contents, | 296 WebContents* web_contents, |
299 Delegate* delegate, | 297 Delegate* delegate, |
300 const gfx::Rect& element_rect) { | 298 const gfx::Rect& element_rect) { |
301 return new SpeechInputBubbleGtk(web_contents, delegate, element_rect); | 299 return new SpeechInputBubbleGtk(web_contents, delegate, element_rect); |
302 } | 300 } |
OLD | NEW |