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

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

Issue 9568002: Renamed speech input implementation from to speech_recognition_*. The namespace has been renamed fr… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed nits according to reviewers and renamed x-webkit-speech related stuff to InputTagSpeech*. Created 8 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_extension_manager.cc
diff --git a/chrome/browser/speech/speech_input_extension_manager.cc b/chrome/browser/speech/speech_input_extension_manager.cc
index c5a70a5d9af7ec4ee2c0eb979dab7dba3f349abe..d631bf64a15e72aa6847df06fcc547d9e81e9683 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 {
@@ -230,7 +231,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);
@@ -245,7 +246,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));
@@ -257,7 +258,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);
@@ -327,7 +328,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;
@@ -343,10 +344,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;
@@ -355,22 +356,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;
@@ -543,7 +544,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));
@@ -557,12 +558,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(
@@ -578,7 +579,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,

Powered by Google App Engine
This is Rietveld 408576698