| Index: content/browser/speech/google_streaming_remote_engine.cc
|
| diff --git a/content/browser/speech/google_streaming_remote_engine.cc b/content/browser/speech/google_streaming_remote_engine.cc
|
| index 66bd9e664692f109887f8914dbab496d2f39724f..2f050bd617f60cf9c016c50a7e57e85021b9e10a 100644
|
| --- a/content/browser/speech/google_streaming_remote_engine.cc
|
| +++ b/content/browser/speech/google_streaming_remote_engine.cc
|
| @@ -27,13 +27,9 @@
|
| #include "net/url_request/url_request_context.h"
|
| #include "net/url_request/url_request_status.h"
|
|
|
| -using content::BrowserThread;
|
| -using content::SpeechRecognitionError;
|
| -using content::SpeechRecognitionErrorCode;
|
| -using content::SpeechRecognitionHypothesis;
|
| -using content::SpeechRecognitionResult;
|
| using net::URLFetcher;
|
|
|
| +namespace content {
|
| namespace {
|
|
|
| const char kWebServiceBaseUrl[] =
|
| @@ -41,8 +37,7 @@ const char kWebServiceBaseUrl[] =
|
| const char kDownstreamUrl[] = "/down?";
|
| const char kUpstreamUrl[] = "/up?";
|
| const int kAudioPacketIntervalMs = 100;
|
| -const speech::AudioEncoder::Codec kDefaultAudioCodec =
|
| - speech::AudioEncoder::CODEC_FLAC;
|
| +const AudioEncoder::Codec kDefaultAudioCodec = AudioEncoder::CODEC_FLAC;
|
|
|
| // This mathces the maximum maxAlternatives value supported by the server.
|
| const uint32 kMaxMaxAlternatives = 30;
|
| @@ -50,7 +45,7 @@ const uint32 kMaxMaxAlternatives = 30;
|
| // TODO(hans): Remove this and other logging when we don't need it anymore.
|
| void DumpResponse(const std::string& response) {
|
| DVLOG(1) << "------------";
|
| - speech::proto::SpeechRecognitionEvent event;
|
| + proto::SpeechRecognitionEvent event;
|
| if (!event.ParseFromString(response)) {
|
| DVLOG(1) << "Parse failed!";
|
| return;
|
| @@ -59,13 +54,13 @@ void DumpResponse(const std::string& response) {
|
| DVLOG(1) << "STATUS\t" << event.status();
|
| for (int i = 0; i < event.result_size(); ++i) {
|
| DVLOG(1) << "RESULT #" << i << ":";
|
| - const speech::proto::SpeechRecognitionResult& res = event.result(i);
|
| + const proto::SpeechRecognitionResult& res = event.result(i);
|
| if (res.has_final())
|
| DVLOG(1) << " FINAL:\t" << res.final();
|
| if (res.has_stability())
|
| DVLOG(1) << " STABILITY:\t" << res.stability();
|
| for (int j = 0; j < res.alternative_size(); ++j) {
|
| - const speech::proto::SpeechRecognitionAlternative& alt =
|
| + const proto::SpeechRecognitionAlternative& alt =
|
| res.alternative(j);
|
| if (alt.has_confidence())
|
| DVLOG(1) << " CONFIDENCE:\t" << alt.confidence();
|
| @@ -92,8 +87,6 @@ std::string GetAPIKey() {
|
|
|
| } // namespace
|
|
|
| -namespace speech {
|
| -
|
| const int GoogleStreamingRemoteEngine::kUpstreamUrlFetcherIdForTests = 0;
|
| const int GoogleStreamingRemoteEngine::kDownstreamUrlFetcherIdForTests = 1;
|
| const int GoogleStreamingRemoteEngine::kWebserviceStatusNoError = 0;
|
| @@ -422,24 +415,24 @@ GoogleStreamingRemoteEngine::ProcessDownstreamResponse(
|
| case proto::SpeechRecognitionEvent::STATUS_SUCCESS:
|
| break;
|
| case proto::SpeechRecognitionEvent::STATUS_NO_SPEECH:
|
| - return Abort(content::SPEECH_RECOGNITION_ERROR_NO_SPEECH);
|
| + return Abort(SPEECH_RECOGNITION_ERROR_NO_SPEECH);
|
| case proto::SpeechRecognitionEvent::STATUS_ABORTED:
|
| - return Abort(content::SPEECH_RECOGNITION_ERROR_ABORTED);
|
| + return Abort(SPEECH_RECOGNITION_ERROR_ABORTED);
|
| case proto::SpeechRecognitionEvent::STATUS_AUDIO_CAPTURE:
|
| - return Abort(content::SPEECH_RECOGNITION_ERROR_AUDIO);
|
| + return Abort(SPEECH_RECOGNITION_ERROR_AUDIO);
|
| case proto::SpeechRecognitionEvent::STATUS_NETWORK:
|
| - return Abort(content::SPEECH_RECOGNITION_ERROR_NETWORK);
|
| + return Abort(SPEECH_RECOGNITION_ERROR_NETWORK);
|
| case proto::SpeechRecognitionEvent::STATUS_NOT_ALLOWED:
|
| // TODO(hans): We need a better error code for this.
|
| - return Abort(content::SPEECH_RECOGNITION_ERROR_ABORTED);
|
| + return Abort(SPEECH_RECOGNITION_ERROR_ABORTED);
|
| case proto::SpeechRecognitionEvent::STATUS_SERVICE_NOT_ALLOWED:
|
| // TODO(hans): We need a better error code for this.
|
| - return Abort(content::SPEECH_RECOGNITION_ERROR_ABORTED);
|
| + return Abort(SPEECH_RECOGNITION_ERROR_ABORTED);
|
| case proto::SpeechRecognitionEvent::STATUS_BAD_GRAMMAR:
|
| - return Abort(content::SPEECH_RECOGNITION_ERROR_BAD_GRAMMAR);
|
| + return Abort(SPEECH_RECOGNITION_ERROR_BAD_GRAMMAR);
|
| case proto::SpeechRecognitionEvent::STATUS_LANGUAGE_NOT_SUPPORTED:
|
| // TODO(hans): We need a better error code for this.
|
| - return Abort(content::SPEECH_RECOGNITION_ERROR_ABORTED);
|
| + return Abort(SPEECH_RECOGNITION_ERROR_ABORTED);
|
| }
|
| }
|
|
|
| @@ -524,19 +517,19 @@ GoogleStreamingRemoteEngine::CloseDownstream(const FSMEventArgs&) {
|
|
|
| GoogleStreamingRemoteEngine::FSMState
|
| GoogleStreamingRemoteEngine::AbortSilently(const FSMEventArgs&) {
|
| - return Abort(content::SPEECH_RECOGNITION_ERROR_NONE);
|
| + return Abort(SPEECH_RECOGNITION_ERROR_NONE);
|
| }
|
|
|
| GoogleStreamingRemoteEngine::FSMState
|
| GoogleStreamingRemoteEngine::AbortWithError(const FSMEventArgs&) {
|
| - return Abort(content::SPEECH_RECOGNITION_ERROR_NETWORK);
|
| + return Abort(SPEECH_RECOGNITION_ERROR_NETWORK);
|
| }
|
|
|
| GoogleStreamingRemoteEngine::FSMState GoogleStreamingRemoteEngine::Abort(
|
| SpeechRecognitionErrorCode error_code) {
|
| DVLOG(1) << "Aborting with error " << error_code;
|
|
|
| - if (error_code != content::SPEECH_RECOGNITION_ERROR_NONE) {
|
| + if (error_code != SPEECH_RECOGNITION_ERROR_NONE) {
|
| delegate()->OnSpeechRecognitionEngineError(
|
| SpeechRecognitionError(error_code));
|
| }
|
| @@ -596,4 +589,4 @@ GoogleStreamingRemoteEngine::FSMEventArgs::FSMEventArgs(FSMEvent event_value)
|
| GoogleStreamingRemoteEngine::FSMEventArgs::~FSMEventArgs() {
|
| }
|
|
|
| -} // namespace speech
|
| +} // namespace content
|
|
|