| 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/timezone/timezone_request.h" | 5 #include "chromeos/timezone/timezone_request.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 base::JSONReader::ReadAndReturnError(response_body, base::JSON_PARSE_RFC, | 181 base::JSONReader::ReadAndReturnError(response_body, base::JSON_PARSE_RFC, |
| 182 NULL, &error_msg); | 182 NULL, &error_msg); |
| 183 if (response_value == NULL) { | 183 if (response_value == NULL) { |
| 184 PrintTimeZoneError(server_url, "JSONReader failed: " + error_msg, timezone); | 184 PrintTimeZoneError(server_url, "JSONReader failed: " + error_msg, timezone); |
| 185 RecordUmaEvent(TIMEZONE_REQUEST_EVENT_RESPONSE_MALFORMED); | 185 RecordUmaEvent(TIMEZONE_REQUEST_EVENT_RESPONSE_MALFORMED); |
| 186 return false; | 186 return false; |
| 187 } | 187 } |
| 188 | 188 |
| 189 const base::DictionaryValue* response_object = NULL; | 189 const base::DictionaryValue* response_object = NULL; |
| 190 if (!response_value->GetAsDictionary(&response_object)) { | 190 if (!response_value->GetAsDictionary(&response_object)) { |
| 191 PrintTimeZoneError(server_url, | 191 PrintTimeZoneError( |
| 192 "Unexpected response type : " + | 192 server_url, |
| 193 base::StringPrintf("%u", response_value->GetType()), | 193 "Unexpected response type : " + |
| 194 timezone); | 194 base::StringPrintf( |
| 195 "%u", static_cast<unsigned int>(response_value->GetType())), |
| 196 timezone); |
| 195 RecordUmaEvent(TIMEZONE_REQUEST_EVENT_RESPONSE_MALFORMED); | 197 RecordUmaEvent(TIMEZONE_REQUEST_EVENT_RESPONSE_MALFORMED); |
| 196 return false; | 198 return false; |
| 197 } | 199 } |
| 198 | 200 |
| 199 std::string status; | 201 std::string status; |
| 200 | 202 |
| 201 if (!response_object->GetStringWithoutPathExpansion(kStatusString, &status)) { | 203 if (!response_object->GetStringWithoutPathExpansion(kStatusString, &status)) { |
| 202 PrintTimeZoneError(server_url, "Missing status attribute.", timezone); | 204 PrintTimeZoneError(server_url, "Missing status attribute.", timezone); |
| 203 RecordUmaEvent(TIMEZONE_REQUEST_EVENT_RESPONSE_MALFORMED); | 205 RecordUmaEvent(TIMEZONE_REQUEST_EVENT_RESPONSE_MALFORMED); |
| 204 return false; | 206 return false; |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 dstOffset, | 424 dstOffset, |
| 423 rawOffset, | 425 rawOffset, |
| 424 timeZoneId.c_str(), | 426 timeZoneId.c_str(), |
| 425 timeZoneName.c_str(), | 427 timeZoneName.c_str(), |
| 426 error_message.c_str(), | 428 error_message.c_str(), |
| 427 (unsigned)status, | 429 (unsigned)status, |
| 428 (status < arraysize(status2string) ? status2string[status] : "unknown")); | 430 (status < arraysize(status2string) ? status2string[status] : "unknown")); |
| 429 } | 431 } |
| 430 | 432 |
| 431 } // namespace chromeos | 433 } // namespace chromeos |
| OLD | NEW |