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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 void SetImage(const gfx::ImageSkia& image); | 55 void SetImage(const gfx::ImageSkia& image); |
56 | 56 |
57 // views::BubbleDelegateView methods. | 57 // views::BubbleDelegateView methods. |
58 virtual void OnWidgetActivationChanged(views::Widget* widget, | 58 virtual void OnWidgetActivationChanged(views::Widget* widget, |
59 bool active) OVERRIDE; | 59 bool active) OVERRIDE; |
60 virtual gfx::Rect GetAnchorRect() OVERRIDE; | 60 virtual gfx::Rect GetAnchorRect() OVERRIDE; |
61 virtual void Init() OVERRIDE; | 61 virtual void Init() OVERRIDE; |
62 | 62 |
63 // views::ButtonListener methods. | 63 // views::ButtonListener methods. |
64 virtual void ButtonPressed(views::Button* source, | 64 virtual void ButtonPressed(views::Button* source, |
65 const views::Event& event) OVERRIDE; | 65 const ui::Event& event) OVERRIDE; |
66 | 66 |
67 // views::LinkListener methods. | 67 // views::LinkListener methods. |
68 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; | 68 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; |
69 | 69 |
70 // views::View overrides. | 70 // views::View overrides. |
71 virtual gfx::Size GetPreferredSize() OVERRIDE; | 71 virtual gfx::Size GetPreferredSize() OVERRIDE; |
72 virtual void Layout() OVERRIDE; | 72 virtual void Layout() OVERRIDE; |
73 | 73 |
74 void set_notify_delegate_on_activation_change(bool notify) { | 74 void set_notify_delegate_on_activation_change(bool notify) { |
75 notify_delegate_on_activation_change_ = notify; | 75 notify_delegate_on_activation_change_ = notify; |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 Layout(); | 208 Layout(); |
209 | 209 |
210 SizeToContents(); | 210 SizeToContents(); |
211 } | 211 } |
212 | 212 |
213 void SpeechRecognitionBubbleView::SetImage(const gfx::ImageSkia& image) { | 213 void SpeechRecognitionBubbleView::SetImage(const gfx::ImageSkia& image) { |
214 icon_->SetImage(image); | 214 icon_->SetImage(image); |
215 } | 215 } |
216 | 216 |
217 void SpeechRecognitionBubbleView::ButtonPressed(views::Button* source, | 217 void SpeechRecognitionBubbleView::ButtonPressed(views::Button* source, |
218 const views::Event& event) { | 218 const ui::Event& event) { |
219 if (source == cancel_) { | 219 if (source == cancel_) { |
220 delegate_->InfoBubbleButtonClicked(SpeechRecognitionBubble::BUTTON_CANCEL); | 220 delegate_->InfoBubbleButtonClicked(SpeechRecognitionBubble::BUTTON_CANCEL); |
221 } else if (source == try_again_) { | 221 } else if (source == try_again_) { |
222 delegate_->InfoBubbleButtonClicked( | 222 delegate_->InfoBubbleButtonClicked( |
223 SpeechRecognitionBubble::BUTTON_TRY_AGAIN); | 223 SpeechRecognitionBubble::BUTTON_TRY_AGAIN); |
224 } else { | 224 } else { |
225 NOTREACHED() << "Unknown button"; | 225 NOTREACHED() << "Unknown button"; |
226 } | 226 } |
227 } | 227 } |
228 | 228 |
(...skipping 158 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 |