Chromium Code Reviews| Index: chrome/browser/speech/speech_input_manager.cc |
| diff --git a/chrome/browser/speech/speech_input_manager.cc b/chrome/browser/speech/speech_input_manager.cc |
| index 626bf4f2982331be5091045c940cacf06944149b..141ed2160822aec5a5c4b92519992eed3b80f236 100644 |
| --- a/chrome/browser/speech/speech_input_manager.cc |
| +++ b/chrome/browser/speech/speech_input_manager.cc |
| @@ -14,6 +14,7 @@ |
| #include "base/threading/thread_restrictions.h" |
| #include "base/utf_string_conversions.h" |
| #include "chrome/browser/browser_process.h" |
| +#include "chrome/browser/browser_thread.h" |
| #include "chrome/browser/platform_util.h" |
| #include "chrome/browser/prefs/pref_service.h" |
| #include "chrome/browser/speech/speech_input_bubble_controller.h" |
| @@ -120,7 +121,7 @@ class SpeechInputManagerImpl : public SpeechInputManager, |
| virtual void OnRecognizerError(int caller_id, |
| SpeechRecognizer::ErrorCode error); |
| virtual void DidCompleteEnvironmentEstimation(int caller_id); |
| - virtual void SetInputVolume(int caller_id, float volume); |
| + virtual void SetInputVolume(int caller_id, float volume, float noise_volume); |
| // SpeechInputBubbleController::Delegate methods. |
| virtual void InfoBubbleButtonClicked(int caller_id, |
| @@ -183,6 +184,22 @@ bool SpeechInputManager::IsFeatureEnabled() { |
| return enabled; |
| } |
| +void SpeechInputManager::ShowAudioInputSettings() { |
| + // Since AudioManager::ShowAudioInputSettings can potentially launch external |
| + // processes, do that in the PROCESS_LAUNCHER thread to not block the calling |
|
jam
2011/03/01 19:49:11
how long can AudioManager::ShowAudioInputSettings
Satish
2011/03/01 20:31:21
ShowAudioInputSettings does a check to figure out
|
| + // threads. |
| + if (!BrowserThread::CurrentlyOn(BrowserThread::PROCESS_LAUNCHER)) { |
| + BrowserThread::PostTask( |
| + BrowserThread::PROCESS_LAUNCHER, FROM_HERE, |
| + NewRunnableFunction(&SpeechInputManager::ShowAudioInputSettings)); |
| + return; |
| + } |
| + |
| + DCHECK(AudioManager::GetAudioManager()->CanShowAudioInputSettings()); |
| + if (AudioManager::GetAudioManager()->CanShowAudioInputSettings()) |
| + AudioManager::GetAudioManager()->ShowAudioInputSettings(); |
| +} |
| + |
| SpeechInputManagerImpl::SpeechInputManagerImpl() |
| : recording_caller_id_(0), |
| bubble_controller_(new SpeechInputBubbleController( |
| @@ -340,11 +357,12 @@ void SpeechInputManagerImpl::DidCompleteEnvironmentEstimation(int caller_id) { |
| bubble_controller_->SetBubbleRecordingMode(caller_id); |
| } |
| -void SpeechInputManagerImpl::SetInputVolume(int caller_id, float volume) { |
| +void SpeechInputManagerImpl::SetInputVolume(int caller_id, float volume, |
| + float noise_volume) { |
| DCHECK(HasPendingRequest(caller_id)); |
| DCHECK_EQ(recording_caller_id_, caller_id); |
| - bubble_controller_->SetBubbleInputVolume(caller_id, volume); |
| + bubble_controller_->SetBubbleInputVolume(caller_id, volume, noise_volume); |
| } |
| void SpeechInputManagerImpl::CancelRecognitionAndInformDelegate(int caller_id) { |