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

Unified Diff: chrome/browser/geolocation/network_location_request.cc

Issue 575021: Revert 38207 - bah. still can't work out why this passes fine on local machin... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/geolocation/network_location_provider_unittest.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/geolocation/network_location_request.cc
===================================================================
--- chrome/browser/geolocation/network_location_request.cc (revision 38207)
+++ chrome/browser/geolocation/network_location_request.cc (working copy)
@@ -66,6 +66,7 @@
ListenerInterface* listener)
: url_context_(context), timestamp_(kint64min), listener_(listener),
url_(url), host_name_(host_name) {
+// DCHECK(url_context_);
DCHECK(listener);
}
@@ -88,7 +89,7 @@
timestamp_ = timestamp;
url_fetcher_.reset(URLFetcher::Create(
- wifi_data.access_point_data.size(), // Used for testing
+ host_name_.size(), // Used for testing
url_, URLFetcher::POST, this));
url_fetcher_->set_upload_data(kMimeApplicationJson, post_body);
url_fetcher_->set_request_context(url_context_);
@@ -311,31 +312,20 @@
response_object->GetStringAsUTF16(kAccessTokenString, access_token);
// Get the location
- Value* location_value = NULL;
- if (!response_object->Get(kLocationString, &location_value)) {
- LOG(INFO) << "ParseServerResponse() : Missing location attribute.\n";
- return false;
+ DictionaryValue* location_object;
+ if (!response_object->GetDictionary(kLocationString, &location_object)) {
+ Value* value = NULL;
+ // If the network provider was unable to provide a position fix, it should
+ // return a 200 with location == null. Otherwise it's an error.
+ return response_object->Get(kLocationString, &value)
+ && value && value->IsType(Value::TYPE_NULL);
}
- DCHECK(location_value);
+ DCHECK(location_object);
- if (!location_value->IsType(Value::TYPE_DICTIONARY)) {
- if (!location_value->IsType(Value::TYPE_NULL)) {
- LOG(INFO) << "ParseServerResponse() : Unexpected location type"
- << location_value->GetType() << ".\n";
- // If the network provider was unable to provide a position fix, it should
- // return a HTTP 200, with "location" : null. Otherwise it's an error.
- return false;
- }
- return true; // Successfully parsed response containing no fix.
- }
- DictionaryValue* location_object =
- static_cast<DictionaryValue*>(location_value);
-
// latitude and longitude fields are always required.
double latitude, longitude;
if (!GetAsDouble(*location_object, kLatitudeString, &latitude) ||
!GetAsDouble(*location_object, kLongitudeString, &longitude)) {
- LOG(INFO) << "ParseServerResponse() : location lacks lat and/or long.\n";
return false;
}
// All error paths covered: now start actually modifying postion.
« no previous file with comments | « chrome/browser/geolocation/network_location_provider_unittest.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698