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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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; |
47 } | 47 } |
48 DVLOG(1) << "ParseServerResponse: Parsing response " << response_body; | 48 DVLOG(1) << "ParseServerResponse: Parsing response " << response_body; |
49 | 49 |
50 // Parse the response, ignoring comments. | 50 // Parse the response, ignoring comments. |
51 std::string error_msg; | 51 std::string error_msg; |
52 scoped_ptr<base::Value> response_value = base::JSONReader::ReadAndReturnError( | 52 std::unique_ptr<base::Value> response_value = |
53 response_body, base::JSON_PARSE_RFC, NULL, &error_msg); | 53 base::JSONReader::ReadAndReturnError(response_body, base::JSON_PARSE_RFC, |
| 54 NULL, &error_msg); |
54 if (response_value == NULL) { | 55 if (response_value == NULL) { |
55 LOG(WARNING) << "ParseServerResponse: JSONReader failed : " << error_msg; | 56 LOG(WARNING) << "ParseServerResponse: JSONReader failed : " << error_msg; |
56 return false; | 57 return false; |
57 } | 58 } |
58 | 59 |
59 if (!response_value->IsType(base::Value::TYPE_DICTIONARY)) { | 60 if (!response_value->IsType(base::Value::TYPE_DICTIONARY)) { |
60 DVLOG(1) << "ParseServerResponse: Unexpected response type " | 61 DVLOG(1) << "ParseServerResponse: Unexpected response type " |
61 << response_value->GetType(); | 62 << response_value->GetType(); |
62 return false; | 63 return false; |
63 } | 64 } |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 | 289 |
289 bool GoogleOneShotRemoteEngine::IsRecognitionPending() const { | 290 bool GoogleOneShotRemoteEngine::IsRecognitionPending() const { |
290 return url_fetcher_ != NULL; | 291 return url_fetcher_ != NULL; |
291 } | 292 } |
292 | 293 |
293 int GoogleOneShotRemoteEngine::GetDesiredAudioChunkDurationMs() const { | 294 int GoogleOneShotRemoteEngine::GetDesiredAudioChunkDurationMs() const { |
294 return kAudioPacketIntervalMs; | 295 return kAudioPacketIntervalMs; |
295 } | 296 } |
296 | 297 |
297 } // namespace content | 298 } // namespace content |
OLD | NEW |