diff options
author | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-11 11:33:07 +0000 |
---|---|---|
committer | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-11 11:33:07 +0000 |
commit | 6060af48c8045b5bae1f194d2aa39f437c9ebf19 (patch) | |
tree | f1c4e35fa519a71fe4cef775b6791f86196641a1 /chrome/browser/geolocation | |
parent | fd4b3e39ad46598edd1fb49b104c897535ffc142 (diff) | |
download | chromium_src-6060af48c8045b5bae1f194d2aa39f437c9ebf19.zip chromium_src-6060af48c8045b5bae1f194d2aa39f437c9ebf19.tar.gz chromium_src-6060af48c8045b5bae1f194d2aa39f437c9ebf19.tar.bz2 |
Workaround for bug 41001 - treat empty response as no location fix available
BUG=41001
TEST=Run on desktop computer on corp network (no reverse IP available). Should report 'location unavailable', not malformed response.
Review URL: http://codereview.chromium.org/2714014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49521 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/geolocation')
-rw-r--r-- | chrome/browser/geolocation/network_location_request.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/chrome/browser/geolocation/network_location_request.cc b/chrome/browser/geolocation/network_location_request.cc index c278b74..45a2516 100644 --- a/chrome/browser/geolocation/network_location_request.cc +++ b/chrome/browser/geolocation/network_location_request.cc @@ -54,6 +54,8 @@ void AddInteger(const std::wstring& property_name, int value, DictionaryValue* object); // Parses the server response body. Returns true if parsing was successful. +// Sets |*position| to the parsed location if a valid fix was received, +// otherwise leaves it unchanged (i.e. IsInitialized() == false). bool ParseServerResponse(const std::string& response_body, const base::Time& timestamp, Geoposition* position, @@ -279,6 +281,7 @@ bool ParseServerResponse(const std::string& response_body, Geoposition* position, string16* access_token) { DCHECK(position); + DCHECK(!position->IsInitialized()); DCHECK(access_token); DCHECK(!timestamp.is_null()); @@ -314,7 +317,9 @@ bool ParseServerResponse(const std::string& response_body, Value* location_value = NULL; if (!response_object->Get(kLocationString, &location_value)) { LOG(INFO) << "ParseServerResponse() : Missing location attribute.\n"; - return false; + // GLS returns an empty response (with no location property) to represent + // no fix available; return true to indicate successful parse. + return true; } DCHECK(location_value); |