| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chromeos/geolocation/simple_geolocation_request.h" | 5 #include "chromeos/geolocation/simple_geolocation_request.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 server_url, "JSONReader failed: " + error_msg, position); | 192 server_url, "JSONReader failed: " + error_msg, position); |
| 193 RecordUmaEvent(SIMPLE_GEOLOCATION_REQUEST_EVENT_RESPONSE_MALFORMED); | 193 RecordUmaEvent(SIMPLE_GEOLOCATION_REQUEST_EVENT_RESPONSE_MALFORMED); |
| 194 return false; | 194 return false; |
| 195 } | 195 } |
| 196 | 196 |
| 197 base::DictionaryValue* response_object = NULL; | 197 base::DictionaryValue* response_object = NULL; |
| 198 if (!response_value->GetAsDictionary(&response_object)) { | 198 if (!response_value->GetAsDictionary(&response_object)) { |
| 199 PrintGeolocationError( | 199 PrintGeolocationError( |
| 200 server_url, | 200 server_url, |
| 201 "Unexpected response type : " + | 201 "Unexpected response type : " + |
| 202 base::StringPrintf("%u", response_value->GetType()), | 202 base::StringPrintf( |
| 203 "%u", static_cast<unsigned int>(response_value->GetType())), |
| 203 position); | 204 position); |
| 204 RecordUmaEvent(SIMPLE_GEOLOCATION_REQUEST_EVENT_RESPONSE_MALFORMED); | 205 RecordUmaEvent(SIMPLE_GEOLOCATION_REQUEST_EVENT_RESPONSE_MALFORMED); |
| 205 return false; | 206 return false; |
| 206 } | 207 } |
| 207 | 208 |
| 208 base::DictionaryValue* error_object = NULL; | 209 base::DictionaryValue* error_object = NULL; |
| 209 base::DictionaryValue* location_object = NULL; | 210 base::DictionaryValue* location_object = NULL; |
| 210 response_object->GetDictionaryWithoutPathExpansion(kLocationString, | 211 response_object->GetDictionaryWithoutPathExpansion(kLocationString, |
| 211 &location_object); | 212 &location_object); |
| 212 response_object->GetDictionaryWithoutPathExpansion(kErrorString, | 213 response_object->GetDictionaryWithoutPathExpansion(kErrorString, |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 ? SIMPLE_GEOLOCATION_REQUEST_RESULT_SERVER_ERROR | 474 ? SIMPLE_GEOLOCATION_REQUEST_RESULT_SERVER_ERROR |
| 474 : SIMPLE_GEOLOCATION_REQUEST_RESULT_FAILURE); | 475 : SIMPLE_GEOLOCATION_REQUEST_RESULT_FAILURE); |
| 475 RecordUmaResult(result, retries_); | 476 RecordUmaResult(result, retries_); |
| 476 position_.status = Geoposition::STATUS_TIMEOUT; | 477 position_.status = Geoposition::STATUS_TIMEOUT; |
| 477 const base::TimeDelta elapsed = base::Time::Now() - request_started_at_; | 478 const base::TimeDelta elapsed = base::Time::Now() - request_started_at_; |
| 478 ReplyAndDestroySelf(elapsed, true /* server_error */); | 479 ReplyAndDestroySelf(elapsed, true /* server_error */); |
| 479 // "this" is already destroyed here. | 480 // "this" is already destroyed here. |
| 480 } | 481 } |
| 481 | 482 |
| 482 } // namespace chromeos | 483 } // namespace chromeos |
| OLD | NEW |