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

Side by Side Diff: content/browser/geolocation/network_location_request.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/geolocation/network_location_request.h" 5 #include "content/browser/geolocation/network_location_request.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 317
318 if (response_body.empty()) { 318 if (response_body.empty()) {
319 LOG(WARNING) << "ParseServerResponse() : Response was empty."; 319 LOG(WARNING) << "ParseServerResponse() : Response was empty.";
320 return false; 320 return false;
321 } 321 }
322 DVLOG(1) << "ParseServerResponse() : Parsing response " << response_body; 322 DVLOG(1) << "ParseServerResponse() : Parsing response " << response_body;
323 323
324 // Parse the response, ignoring comments. 324 // Parse the response, ignoring comments.
325 std::string error_msg; 325 std::string error_msg;
326 scoped_ptr<Value> response_value(base::JSONReader::ReadAndReturnError( 326 scoped_ptr<Value> response_value(base::JSONReader::ReadAndReturnError(
327 response_body, false, NULL, &error_msg)); 327 response_body, base::JSON_PARSE_RFC, NULL, &error_msg));
328 if (response_value == NULL) { 328 if (response_value == NULL) {
329 LOG(WARNING) << "ParseServerResponse() : JSONReader failed : " 329 LOG(WARNING) << "ParseServerResponse() : JSONReader failed : "
330 << error_msg; 330 << error_msg;
331 return false; 331 return false;
332 } 332 }
333 333
334 if (!response_value->IsType(Value::TYPE_DICTIONARY)) { 334 if (!response_value->IsType(Value::TYPE_DICTIONARY)) {
335 VLOG(1) << "ParseServerResponse() : Unexpected response type " 335 VLOG(1) << "ParseServerResponse() : Unexpected response type "
336 << response_value->GetType(); 336 << response_value->GetType();
337 return false; 337 return false;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 position->longitude = longitude; 406 position->longitude = longitude;
407 position->timestamp = timestamp; 407 position->timestamp = timestamp;
408 408
409 // Other fields are optional. 409 // Other fields are optional.
410 GetAsDouble(*response_object, kAccuracyString, &position->accuracy); 410 GetAsDouble(*response_object, kAccuracyString, &position->accuracy);
411 411
412 return true; 412 return true;
413 } 413 }
414 414
415 } // namespace 415 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698