| Index: chrome/browser/speech/speech_recognition_bubble_controller.cc
|
| diff --git a/chrome/browser/speech/speech_input_bubble_controller.cc b/chrome/browser/speech/speech_recognition_bubble_controller.cc
|
| similarity index 69%
|
| rename from chrome/browser/speech/speech_input_bubble_controller.cc
|
| rename to chrome/browser/speech/speech_recognition_bubble_controller.cc
|
| index 8645e5113f6a2b051e7afa932739803e6bd9be79..656738fd643e71f72434e172e990bfb4c5372fc8 100644
|
| --- a/chrome/browser/speech/speech_input_bubble_controller.cc
|
| +++ b/chrome/browser/speech/speech_recognition_bubble_controller.cc
|
| @@ -1,8 +1,8 @@
|
| -// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "chrome/browser/speech/speech_input_bubble_controller.h"
|
| +#include "chrome/browser/speech/speech_recognition_bubble_controller.h"
|
|
|
| #include "base/bind.h"
|
| #include "chrome/browser/tab_contents/tab_util.h"
|
| @@ -16,28 +16,29 @@
|
| using content::BrowserThread;
|
| using content::WebContents;
|
|
|
| -namespace speech_input {
|
| +namespace speech {
|
|
|
| -SpeechInputBubbleController::SpeechInputBubbleController(Delegate* delegate)
|
| +SpeechRecognitionBubbleController::SpeechRecognitionBubbleController(
|
| + Delegate* delegate)
|
| : delegate_(delegate),
|
| current_bubble_caller_id_(0),
|
| registrar_(new content::NotificationRegistrar) {
|
| }
|
|
|
| -SpeechInputBubbleController::~SpeechInputBubbleController() {
|
| +SpeechRecognitionBubbleController::~SpeechRecognitionBubbleController() {
|
| DCHECK(bubbles_.empty());
|
| }
|
|
|
| -void SpeechInputBubbleController::CreateBubble(int caller_id,
|
| - int render_process_id,
|
| - int render_view_id,
|
| - const gfx::Rect& element_rect) {
|
| +void SpeechRecognitionBubbleController::CreateBubble(
|
| + int caller_id,
|
| + int render_process_id,
|
| + int render_view_id,
|
| + const gfx::Rect& element_rect) {
|
| if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
|
| BrowserThread::PostTask(
|
| BrowserThread::UI, FROM_HERE,
|
| - base::Bind(&SpeechInputBubbleController::CreateBubble, this,
|
| - caller_id, render_process_id, render_view_id,
|
| - element_rect));
|
| + base::Bind(&SpeechRecognitionBubbleController::CreateBubble, this,
|
| + caller_id, render_process_id, render_view_id, element_rect));
|
| return;
|
| }
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| @@ -45,16 +46,16 @@ void SpeechInputBubbleController::CreateBubble(int caller_id,
|
| render_view_id);
|
|
|
| DCHECK_EQ(0u, bubbles_.count(caller_id));
|
| - SpeechInputBubble* bubble = SpeechInputBubble::Create(web_contents, this,
|
| - element_rect);
|
| + SpeechRecognitionBubble* bubble = SpeechRecognitionBubble::Create(
|
| + web_contents, this, element_rect);
|
| if (!bubble) {
|
| // Could be null if tab or display rect were invalid.
|
| // Simulate the cancel button being clicked to inform the delegate.
|
| BrowserThread::PostTask(
|
| BrowserThread::IO, FROM_HERE,
|
| base::Bind(
|
| - &SpeechInputBubbleController::InvokeDelegateButtonClicked,
|
| - this, caller_id, SpeechInputBubble::BUTTON_CANCEL));
|
| + &SpeechRecognitionBubbleController::InvokeDelegateButtonClicked,
|
| + this, caller_id, SpeechRecognitionBubble::BUTTON_CANCEL));
|
| return;
|
| }
|
|
|
| @@ -63,38 +64,38 @@ void SpeechInputBubbleController::CreateBubble(int caller_id,
|
| UpdateTabContentsSubscription(caller_id, BUBBLE_ADDED);
|
| }
|
|
|
| -void SpeechInputBubbleController::CloseBubble(int caller_id) {
|
| +void SpeechRecognitionBubbleController::CloseBubble(int caller_id) {
|
| ProcessRequestInUiThread(caller_id, REQUEST_CLOSE, string16(), 0, 0);
|
| }
|
|
|
| -void SpeechInputBubbleController::SetBubbleWarmUpMode(int caller_id) {
|
| +void SpeechRecognitionBubbleController::SetBubbleWarmUpMode(int caller_id) {
|
| ProcessRequestInUiThread(caller_id, REQUEST_SET_WARM_UP_MODE,
|
| string16(), 0, 0);
|
| }
|
|
|
| -void SpeechInputBubbleController::SetBubbleRecordingMode(int caller_id) {
|
| +void SpeechRecognitionBubbleController::SetBubbleRecordingMode(int caller_id) {
|
| ProcessRequestInUiThread(caller_id, REQUEST_SET_RECORDING_MODE,
|
| string16(), 0, 0);
|
| }
|
|
|
| -void SpeechInputBubbleController::SetBubbleRecognizingMode(int caller_id) {
|
| +void SpeechRecognitionBubbleController::SetBubbleRecognizingMode(
|
| + int caller_id) {
|
| ProcessRequestInUiThread(caller_id, REQUEST_SET_RECOGNIZING_MODE,
|
| string16(), 0, 0);
|
| }
|
|
|
| -void SpeechInputBubbleController::SetBubbleInputVolume(int caller_id,
|
| - float volume,
|
| - float noise_volume) {
|
| +void SpeechRecognitionBubbleController::SetBubbleInputVolume(
|
| + int caller_id, float volume, float noise_volume) {
|
| ProcessRequestInUiThread(caller_id, REQUEST_SET_INPUT_VOLUME, string16(),
|
| volume, noise_volume);
|
| }
|
|
|
| -void SpeechInputBubbleController::SetBubbleMessage(int caller_id,
|
| - const string16& text) {
|
| +void SpeechRecognitionBubbleController::SetBubbleMessage(int caller_id,
|
| + const string16& text) {
|
| ProcessRequestInUiThread(caller_id, REQUEST_SET_MESSAGE, text, 0, 0);
|
| }
|
|
|
| -void SpeechInputBubbleController::UpdateTabContentsSubscription(
|
| +void SpeechRecognitionBubbleController::UpdateTabContentsSubscription(
|
| int caller_id, ManageSubscriptionAction action) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
|
|
| @@ -117,11 +118,11 @@ void SpeechInputBubbleController::UpdateTabContentsSubscription(
|
| content::Source<WebContents>(web_contents));
|
| } else {
|
| registrar_->Remove(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
|
| - content::Source<WebContents>(web_contents));
|
| + content::Source<WebContents>(web_contents));
|
| }
|
| }
|
|
|
| -void SpeechInputBubbleController::Observe(
|
| +void SpeechRecognitionBubbleController::Observe(
|
| int type,
|
| const content::NotificationSource& source,
|
| const content::NotificationDetails& details) {
|
| @@ -133,8 +134,8 @@ void SpeechInputBubbleController::Observe(
|
| if (iter->second->web_contents() == web_contents) {
|
| BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
|
| base::Bind(
|
| - &SpeechInputBubbleController::InvokeDelegateButtonClicked,
|
| - this, iter->first, SpeechInputBubble::BUTTON_CANCEL));
|
| + &SpeechRecognitionBubbleController::InvokeDelegateButtonClicked,
|
| + this, iter->first, SpeechRecognitionBubble::BUTTON_CANCEL));
|
| CloseBubble(iter->first);
|
| // We expect to have a very small number of items in this map so
|
| // redo-ing from start is ok.
|
| @@ -148,12 +149,12 @@ void SpeechInputBubbleController::Observe(
|
| }
|
| }
|
|
|
| -void SpeechInputBubbleController::ProcessRequestInUiThread(
|
| +void SpeechRecognitionBubbleController::ProcessRequestInUiThread(
|
| int caller_id, RequestType type, const string16& text, float volume,
|
| float noise_volume) {
|
| if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
|
| BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(
|
| - &SpeechInputBubbleController::ProcessRequestInUiThread, this,
|
| + &SpeechRecognitionBubbleController::ProcessRequestInUiThread, this,
|
| caller_id, type, text, volume, noise_volume));
|
| return;
|
| }
|
| @@ -171,7 +172,7 @@ void SpeechInputBubbleController::ProcessRequestInUiThread(
|
| current_bubble_caller_id_ = caller_id;
|
| }
|
|
|
| - SpeechInputBubble* bubble = bubbles_[caller_id];
|
| + SpeechRecognitionBubble* bubble = bubbles_[caller_id];
|
| switch (type) {
|
| case REQUEST_SET_WARM_UP_MODE:
|
| bubble->SetWarmUpMode();
|
| @@ -204,19 +205,19 @@ void SpeechInputBubbleController::ProcessRequestInUiThread(
|
| bubble->Show();
|
| }
|
|
|
| -void SpeechInputBubbleController::InfoBubbleButtonClicked(
|
| - SpeechInputBubble::Button button) {
|
| +void SpeechRecognitionBubbleController::InfoBubbleButtonClicked(
|
| + SpeechRecognitionBubble::Button button) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| DCHECK(current_bubble_caller_id_);
|
|
|
| BrowserThread::PostTask(
|
| BrowserThread::IO, FROM_HERE,
|
| base::Bind(
|
| - &SpeechInputBubbleController::InvokeDelegateButtonClicked,
|
| + &SpeechRecognitionBubbleController::InvokeDelegateButtonClicked,
|
| this, current_bubble_caller_id_, button));
|
| }
|
|
|
| -void SpeechInputBubbleController::InfoBubbleFocusChanged() {
|
| +void SpeechRecognitionBubbleController::InfoBubbleFocusChanged() {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| DCHECK(current_bubble_caller_id_);
|
|
|
| @@ -226,17 +227,18 @@ void SpeechInputBubbleController::InfoBubbleFocusChanged() {
|
| BrowserThread::PostTask(
|
| BrowserThread::IO, FROM_HERE,
|
| base::Bind(
|
| - &SpeechInputBubbleController::InvokeDelegateFocusChanged,
|
| + &SpeechRecognitionBubbleController::InvokeDelegateFocusChanged,
|
| this, old_bubble_caller_id));
|
| }
|
|
|
| -void SpeechInputBubbleController::InvokeDelegateButtonClicked(
|
| - int caller_id, SpeechInputBubble::Button button) {
|
| +void SpeechRecognitionBubbleController::InvokeDelegateButtonClicked(
|
| + int caller_id, SpeechRecognitionBubble::Button button) {
|
| delegate_->InfoBubbleButtonClicked(caller_id, button);
|
| }
|
|
|
| -void SpeechInputBubbleController::InvokeDelegateFocusChanged(int caller_id) {
|
| +void SpeechRecognitionBubbleController::InvokeDelegateFocusChanged(
|
| + int caller_id) {
|
| delegate_->InfoBubbleFocusChanged(caller_id);
|
| }
|
|
|
| -} // namespace speech_input
|
| +} // namespace speech
|
|
|