Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Unified Diff: chrome/browser/speech/speech_input_manager.cc

Issue 6597071: Add a noise indicator to the speech bubble volume indicator. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed all review comments. Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) {
« no previous file with comments | « chrome/browser/speech/speech_input_bubble_controller.cc ('k') | content/browser/speech/endpointer/endpointer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698