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

Side by Side Diff: content/browser/speech/google_one_shot_remote_engine.cc

Issue 9960077: Modify the base::JSONReader interface to take a set of options rather than a boolean flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <vector> 7 #include <vector>
8 8
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 SpeechRecognitionError* error) { 48 SpeechRecognitionError* error) {
49 if (response_body.empty()) { 49 if (response_body.empty()) {
50 LOG(WARNING) << "ParseServerResponse: Response was empty."; 50 LOG(WARNING) << "ParseServerResponse: Response was empty.";
51 return false; 51 return false;
52 } 52 }
53 DVLOG(1) << "ParseServerResponse: Parsing response " << response_body; 53 DVLOG(1) << "ParseServerResponse: Parsing response " << response_body;
54 54
55 // Parse the response, ignoring comments. 55 // Parse the response, ignoring comments.
56 std::string error_msg; 56 std::string error_msg;
57 scoped_ptr<Value> response_value(base::JSONReader::ReadAndReturnError( 57 scoped_ptr<Value> response_value(base::JSONReader::ReadAndReturnError(
58 response_body, false, NULL, &error_msg)); 58 response_body, base::JSON_PARSE_RFC, NULL, &error_msg));
59 if (response_value == NULL) { 59 if (response_value == NULL) {
60 LOG(WARNING) << "ParseServerResponse: JSONReader failed : " << error_msg; 60 LOG(WARNING) << "ParseServerResponse: JSONReader failed : " << error_msg;
61 return false; 61 return false;
62 } 62 }
63 63
64 if (!response_value->IsType(Value::TYPE_DICTIONARY)) { 64 if (!response_value->IsType(Value::TYPE_DICTIONARY)) {
65 VLOG(1) << "ParseServerResponse: Unexpected response type " 65 VLOG(1) << "ParseServerResponse: Unexpected response type "
66 << response_value->GetType(); 66 << response_value->GetType();
67 return false; 67 return false;
68 } 68 }
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 292
293 bool GoogleOneShotRemoteEngine::IsRecognitionPending() const { 293 bool GoogleOneShotRemoteEngine::IsRecognitionPending() const {
294 return url_fetcher_ != NULL; 294 return url_fetcher_ != NULL;
295 } 295 }
296 296
297 int GoogleOneShotRemoteEngine::GetDesiredAudioChunkDurationMs() const { 297 int GoogleOneShotRemoteEngine::GetDesiredAudioChunkDurationMs() const {
298 return kAudioPacketIntervalMs; 298 return kAudioPacketIntervalMs;
299 } 299 }
300 300
301 } // namespace speech 301 } // namespace speech
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698