OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/geolocation/network_location_request.h" | 5 #include "chrome/browser/geolocation/network_location_request.h" |
6 | 6 |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 if (response_body.empty()) { | 285 if (response_body.empty()) { |
286 LOG(WARNING) << "ParseServerResponse() : Response was empty.\n"; | 286 LOG(WARNING) << "ParseServerResponse() : Response was empty.\n"; |
287 return false; | 287 return false; |
288 } | 288 } |
289 DLOG(INFO) << "ParseServerResponse() : Parsing response " | 289 DLOG(INFO) << "ParseServerResponse() : Parsing response " |
290 << response_body << ".\n"; | 290 << response_body << ".\n"; |
291 | 291 |
292 // Parse the response, ignoring comments. | 292 // Parse the response, ignoring comments. |
293 std::string error_msg; | 293 std::string error_msg; |
294 scoped_ptr<Value> response_value(base::JSONReader::ReadAndReturnError( | 294 scoped_ptr<Value> response_value(base::JSONReader::ReadAndReturnError( |
295 response_body, false, &error_msg)); | 295 response_body, false, NULL, &error_msg)); |
296 if (response_value == NULL) { | 296 if (response_value == NULL) { |
297 LOG(WARNING) << "ParseServerResponse() : JSONReader failed : " | 297 LOG(WARNING) << "ParseServerResponse() : JSONReader failed : " |
298 << error_msg << ".\n"; | 298 << error_msg << ".\n"; |
299 return false; | 299 return false; |
300 } | 300 } |
301 | 301 |
302 if (!response_value->IsType(Value::TYPE_DICTIONARY)) { | 302 if (!response_value->IsType(Value::TYPE_DICTIONARY)) { |
303 LOG(INFO) << "ParseServerResponse() : Unexpected resopnse type " | 303 LOG(INFO) << "ParseServerResponse() : Unexpected resopnse type " |
304 << response_value->GetType() << ".\n"; | 304 << response_value->GetType() << ".\n"; |
305 return false; | 305 return false; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 AddInteger(L"signal_strength", iter->radio_signal_strength, wifi_tower); | 409 AddInteger(L"signal_strength", iter->radio_signal_strength, wifi_tower); |
410 AddInteger(L"age", age_milliseconds, wifi_tower); | 410 AddInteger(L"age", age_milliseconds, wifi_tower); |
411 AddInteger(L"channel", iter->channel, wifi_tower); | 411 AddInteger(L"channel", iter->channel, wifi_tower); |
412 AddInteger(L"signal_to_noise", iter->signal_to_noise, wifi_tower); | 412 AddInteger(L"signal_to_noise", iter->signal_to_noise, wifi_tower); |
413 AddString(L"ssid", iter->ssid, wifi_tower); | 413 AddString(L"ssid", iter->ssid, wifi_tower); |
414 wifi_towers->Append(wifi_tower); | 414 wifi_towers->Append(wifi_tower); |
415 } | 415 } |
416 body_object->Set(L"wifi_towers", wifi_towers); | 416 body_object->Set(L"wifi_towers", wifi_towers); |
417 } | 417 } |
418 } // namespace | 418 } // namespace |
OLD | NEW |