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

Side by Side Diff: chrome/browser/content_settings/host_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
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 #include "chrome/browser/content_settings/host_content_settings_map.h" 5 #include "chrome/browser/content_settings/host_content_settings_map.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/content_settings/content_settings_details.h" 10 #include "chrome/browser/content_settings/content_settings_details.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 pref_change_registrar_.Init(prefs); 107 pref_change_registrar_.Init(prefs);
108 pref_change_registrar_.Add(prefs::kBlockThirdPartyCookies, this); 108 pref_change_registrar_.Add(prefs::kBlockThirdPartyCookies, this);
109 pref_change_registrar_.Add(prefs::kBlockNonsandboxedPlugins, this); 109 pref_change_registrar_.Add(prefs::kBlockNonsandboxedPlugins, this);
110 notification_registrar_.Add(this, NotificationType::PROFILE_DESTROYED, 110 notification_registrar_.Add(this, NotificationType::PROFILE_DESTROYED,
111 Source<Profile>(profile_)); 111 Source<Profile>(profile_));
112 } 112 }
113 113
114 // static 114 // static
115 void HostContentSettingsMap::RegisterUserPrefs(PrefService* prefs) { 115 void HostContentSettingsMap::RegisterUserPrefs(PrefService* prefs) {
116 prefs->RegisterBooleanPref(prefs::kBlockThirdPartyCookies, false); 116 prefs->RegisterBooleanPref(prefs::kBlockThirdPartyCookies,
117 prefs->RegisterBooleanPref(prefs::kBlockNonsandboxedPlugins, false); 117 false,
118 prefs->RegisterIntegerPref(prefs::kContentSettingsWindowLastTabIndex, 0); 118 PrefService::SYNCABLE_PREF);
119 prefs->RegisterBooleanPref(prefs::kBlockNonsandboxedPlugins,
120 false,
121 PrefService::UNSYNCABLE_PREF);
122 prefs->RegisterIntegerPref(prefs::kContentSettingsWindowLastTabIndex,
123 0,
124 PrefService::UNSYNCABLE_PREF);
119 125
120 // Obsolete prefs, for migration: 126 // Obsolete prefs, for migration:
121 prefs->RegisterIntegerPref(prefs::kCookieBehavior, 127 prefs->RegisterIntegerPref(prefs::kCookieBehavior,
122 net::StaticCookiePolicy::ALLOW_ALL_COOKIES); 128 net::StaticCookiePolicy::ALLOW_ALL_COOKIES,
129 PrefService::UNSYNCABLE_PREF);
123 130
124 // Register the prefs for the content settings providers. 131 // Register the prefs for the content settings providers.
125 content_settings::PrefDefaultProvider::RegisterUserPrefs(prefs); 132 content_settings::PrefDefaultProvider::RegisterUserPrefs(prefs);
126 content_settings::PolicyDefaultProvider::RegisterUserPrefs(prefs); 133 content_settings::PolicyDefaultProvider::RegisterUserPrefs(prefs);
127 content_settings::PrefProvider::RegisterUserPrefs(prefs); 134 content_settings::PrefProvider::RegisterUserPrefs(prefs);
128 content_settings::PolicyProvider::RegisterUserPrefs(prefs); 135 content_settings::PolicyProvider::RegisterUserPrefs(prefs);
129 } 136 }
130 137
131 ContentSetting HostContentSettingsMap::GetDefaultContentSetting( 138 ContentSetting HostContentSettingsMap::GetDefaultContentSetting(
132 ContentSettingsType content_type) const { 139 ContentSettingsType content_type) const {
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_COOKIES, 477 SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_COOKIES,
471 (cookie_behavior == net::StaticCookiePolicy::BLOCK_ALL_COOKIES) ? 478 (cookie_behavior == net::StaticCookiePolicy::BLOCK_ALL_COOKIES) ?
472 CONTENT_SETTING_BLOCK : CONTENT_SETTING_ALLOW); 479 CONTENT_SETTING_BLOCK : CONTENT_SETTING_ALLOW);
473 } 480 }
474 if (!prefs->HasPrefPath(prefs::kBlockThirdPartyCookies)) { 481 if (!prefs->HasPrefPath(prefs::kBlockThirdPartyCookies)) {
475 SetBlockThirdPartyCookies(cookie_behavior == 482 SetBlockThirdPartyCookies(cookie_behavior ==
476 net::StaticCookiePolicy::BLOCK_SETTING_THIRD_PARTY_COOKIES); 483 net::StaticCookiePolicy::BLOCK_SETTING_THIRD_PARTY_COOKIES);
477 } 484 }
478 } 485 }
479 } 486 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698