| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 119 |
| 120 void SpeechRecognitionBubbleView::OnWidgetActivationChanged( | 120 void SpeechRecognitionBubbleView::OnWidgetActivationChanged( |
| 121 views::Widget* widget, bool active) { | 121 views::Widget* widget, bool active) { |
| 122 if (widget == GetWidget() && !active && notify_delegate_on_activation_change_) | 122 if (widget == GetWidget() && !active && notify_delegate_on_activation_change_) |
| 123 delegate_->InfoBubbleFocusChanged(); | 123 delegate_->InfoBubbleFocusChanged(); |
| 124 BubbleDelegateView::OnWidgetActivationChanged(widget, active); | 124 BubbleDelegateView::OnWidgetActivationChanged(widget, active); |
| 125 } | 125 } |
| 126 | 126 |
| 127 gfx::Rect SpeechRecognitionBubbleView::GetAnchorRect() { | 127 gfx::Rect SpeechRecognitionBubbleView::GetAnchorRect() { |
| 128 gfx::Rect container_rect; | 128 gfx::Rect container_rect; |
| 129 web_contents_->GetContainerBounds(&container_rect); | 129 web_contents_->GetView()->GetContainerBounds(&container_rect); |
| 130 gfx::Rect anchor(element_rect_); | 130 gfx::Rect anchor(element_rect_); |
| 131 anchor.Offset(container_rect.OffsetFromOrigin()); | 131 anchor.Offset(container_rect.OffsetFromOrigin()); |
| 132 if (!container_rect.Intersects(anchor)) | 132 if (!container_rect.Intersects(anchor)) |
| 133 return BubbleDelegateView::GetAnchorRect(); | 133 return BubbleDelegateView::GetAnchorRect(); |
| 134 return anchor; | 134 return anchor; |
| 135 } | 135 } |
| 136 | 136 |
| 137 void SpeechRecognitionBubbleView::Init() { | 137 void SpeechRecognitionBubbleView::Init() { |
| 138 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 138 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 139 const gfx::Font& font = rb.GetFont(ResourceBundle::MediumFont); | 139 const gfx::Font& font = rb.GetFont(ResourceBundle::MediumFont); |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 } | 401 } |
| 402 | 402 |
| 403 } // namespace | 403 } // namespace |
| 404 | 404 |
| 405 SpeechRecognitionBubble* SpeechRecognitionBubble::CreateNativeBubble( | 405 SpeechRecognitionBubble* SpeechRecognitionBubble::CreateNativeBubble( |
| 406 WebContents* web_contents, | 406 WebContents* web_contents, |
| 407 SpeechRecognitionBubble::Delegate* delegate, | 407 SpeechRecognitionBubble::Delegate* delegate, |
| 408 const gfx::Rect& element_rect) { | 408 const gfx::Rect& element_rect) { |
| 409 return new SpeechRecognitionBubbleImpl(web_contents, delegate, element_rect); | 409 return new SpeechRecognitionBubbleImpl(web_contents, delegate, element_rect); |
| 410 } | 410 } |
| OLD | NEW |