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

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

Issue 11179003: Reapply geolocation network protocol changes. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1271/src/
Patch Set: Created 8 years, 2 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 | « no previous file | content/browser/geolocation/location_arbitrator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/geolocation/chrome_access_token_store.cc
===================================================================
--- chrome/browser/geolocation/chrome_access_token_store.cc (revision 162123)
+++ chrome/browser/geolocation/chrome_access_token_store.cc (working copy)
@@ -20,10 +20,20 @@
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";
+bool IsUnsupportedNetworkProviderUrl(const GURL& url) {
+ const std::string& spec = url.spec();
+ // Unsupported after Chrome v14.
+ if (spec == "https://www.google.com/loc/json")
+ return true;
+
+ // Unsupported after Chrome v22.
+ if (spec == "https://maps.googleapis.com/maps/api/browserlocation/json")
+ return true;
+
+ return false;
+}
+
// Loads access tokens and other necessary data on the UI thread, and
// calls back to the originator on the originating threaad.
class TokenLoadingJob : public base::RefCountedThreadSafe<TokenLoadingJob> {
@@ -53,7 +63,7 @@
prefs::kGeolocationAccessToken);
DictionaryValue* token_dictionary = update.Get();
- bool has_old_network_provider_url = false;
+ std::vector<std::string> providers_to_remove;
// 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();
@@ -61,16 +71,17 @@
GURL url(*it);
if (!url.is_valid())
continue;
- if (url.spec() == kOldDefaultNetworkProviderUrl) {
- has_old_network_provider_url = true;
+ if (IsUnsupportedNetworkProviderUrl(url)) {
+ providers_to_remove.push_back(*it);
continue;
}
token_dictionary->GetStringWithoutPathExpansion(
*it, &access_token_set_[url]);
}
- if (has_old_network_provider_url)
+ for (size_t i = 0; i < providers_to_remove.size(); ++i) {
token_dictionary->RemoveWithoutPathExpansion(
- kOldDefaultNetworkProviderUrl, NULL);
+ providers_to_remove[i], NULL);
+ }
}
system_request_context_ = g_browser_process->system_request_context();
« no previous file with comments | « no previous file | content/browser/geolocation/location_arbitrator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698