| OLD | NEW |
| 1 // Copyright (c) 2012 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_recognition_bubble.h" | 5 #include "chrome/browser/speech/speech_recognition_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/browser_finder.h" | 10 #include "chrome/browser/ui/browser_finder.h" |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 element_rect_.bottom(), 1, 1); | 183 element_rect_.bottom(), 1, 1); |
| 184 | 184 |
| 185 if (target_rect.x() < 0 || target_rect.y() < 0 || | 185 if (target_rect.x() < 0 || target_rect.y() < 0 || |
| 186 target_rect.x() > container_rect.width() || | 186 target_rect.x() > container_rect.width() || |
| 187 target_rect.y() > container_rect.height()) { | 187 target_rect.y() > container_rect.height()) { |
| 188 // Target is not in screen view, so point to wrench. | 188 // Target is not in screen view, so point to wrench. |
| 189 Browser* browser = | 189 Browser* browser = |
| 190 browser::FindOrCreateTabbedBrowser(profile); | 190 browser::FindOrCreateTabbedBrowser(profile); |
| 191 BrowserWindowGtk* browser_window = | 191 BrowserWindowGtk* browser_window = |
| 192 BrowserWindowGtk::GetBrowserWindowForNativeWindow( | 192 BrowserWindowGtk::GetBrowserWindowForNativeWindow( |
| 193 browser->window()->GetNativeHandle()); | 193 browser->window()->GetNativeWindow()); |
| 194 reference_widget = browser_window->GetToolbar()->GetLocationBarView() | 194 reference_widget = browser_window->GetToolbar()->GetLocationBarView() |
| 195 ->location_icon_widget(); | 195 ->location_icon_widget(); |
| 196 target_rect = gtk_util::WidgetBounds(reference_widget); | 196 target_rect = gtk_util::WidgetBounds(reference_widget); |
| 197 } | 197 } |
| 198 bubble_ = BubbleGtk::Show(reference_widget, | 198 bubble_ = BubbleGtk::Show(reference_widget, |
| 199 &target_rect, | 199 &target_rect, |
| 200 content, | 200 content, |
| 201 BubbleGtk::ARROW_LOCATION_TOP_LEFT, | 201 BubbleGtk::ARROW_LOCATION_TOP_LEFT, |
| 202 BubbleGtk::POPUP_WINDOW | BubbleGtk::GRAB_INPUT, | 202 BubbleGtk::POPUP_WINDOW | BubbleGtk::GRAB_INPUT, |
| 203 theme_provider, | 203 theme_provider, |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 } | 291 } |
| 292 | 292 |
| 293 } // namespace | 293 } // namespace |
| 294 | 294 |
| 295 SpeechRecognitionBubble* SpeechRecognitionBubble::CreateNativeBubble( | 295 SpeechRecognitionBubble* SpeechRecognitionBubble::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 SpeechRecognitionBubbleGtk(web_contents, delegate, element_rect); | 299 return new SpeechRecognitionBubbleGtk(web_contents, delegate, element_rect); |
| 300 } | 300 } |
| OLD | NEW |