OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/speech/google_one_shot_remote_engine.h" | 5 #include "content/browser/speech/google_one_shot_remote_engine.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "net/base/load_flags.h" | 21 #include "net/base/load_flags.h" |
22 #include "net/url_request/http_user_agent_settings.h" | 22 #include "net/url_request/http_user_agent_settings.h" |
23 #include "net/url_request/url_fetcher.h" | 23 #include "net/url_request/url_fetcher.h" |
24 #include "net/url_request/url_request_context.h" | 24 #include "net/url_request/url_request_context.h" |
25 #include "net/url_request/url_request_context_getter.h" | 25 #include "net/url_request/url_request_context_getter.h" |
26 #include "net/url_request/url_request_status.h" | 26 #include "net/url_request/url_request_status.h" |
27 | 27 |
28 namespace content { | 28 namespace content { |
29 namespace { | 29 namespace { |
30 | 30 |
31 const char* const kDefaultSpeechRecognitionUrl = | 31 const char kDefaultSpeechRecognitionUrl[] = |
32 "https://www.google.com/speech-api/v1/recognize?xjerr=1&client=chromium&"; | 32 "https://www.google.com/speech-api/v1/recognize?xjerr=1&client=chromium&"; |
33 const char* const kStatusString = "status"; | 33 const char kStatusString[] = "status"; |
34 const char* const kHypothesesString = "hypotheses"; | 34 const char kHypothesesString[] = "hypotheses"; |
35 const char* const kUtteranceString = "utterance"; | 35 const char kUtteranceString[] = "utterance"; |
36 const char* const kConfidenceString = "confidence"; | 36 const char kConfidenceString[] = "confidence"; |
37 const int kWebServiceStatusNoError = 0; | 37 const int kWebServiceStatusNoError = 0; |
38 const int kWebServiceStatusNoSpeech = 4; | 38 const int kWebServiceStatusNoSpeech = 4; |
39 const int kWebServiceStatusNoMatch = 5; | 39 const int kWebServiceStatusNoMatch = 5; |
40 | 40 |
41 bool ParseServerResponse(const std::string& response_body, | 41 bool ParseServerResponse(const std::string& response_body, |
42 SpeechRecognitionResult* result, | 42 SpeechRecognitionResult* result, |
43 SpeechRecognitionError* error) { | 43 SpeechRecognitionError* error) { |
44 if (response_body.empty()) { | 44 if (response_body.empty()) { |
45 LOG(WARNING) << "ParseServerResponse: Response was empty."; | 45 LOG(WARNING) << "ParseServerResponse: Response was empty."; |
46 return false; | 46 return false; |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 | 288 |
289 bool GoogleOneShotRemoteEngine::IsRecognitionPending() const { | 289 bool GoogleOneShotRemoteEngine::IsRecognitionPending() const { |
290 return url_fetcher_ != NULL; | 290 return url_fetcher_ != NULL; |
291 } | 291 } |
292 | 292 |
293 int GoogleOneShotRemoteEngine::GetDesiredAudioChunkDurationMs() const { | 293 int GoogleOneShotRemoteEngine::GetDesiredAudioChunkDurationMs() const { |
294 return kAudioPacketIntervalMs; | 294 return kAudioPacketIntervalMs; |
295 } | 295 } |
296 | 296 |
297 } // namespace content | 297 } // namespace content |
OLD | NEW |