diff options
author | allanwoj@chromium.org <allanwoj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-31 11:08:19 +0000 |
---|---|---|
committer | allanwoj@chromium.org <allanwoj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-31 11:08:19 +0000 |
commit | abfb89d06c8062df02660aa4b4efbae1f5320823 (patch) | |
tree | 63f7bcc2df6a5ada50ae11f9e674bdf9e4da9026 /chrome/browser/geolocation/chrome_access_token_store.cc | |
parent | 569d127f862832145c979308ba1d2f4144d72bec (diff) | |
download | chromium_src-abfb89d06c8062df02660aa4b4efbae1f5320823.zip chromium_src-abfb89d06c8062df02660aa4b4efbae1f5320823.tar.gz chromium_src-abfb89d06c8062df02660aa4b4efbae1f5320823.tar.bz2 |
Use new network location service protocol
Changed NetworkLocationRequest to point to the new Geolocation API. All data is now sent in the url as an HTTP GET. Altered unit tests to reflect this and removed a test fixture related to gateway data as this API does not support it. Further removal of gateway code to be done in a separate CL.
BUG=http://b/5094774
TEST=--gtest_filter=GeolocationNetwork*
Review URL: http://codereview.chromium.org/7718028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98954 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/geolocation/chrome_access_token_store.cc')
-rw-r--r-- | chrome/browser/geolocation/chrome_access_token_store.cc | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/chrome/browser/geolocation/chrome_access_token_store.cc b/chrome/browser/geolocation/chrome_access_token_store.cc index 2ba45a5..140261d 100644 --- a/chrome/browser/geolocation/chrome_access_token_store.cc +++ b/chrome/browser/geolocation/chrome_access_token_store.cc @@ -14,6 +14,12 @@ #include "content/browser/browser_thread.h" #include "googleurl/src/gurl.h" +namespace { +// This was the default location service url for Chrome versions 14 and earlier +// but is no longer supported. +const char* kOldDefaultNetworkProviderUrl = "https://www.google.com/loc/json"; +} // namespace + void ChromeAccessTokenStore::RegisterPrefs(PrefService* prefs) { prefs->RegisterDictionaryPref(prefs::kGeolocationAccessToken); } @@ -26,11 +32,12 @@ void ChromeAccessTokenStore::LoadDictionaryStoreInUIThread( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (request->canceled()) return; - const DictionaryValue* token_dictionary = - g_browser_process->local_state()->GetDictionary( - prefs::kGeolocationAccessToken); + DictionaryPrefUpdate update(g_browser_process->local_state(), + prefs::kGeolocationAccessToken); + DictionaryValue* token_dictionary = update.Get(); AccessTokenStore::AccessTokenSet access_token_set; + bool has_old_network_provider_url = false; // The dictionary value could be NULL if the pref has never been set. if (token_dictionary != NULL) { for (DictionaryValue::key_iterator it = token_dictionary->begin_keys(); @@ -38,9 +45,16 @@ void ChromeAccessTokenStore::LoadDictionaryStoreInUIThread( GURL url(*it); if (!url.is_valid()) continue; + if (url.spec() == kOldDefaultNetworkProviderUrl) { + has_old_network_provider_url = true; + continue; + } token_dictionary->GetStringWithoutPathExpansion(*it, &access_token_set[url]); } + if (has_old_network_provider_url) + token_dictionary->RemoveWithoutPathExpansion( + kOldDefaultNetworkProviderUrl, NULL); } request->ForwardResultAsync(MakeTuple(access_token_set)); } @@ -61,8 +75,8 @@ void SetAccessTokenOnUIThread(const GURL& server_url, const string16& token) { server_url.spec(), Value::CreateStringValue(token)); } -void ChromeAccessTokenStore::SaveAccessToken( - const GURL& server_url, const string16& access_token) { +void ChromeAccessTokenStore::SaveAccessToken(const GURL& server_url, + const string16& access_token) { BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, NewRunnableFunction( &SetAccessTokenOnUIThread, server_url, access_token)); } |