| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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_->GetContainerBounds(&container_rect); |
| 130 gfx::Rect anchor(element_rect_); | 130 gfx::Rect anchor(element_rect_); |
| 131 anchor.Offset(container_rect.origin()); | 131 anchor.Offset(container_rect.DistanceFromOrigin()); |
| 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); |
| 140 | 140 |
| 141 heading_ = new views::Label( | 141 heading_ = new views::Label( |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 } | 387 } |
| 388 | 388 |
| 389 } // namespace | 389 } // namespace |
| 390 | 390 |
| 391 SpeechRecognitionBubble* SpeechRecognitionBubble::CreateNativeBubble( | 391 SpeechRecognitionBubble* SpeechRecognitionBubble::CreateNativeBubble( |
| 392 WebContents* web_contents, | 392 WebContents* web_contents, |
| 393 SpeechRecognitionBubble::Delegate* delegate, | 393 SpeechRecognitionBubble::Delegate* delegate, |
| 394 const gfx::Rect& element_rect) { | 394 const gfx::Rect& element_rect) { |
| 395 return new SpeechRecognitionBubbleImpl(web_contents, delegate, element_rect); | 395 return new SpeechRecognitionBubbleImpl(web_contents, delegate, element_rect); |
| 396 } | 396 } |
| OLD | NEW |