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

Side by Side Diff: chrome/browser/geolocation/geolocation_content_settings_map.cc

Issue 6905044: Refactor preference syncing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Really fix. And rebase Created 9 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/first_run/first_run.cc ('k') | chrome/browser/instant/instant_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Implementation of the geolocation content settings map. Styled on 5 // Implementation of the geolocation content settings map. Styled on
6 // HostContentSettingsMap however unlike that class, this one does not hold 6 // HostContentSettingsMap however unlike that class, this one does not hold
7 // an additional in-memory copy of the settings as it does not need to support 7 // an additional in-memory copy of the settings as it does not need to support
8 // thread safe synchronous access to the settings; all geolocation permissions 8 // thread safe synchronous access to the settings; all geolocation permissions
9 // are read and written in the UI thread. (If in future this is no longer the 9 // are read and written in the UI thread. (If in future this is no longer the
10 // case, refer to http://codereview.chromium.org/1525018 for a previous version 10 // case, refer to http://codereview.chromium.org/1525018 for a previous version
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 prefs_registrar_.Init(profile_->GetPrefs()); 43 prefs_registrar_.Init(profile_->GetPrefs());
44 prefs_registrar_.Add(prefs::kGeolocationDefaultContentSetting, this); 44 prefs_registrar_.Add(prefs::kGeolocationDefaultContentSetting, this);
45 prefs_registrar_.Add(prefs::kGeolocationContentSettings, this); 45 prefs_registrar_.Add(prefs::kGeolocationContentSettings, this);
46 notification_registrar_.Add(this, NotificationType::PROFILE_DESTROYED, 46 notification_registrar_.Add(this, NotificationType::PROFILE_DESTROYED,
47 Source<Profile>(profile_)); 47 Source<Profile>(profile_));
48 } 48 }
49 49
50 // static 50 // static
51 void GeolocationContentSettingsMap::RegisterUserPrefs(PrefService* prefs) { 51 void GeolocationContentSettingsMap::RegisterUserPrefs(PrefService* prefs) {
52 prefs->RegisterIntegerPref(prefs::kGeolocationDefaultContentSetting, 52 prefs->RegisterIntegerPref(prefs::kGeolocationDefaultContentSetting,
53 CONTENT_SETTING_ASK); 53 CONTENT_SETTING_ASK,
54 prefs->RegisterDictionaryPref(prefs::kGeolocationContentSettings); 54 PrefService::SYNCABLE_PREF);
55 prefs->RegisterDictionaryPref(prefs::kGeolocationContentSettings,
56 PrefService::SYNCABLE_PREF);
55 } 57 }
56 58
57 ContentSetting GeolocationContentSettingsMap::GetDefaultContentSetting() const { 59 ContentSetting GeolocationContentSettingsMap::GetDefaultContentSetting() const {
58 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 60 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
59 // If the profile is destroyed (and set to NULL) return CONTENT_SETTING_BLOCK. 61 // If the profile is destroyed (and set to NULL) return CONTENT_SETTING_BLOCK.
60 if (!profile_) 62 if (!profile_)
61 return CONTENT_SETTING_BLOCK; 63 return CONTENT_SETTING_BLOCK;
62 const PrefService* prefs = profile_->GetPrefs(); 64 const PrefService* prefs = profile_->GetPrefs();
63 const ContentSetting default_content_setting = IntToContentSetting( 65 const ContentSetting default_content_setting = IntToContentSetting(
64 prefs->GetInteger(prefs::kGeolocationDefaultContentSetting)); 66 prefs->GetInteger(prefs::kGeolocationDefaultContentSetting));
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 bool found = dictionary->GetIntegerWithoutPathExpansion(target, &setting); 248 bool found = dictionary->GetIntegerWithoutPathExpansion(target, &setting);
247 DCHECK(found); 249 DCHECK(found);
248 GURL target_url(target); 250 GURL target_url(target);
249 // An empty URL has a special meaning (wildcard), so only accept invalid 251 // An empty URL has a special meaning (wildcard), so only accept invalid
250 // URLs if the original version was empty (avoids treating corrupted prefs 252 // URLs if the original version was empty (avoids treating corrupted prefs
251 // as the wildcard entry; see http://crbug.com/39685) 253 // as the wildcard entry; see http://crbug.com/39685)
252 if (target_url.is_valid() || target.empty()) 254 if (target_url.is_valid() || target.empty())
253 (*one_origin_settings)[target_url] = IntToContentSetting(setting); 255 (*one_origin_settings)[target_url] = IntToContentSetting(setting);
254 } 256 }
255 } 257 }
OLDNEW
« no previous file with comments | « chrome/browser/first_run/first_run.cc ('k') | chrome/browser/instant/instant_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698