| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 if (toplevel_widget) { | 344 if (toplevel_widget) { |
| 345 gfx::Rect container_rect; | 345 gfx::Rect container_rect; |
| 346 tab_contents()->GetContainerBounds(&container_rect); | 346 tab_contents()->GetContainerBounds(&container_rect); |
| 347 gfx::Rect target_rect = GetInfoBubbleTarget(element_rect_); | 347 gfx::Rect target_rect = GetInfoBubbleTarget(element_rect_); |
| 348 if (!container_rect.Contains(target_rect.x(), target_rect.y())) { | 348 if (!container_rect.Contains(target_rect.x(), target_rect.y())) { |
| 349 // Target is not in screen view, so point to page icon in omnibox. | 349 // Target is not in screen view, so point to page icon in omnibox. |
| 350 Profile* profile = | 350 Profile* profile = |
| 351 Profile::FromBrowserContext(tab_contents()->browser_context()); | 351 Profile::FromBrowserContext(tab_contents()->browser_context()); |
| 352 Browser* browser = Browser::GetOrCreateTabbedBrowser(profile); | 352 Browser* browser = Browser::GetOrCreateTabbedBrowser(profile); |
| 353 BrowserView* browser_view = | 353 BrowserView* browser_view = |
| 354 BrowserView::GetBrowserViewForNativeWindow( | 354 BrowserView::GetBrowserViewForBrowser(browser); |
| 355 browser->window()->GetNativeHandle()); | |
| 356 gfx::Point point; | 355 gfx::Point point; |
| 357 if (base::i18n::IsRTL()) { | 356 if (base::i18n::IsRTL()) { |
| 358 int width = browser_view->toolbar()->location_bar()->width(); | 357 int width = browser_view->toolbar()->location_bar()->width(); |
| 359 point = gfx::Point(width - kIconHorizontalOffset, 0); | 358 point = gfx::Point(width - kIconHorizontalOffset, 0); |
| 360 } | 359 } |
| 361 point.Offset(0, kIconVerticalOffset); | 360 point.Offset(0, kIconVerticalOffset); |
| 362 views::View::ConvertPointToScreen(browser_view->toolbar()->location_bar(), | 361 views::View::ConvertPointToScreen(browser_view->toolbar()->location_bar(), |
| 363 &point); | 362 &point); |
| 364 target_rect = browser_view->toolbar()->location_bar()->bounds(); | 363 target_rect = browser_view->toolbar()->location_bar()->bounds(); |
| 365 target_rect.set_origin(point); | 364 target_rect.set_origin(point); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 396 } | 395 } |
| 397 | 396 |
| 398 } // namespace | 397 } // namespace |
| 399 | 398 |
| 400 SpeechInputBubble* SpeechInputBubble::CreateNativeBubble( | 399 SpeechInputBubble* SpeechInputBubble::CreateNativeBubble( |
| 401 TabContents* tab_contents, | 400 TabContents* tab_contents, |
| 402 SpeechInputBubble::Delegate* delegate, | 401 SpeechInputBubble::Delegate* delegate, |
| 403 const gfx::Rect& element_rect) { | 402 const gfx::Rect& element_rect) { |
| 404 return new SpeechInputBubbleImpl(tab_contents, delegate, element_rect); | 403 return new SpeechInputBubbleImpl(tab_contents, delegate, element_rect); |
| 405 } | 404 } |
| OLD | NEW |