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

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

Issue 2847045: URLs with repeated domain names requesting tracking information (Closed)
Patch Set: Created 10 years, 6 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 | chrome/browser/geolocation/geolocation_settings_state_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/geolocation/geolocation_settings_state.cc
diff --git a/chrome/browser/geolocation/geolocation_settings_state.cc b/chrome/browser/geolocation/geolocation_settings_state.cc
index f246598eb2073e9f209537efd2447ab43bbed167..6f8548ecd2c2c2afa7e665c1a952c29f1310882d 100644
--- a/chrome/browser/geolocation/geolocation_settings_state.cc
+++ b/chrome/browser/geolocation/geolocation_settings_state.cc
@@ -50,13 +50,30 @@ void GeolocationSettingsState::GetDetailedInfo(
DCHECK(embedder_url_.is_valid());
const ContentSetting default_setting =
profile_->GetGeolocationContentSettingsMap()->GetDefaultContentSetting();
+ std::set<std::string> formatted_hosts;
+ std::set<std::string> repeated_formatted_hosts;
+
+ // Build a set of repeated formatted hosts
+ for (StateMap::const_iterator i(state_map_.begin());
+ i != state_map_.end(); ++i) {
+ std::string formatted_host = GURLToFormattedHost(i->first);
+ if (!formatted_hosts.insert(formatted_host).second) {
+ repeated_formatted_hosts.insert(formatted_host);
+ }
+ }
+
for (StateMap::const_iterator i(state_map_.begin());
i != state_map_.end(); ++i) {
if (i->second == CONTENT_SETTING_ALLOW)
*tab_state_flags |= TABSTATE_HAS_ANY_ALLOWED;
if (formatted_hosts_per_state) {
- (*formatted_hosts_per_state)[i->second].insert(
- GURLToFormattedHost(i->first));
+ std::string formatted_host = GURLToFormattedHost(i->first);
+ std::string final_formatted_host =
+ repeated_formatted_hosts.find(formatted_host) ==
+ repeated_formatted_hosts.end() ?
+ formatted_host :
+ i->first.spec();
+ (*formatted_hosts_per_state)[i->second].insert(final_formatted_host);
}
const ContentSetting saved_setting =
« no previous file with comments | « no previous file | chrome/browser/geolocation/geolocation_settings_state_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698