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

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

Issue 9688012: Refactoring of chrome speech recognition architecture (CL1.2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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_extension_manager.cc
diff --git a/chrome/browser/speech/speech_input_extension_manager.cc b/chrome/browser/speech/speech_input_extension_manager.cc
index cbaf7edae3acb3b2b100d23a984bf43e6f9ea01a..f0f7e015c8a30377600552473a29134d60c91925 100644
--- a/chrome/browser/speech/speech_input_extension_manager.cc
+++ b/chrome/browser/speech/speech_input_extension_manager.cc
@@ -237,7 +237,7 @@ void SpeechInputExtensionManager::ResetToIdleState() {
extension_id_in_use_.clear();
}
-void SpeechInputExtensionManager::SetRecognitionResult(
+void SpeechInputExtensionManager::OnRecognitionResult(
int caller_id,
Satish 2012/03/13 15:30:15 change 'caller_id' to 'session_id' throughout to m
Primiano Tucci (use gerrit) 2012/03/14 09:40:35 See previous reply
const content::SpeechRecognitionResult& result) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
@@ -283,8 +283,12 @@ void SpeechInputExtensionManager::SetRecognitionResultOnUIThread(
DispatchEventToExtension(extension_id, kOnResultEvent, json_args);
}
-void SpeechInputExtensionManager::DidStartReceivingAudio(int caller_id) {
- VLOG(1) << "DidStartReceivingAudio";
+void SpeechInputExtensionManager::OnRecognitionStart(int caller_id) {
+ DCHECK_EQ(caller_id, kSpeechCallerId);
+}
+
+void SpeechInputExtensionManager::OnAudioStart(int caller_id) {
+ VLOG(1) << "OnAudioStart";
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK_EQ(caller_id, kSpeechCallerId);
@@ -293,11 +297,12 @@ void SpeechInputExtensionManager::DidStartReceivingAudio(int caller_id) {
this));
}
-void SpeechInputExtensionManager::DidCompleteRecording(int caller_id) {
+void SpeechInputExtensionManager::OnAudioEnd(int caller_id) {
DCHECK_EQ(caller_id, kSpeechCallerId);
}
-void SpeechInputExtensionManager::DidCompleteRecognition(int caller_id) {
+void SpeechInputExtensionManager::OnRecognitionEnd(int caller_id,
+ bool success) {
DCHECK_EQ(caller_id, kSpeechCallerId);
}
@@ -335,11 +340,11 @@ void SpeechInputExtensionManager::DidStartReceivingAudioOnUIThread() {
content::Details<std::string>(&extension_id_in_use_));
}
-void SpeechInputExtensionManager::OnRecognizerError(
- int caller_id, content::SpeechRecognitionErrorCode error) {
+void SpeechInputExtensionManager::OnRecognitionError(
+ int caller_id, const content::SpeechRecognitionErrorCode& error) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK_EQ(caller_id, kSpeechCallerId);
- VLOG(1) << "OnRecognizerError: " << error;
+ VLOG(1) << "OnRecognitionError: " << error;
base::AutoLock auto_lock(state_lock_);
if (state_ == kShutdown)
@@ -395,15 +400,15 @@ void SpeechInputExtensionManager::OnRecognizerError(
}
}
-void SpeechInputExtensionManager::DidCompleteEnvironmentEstimation(
+void SpeechInputExtensionManager::OnEnvironmentEstimationComplete(
int caller_id) {
DCHECK_EQ(caller_id, kSpeechCallerId);
}
-void SpeechInputExtensionManager::DidStartReceivingSpeech(int caller_id) {
+void SpeechInputExtensionManager::OnSoundStart(int caller_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK_EQ(caller_id, kSpeechCallerId);
- VLOG(1) << "DidStartReceivingSpeech";
+ VLOG(1) << "OnSoundStart";
std::string json_args;
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
@@ -412,10 +417,10 @@ void SpeechInputExtensionManager::DidStartReceivingSpeech(int caller_id) {
json_args));
}
-void SpeechInputExtensionManager::DidStopReceivingSpeech(int caller_id) {
+void SpeechInputExtensionManager::OnSoundEnd(int caller_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DCHECK_EQ(caller_id, kSpeechCallerId);
- VLOG(1) << "DidStopReceivingSpeech";
+ VLOG(1) << "OnSoundEnd";
std::string json_args;
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
@@ -602,7 +607,7 @@ void SpeechInputExtensionManager::IsRecordingOnUIThread(
}
void SpeechInputExtensionManager::StartRecording(
- content::SpeechRecognizerDelegate* delegate,
+ content::SpeechRecognitionEventListener* delegate,
hans 2012/03/13 14:32:46 event_listener?
Primiano Tucci (use gerrit) 2012/03/14 09:40:35 Right. Renaming to just "listener", as agreed offl
net::URLRequestContextGetter* context_getter,
int caller_id,
const std::string& language,
@@ -613,7 +618,7 @@ void SpeechInputExtensionManager::StartRecording(
recognizer_ = content::SpeechRecognizer::Create(
delegate, caller_id, language, grammar, context_getter,
filter_profanities, "", "");
- recognizer_->StartRecording();
+ recognizer_->StartRecognition();
}
bool SpeechInputExtensionManager::HasValidRecognizer() {
@@ -682,7 +687,7 @@ void SpeechInputExtensionManager::StopRecording(bool recognition_failed) {
// Recognition is already cancelled in case of failure.
// Double-cancelling leads to assertion failures.
if (!recognition_failed)
- recognizer_->CancelRecognition();
+ recognizer_->AbortRecognition();
recognizer_.release();
}
}
@@ -708,9 +713,9 @@ void SpeechInputExtensionManager::StopSucceededOnUIThread() {
content::Details<std::string>(&extension_id));
}
-void SpeechInputExtensionManager::SetInputVolume(int caller_id,
- float volume,
- float noise_volume) {
+void SpeechInputExtensionManager::OnAudioLevelsChanged(int caller_id,
+ float volume,
+ float noise_volume) {
DCHECK_EQ(caller_id, kSpeechCallerId);
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,

Powered by Google App Engine
This is Rietveld 408576698