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/geolocation/network_location_request.h" | 5 #include "content/browser/geolocation/network_location_request.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 #include <set> | 10 #include <set> |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 DCHECK(!wifi_timestamp.is_null()); | 353 DCHECK(!wifi_timestamp.is_null()); |
354 | 354 |
355 if (response_body.empty()) { | 355 if (response_body.empty()) { |
356 LOG(WARNING) << "ParseServerResponse() : Response was empty."; | 356 LOG(WARNING) << "ParseServerResponse() : Response was empty."; |
357 return false; | 357 return false; |
358 } | 358 } |
359 DVLOG(1) << "ParseServerResponse() : Parsing response " << response_body; | 359 DVLOG(1) << "ParseServerResponse() : Parsing response " << response_body; |
360 | 360 |
361 // Parse the response, ignoring comments. | 361 // Parse the response, ignoring comments. |
362 std::string error_msg; | 362 std::string error_msg; |
363 scoped_ptr<base::Value> response_value = base::JSONReader::ReadAndReturnError( | 363 std::unique_ptr<base::Value> response_value = |
364 response_body, base::JSON_PARSE_RFC, NULL, &error_msg); | 364 base::JSONReader::ReadAndReturnError(response_body, base::JSON_PARSE_RFC, |
| 365 NULL, &error_msg); |
365 if (response_value == NULL) { | 366 if (response_value == NULL) { |
366 LOG(WARNING) << "ParseServerResponse() : JSONReader failed : " | 367 LOG(WARNING) << "ParseServerResponse() : JSONReader failed : " |
367 << error_msg; | 368 << error_msg; |
368 return false; | 369 return false; |
369 } | 370 } |
370 | 371 |
371 if (!response_value->IsType(base::Value::TYPE_DICTIONARY)) { | 372 if (!response_value->IsType(base::Value::TYPE_DICTIONARY)) { |
372 VLOG(1) << "ParseServerResponse() : Unexpected response type " | 373 VLOG(1) << "ParseServerResponse() : Unexpected response type " |
373 << response_value->GetType(); | 374 << response_value->GetType(); |
374 return false; | 375 return false; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 | 418 |
418 // Other fields are optional. | 419 // Other fields are optional. |
419 GetAsDouble(*response_object, kAccuracyString, &position->accuracy); | 420 GetAsDouble(*response_object, kAccuracyString, &position->accuracy); |
420 | 421 |
421 return true; | 422 return true; |
422 } | 423 } |
423 | 424 |
424 } // namespace | 425 } // namespace |
425 | 426 |
426 } // namespace content | 427 } // namespace content |
OLD | NEW |