| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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" | |
| 15 #include "chrome/browser/ui/gtk/gtk_util.h" | 14 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 16 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" | 15 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" |
| 16 #include "chrome/browser/ui/gtk/theme_service_gtk.h" |
| 17 #include "content/public/browser/resource_context.h" | 17 #include "content/public/browser/resource_context.h" |
| 18 #include "content/public/browser/speech_input_manager.h" | 18 #include "content/public/browser/speech_input_manager.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 "ui/base/gtk/gtk_hig_constants.h" | 22 #include "ui/base/gtk/gtk_hig_constants.h" |
| 23 #include "ui/base/gtk/owned_widget_gtk.h" | 23 #include "ui/base/gtk/owned_widget_gtk.h" |
| 24 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
| 25 #include "ui/base/resource/resource_bundle.h" | 25 #include "ui/base/resource/resource_bundle.h" |
| 26 #include "ui/gfx/gtk_util.h" | 26 #include "ui/gfx/gtk_util.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 gtk_box_pack_start(GTK_BOX(button_bar), try_again_button_, TRUE, FALSE, 0); | 167 gtk_box_pack_start(GTK_BOX(button_bar), try_again_button_, TRUE, FALSE, 0); |
| 168 g_signal_connect(try_again_button_, "clicked", | 168 g_signal_connect(try_again_button_, "clicked", |
| 169 G_CALLBACK(&OnTryAgainClickedThunk), this); | 169 G_CALLBACK(&OnTryAgainClickedThunk), this); |
| 170 | 170 |
| 171 GtkWidget* content = gtk_alignment_new(0, 0, 0, 0); | 171 GtkWidget* content = gtk_alignment_new(0, 0, 0, 0); |
| 172 gtk_alignment_set_padding(GTK_ALIGNMENT(content), | 172 gtk_alignment_set_padding(GTK_ALIGNMENT(content), |
| 173 kBubbleControlVerticalSpacing, kBubbleControlVerticalSpacing, | 173 kBubbleControlVerticalSpacing, kBubbleControlVerticalSpacing, |
| 174 kBubbleControlHorizontalSpacing, kBubbleControlHorizontalSpacing); | 174 kBubbleControlHorizontalSpacing, kBubbleControlHorizontalSpacing); |
| 175 gtk_container_add(GTK_CONTAINER(content), vbox); | 175 gtk_container_add(GTK_CONTAINER(content), vbox); |
| 176 | 176 |
| 177 GtkThemeService* theme_provider = GtkThemeService::GetFrom(profile); | 177 ThemeServiceGtk* theme_provider = ThemeServiceGtk::GetFrom(profile); |
| 178 GtkWidget* reference_widget = web_contents()->GetNativeView(); | 178 GtkWidget* reference_widget = web_contents()->GetNativeView(); |
| 179 gfx::Rect container_rect; | 179 gfx::Rect container_rect; |
| 180 web_contents()->GetContainerBounds(&container_rect); | 180 web_contents()->GetContainerBounds(&container_rect); |
| 181 gfx::Rect target_rect(element_rect_.right() - kBubbleTargetOffsetX, | 181 gfx::Rect target_rect(element_rect_.right() - kBubbleTargetOffsetX, |
| 182 element_rect_.bottom(), 1, 1); | 182 element_rect_.bottom(), 1, 1); |
| 183 | 183 |
| 184 if (target_rect.x() < 0 || target_rect.y() < 0 || | 184 if (target_rect.x() < 0 || target_rect.y() < 0 || |
| 185 target_rect.x() > container_rect.width() || | 185 target_rect.x() > container_rect.width() || |
| 186 target_rect.y() > container_rect.height()) { | 186 target_rect.y() > container_rect.height()) { |
| 187 // Target is not in screen view, so point to wrench. | 187 // Target is not in screen view, so point to wrench. |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 } | 291 } |
| 292 | 292 |
| 293 } // namespace | 293 } // namespace |
| 294 | 294 |
| 295 SpeechInputBubble* SpeechInputBubble::CreateNativeBubble( | 295 SpeechInputBubble* SpeechInputBubble::CreateNativeBubble( |
| 296 WebContents* web_contents, | 296 WebContents* web_contents, |
| 297 Delegate* delegate, | 297 Delegate* delegate, |
| 298 const gfx::Rect& element_rect) { | 298 const gfx::Rect& element_rect) { |
| 299 return new SpeechInputBubbleGtk(web_contents, delegate, element_rect); | 299 return new SpeechInputBubbleGtk(web_contents, delegate, element_rect); |
| 300 } | 300 } |
| OLD | NEW |