diff options
| author | primiano@chromium.org <primiano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-07 11:01:02 +0000 |
|---|---|---|
| committer | primiano@chromium.org <primiano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-07 11:01:02 +0000 |
| commit | c52b28964090204b87634b396823c3709855079c (patch) | |
| tree | 1e8e20c58dd735baa7f8312dc115fff224e4e5cd /chrome/browser/speech/speech_input_extension_manager.cc | |
| parent | 9104f7e80f0bd0c2353254ec5c354199d965f44d (diff) | |
| download | chromium_src-c52b28964090204b87634b396823c3709855079c.zip chromium_src-c52b28964090204b87634b396823c3709855079c.tar.gz chromium_src-c52b28964090204b87634b396823c3709855079c.tar.bz2 | |
Renamed speech recognition code in preparation for introducing a new speech implementation.
- The general-purpose speech recognition classes (that will be needed also by future code) have been renamed to SpeechRecognition*;
- The IPC Messages and dispatcher(host) classes that are only related to the current input tag (x-webkit-speech) support have been renamed to InputTagSpeech*;
- The namespace has been renamed from speech_input to speech;
BUG=116954
TEST=
Review URL: https://chromiumcodereview.appspot.com/9568002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125378 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/speech/speech_input_extension_manager.cc')
| -rw-r--r-- | chrome/browser/speech/speech_input_extension_manager.cc | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/chrome/browser/speech/speech_input_extension_manager.cc b/chrome/browser/speech/speech_input_extension_manager.cc index 86ebae27..cbaf7ed 100644 --- a/chrome/browser/speech/speech_input_extension_manager.cc +++ b/chrome/browser/speech/speech_input_extension_manager.cc @@ -22,12 +22,13 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_service.h" -#include "content/public/browser/speech_input_manager.h" +#include "content/public/browser/speech_recognition_manager.h" #include "content/public/browser/speech_recognizer.h" -#include "content/public/common/speech_input_result.h" +#include "content/public/common/speech_recognition_result.h" using content::BrowserThread; -using content::SpeechInputManager; +using content::SpeechRecognitionHypothesis; +using content::SpeechRecognitionManager; namespace { @@ -238,7 +239,7 @@ void SpeechInputExtensionManager::ResetToIdleState() { void SpeechInputExtensionManager::SetRecognitionResult( int caller_id, - const content::SpeechInputResult& result) { + const content::SpeechRecognitionResult& result) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK_EQ(caller_id, kSpeechCallerId); @@ -253,7 +254,7 @@ void SpeechInputExtensionManager::SetRecognitionResult( } void SpeechInputExtensionManager::SetRecognitionResultOnUIThread( - const content::SpeechInputResult& result, + const content::SpeechRecognitionResult& result, const std::string& extension_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -265,7 +266,7 @@ void SpeechInputExtensionManager::SetRecognitionResultOnUIThread( js_event->Set(kHypothesesKey, js_hypothesis_array); for (size_t i = 0; i < result.hypotheses.size(); ++i) { - const content::SpeechInputHypothesis& hypothesis = result.hypotheses[i]; + const SpeechRecognitionHypothesis& hypothesis = result.hypotheses[i]; DictionaryValue* js_hypothesis_object = new DictionaryValue(); js_hypothesis_array->Append(js_hypothesis_object); @@ -335,7 +336,7 @@ void SpeechInputExtensionManager::DidStartReceivingAudioOnUIThread() { } void SpeechInputExtensionManager::OnRecognizerError( - int caller_id, content::SpeechInputError error) { + int caller_id, content::SpeechRecognitionErrorCode error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK_EQ(caller_id, kSpeechCallerId); VLOG(1) << "OnRecognizerError: " << error; @@ -351,10 +352,10 @@ void SpeechInputExtensionManager::OnRecognizerError( bool report_to_event = true; switch (error) { - case content::SPEECH_INPUT_ERROR_NONE: + case content::SPEECH_RECOGNITION_ERROR_NONE: break; - case content::SPEECH_INPUT_ERROR_AUDIO: + case content::SPEECH_RECOGNITION_ERROR_AUDIO: if (state_ == kStarting) { event_error_code = kErrorUnableToStart; report_to_event = false; @@ -363,22 +364,22 @@ void SpeechInputExtensionManager::OnRecognizerError( } break; - case content::SPEECH_INPUT_ERROR_NETWORK: + case content::SPEECH_RECOGNITION_ERROR_NETWORK: event_error_code = kErrorNetworkError; break; - case content::SPEECH_INPUT_ERROR_BAD_GRAMMAR: + case content::SPEECH_RECOGNITION_ERROR_BAD_GRAMMAR: // No error is returned on invalid language, for example. // To avoid confusion about when this is would be fired, the invalid // params error is not being exposed to the onError event. event_error_code = kErrorUnableToStart; break; - case content::SPEECH_INPUT_ERROR_NO_SPEECH: + case content::SPEECH_RECOGNITION_ERROR_NO_SPEECH: event_error_code = kErrorNoSpeechHeard; break; - case content::SPEECH_INPUT_ERROR_NO_MATCH: + case content::SPEECH_RECOGNITION_ERROR_NO_MATCH: event_error_code = kErrorNoResults; break; @@ -551,7 +552,7 @@ void SpeechInputExtensionManager::StartOnIOThread( return; } - if (GetSpeechInputExtensionInterface()->IsRecordingInProcess()) { + if (GetSpeechInputExtensionInterface()->IsCapturingAudio()) { BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(&SpeechInputExtensionManager::DispatchError, this, std::string(kErrorRecordingDeviceInUse), false)); @@ -565,12 +566,12 @@ void SpeechInputExtensionManager::StartOnIOThread( bool SpeechInputExtensionManager::HasAudioInputDevices() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - return SpeechInputManager::GetInstance()->HasAudioInputDevices(); + return SpeechRecognitionManager::GetInstance()->HasAudioInputDevices(); } -bool SpeechInputExtensionManager::IsRecordingInProcess() { +bool SpeechInputExtensionManager::IsCapturingAudio() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - return SpeechInputManager::GetInstance()->IsRecordingInProcess(); + return SpeechRecognitionManager::GetInstance()->IsCapturingAudio(); } void SpeechInputExtensionManager::IsRecording( @@ -586,7 +587,7 @@ void SpeechInputExtensionManager::IsRecordingOnIOThread( const IsRecordingCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - bool result = GetSpeechInputExtensionInterface()->IsRecordingInProcess(); + bool result = GetSpeechInputExtensionInterface()->IsCapturingAudio(); BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::Bind(&SpeechInputExtensionManager::IsRecordingOnUIThread, |
