| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_controller.h" | 5 #include "chrome/browser/speech/speech_input_bubble_controller.h" |
| 6 | 6 |
| 7 #include "chrome/browser/tab_contents/tab_util.h" | 7 #include "chrome/browser/tab_contents/tab_util.h" |
| 8 #include "chrome/common/notification_registrar.h" | 8 #include "chrome/common/notification_registrar.h" |
| 9 #include "chrome/common/notification_source.h" | 9 #include "chrome/common/notification_source.h" |
| 10 #include "chrome/common/notification_type.h" | 10 #include "chrome/common/notification_type.h" |
| 11 #include "content/browser/browser_thread.h" | 11 #include "content/browser/browser_thread.h" |
| 12 #include "content/browser/tab_contents/tab_contents.h" | 12 #include "content/browser/tab_contents/tab_contents.h" |
| 13 #include "ui/gfx/rect.h" | 13 #include "ui/gfx/rect.h" |
| 14 | 14 |
| 15 namespace speech_input { | 15 namespace speech_input { |
| 16 | 16 |
| 17 SpeechInputBubbleController::SpeechInputBubbleController(Delegate* delegate) | 17 SpeechInputBubbleController::SpeechInputBubbleController(Delegate* delegate) |
| 18 : delegate_(delegate), | 18 : delegate_(delegate), |
| 19 current_bubble_caller_id_(0), | 19 current_bubble_caller_id_(0), |
| 20 registrar_(new NotificationRegistrar) { | 20 registrar_(new NotificationRegistrar) { |
| 21 } | 21 } |
| 22 | 22 |
| 23 SpeechInputBubbleController::~SpeechInputBubbleController() { | 23 SpeechInputBubbleController::~SpeechInputBubbleController() { |
| 24 DCHECK(bubbles_.size() == 0); | 24 DCHECK(bubbles_.empty()); |
| 25 } | 25 } |
| 26 | 26 |
| 27 void SpeechInputBubbleController::CreateBubble(int caller_id, | 27 void SpeechInputBubbleController::CreateBubble(int caller_id, |
| 28 int render_process_id, | 28 int render_process_id, |
| 29 int render_view_id, | 29 int render_view_id, |
| 30 const gfx::Rect& element_rect) { | 30 const gfx::Rect& element_rect) { |
| 31 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 31 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
| 32 BrowserThread::PostTask( | 32 BrowserThread::PostTask( |
| 33 BrowserThread::UI, FROM_HERE, | 33 BrowserThread::UI, FROM_HERE, |
| 34 NewRunnableMethod(this, &SpeechInputBubbleController::CreateBubble, | 34 NewRunnableMethod(this, &SpeechInputBubbleController::CreateBubble, |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 void SpeechInputBubbleController::InvokeDelegateButtonClicked( | 215 void SpeechInputBubbleController::InvokeDelegateButtonClicked( |
| 216 int caller_id, SpeechInputBubble::Button button) { | 216 int caller_id, SpeechInputBubble::Button button) { |
| 217 delegate_->InfoBubbleButtonClicked(caller_id, button); | 217 delegate_->InfoBubbleButtonClicked(caller_id, button); |
| 218 } | 218 } |
| 219 | 219 |
| 220 void SpeechInputBubbleController::InvokeDelegateFocusChanged(int caller_id) { | 220 void SpeechInputBubbleController::InvokeDelegateFocusChanged(int caller_id) { |
| 221 delegate_->InfoBubbleFocusChanged(caller_id); | 221 delegate_->InfoBubbleFocusChanged(caller_id); |
| 222 } | 222 } |
| 223 | 223 |
| 224 } // namespace speech_input | 224 } // namespace speech_input |
| OLD | NEW |