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

Side by Side Diff: chrome/browser/content_settings/content_settings_policy_provider.cc

Issue 14622003: components: Move PrefRegistrySyncable into user_prefs namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/content_settings_policy_provider.h" 5 #include "chrome/browser/content_settings/content_settings_policy_provider.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, 110 CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
111 CONTENT_SETTING_BLOCK 111 CONTENT_SETTING_BLOCK
112 } 112 }
113 }; 113 };
114 114
115 } // namespace 115 } // namespace
116 116
117 namespace content_settings { 117 namespace content_settings {
118 118
119 // static 119 // static
120 void PolicyProvider::RegisterUserPrefs(PrefRegistrySyncable* registry) { 120 void PolicyProvider::RegisterUserPrefs(
121 user_prefs::PrefRegistrySyncable* registry) {
Jói 2013/05/04 21:31:47 This is an example of a file where a using stateme
tfarina 2013/05/05 00:45:59 Agreed! ;)
121 registry->RegisterListPref(prefs::kManagedAutoSelectCertificateForUrls, 122 registry->RegisterListPref(prefs::kManagedAutoSelectCertificateForUrls,
122 PrefRegistrySyncable::UNSYNCABLE_PREF); 123 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
123 registry->RegisterListPref(prefs::kManagedCookiesAllowedForUrls, 124 registry->RegisterListPref(prefs::kManagedCookiesAllowedForUrls,
124 PrefRegistrySyncable::UNSYNCABLE_PREF); 125 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
125 registry->RegisterListPref(prefs::kManagedCookiesBlockedForUrls, 126 registry->RegisterListPref(prefs::kManagedCookiesBlockedForUrls,
126 PrefRegistrySyncable::UNSYNCABLE_PREF); 127 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
127 registry->RegisterListPref(prefs::kManagedCookiesSessionOnlyForUrls, 128 registry->RegisterListPref(prefs::kManagedCookiesSessionOnlyForUrls,
128 PrefRegistrySyncable::UNSYNCABLE_PREF); 129 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
129 registry->RegisterListPref(prefs::kManagedImagesAllowedForUrls, 130 registry->RegisterListPref(prefs::kManagedImagesAllowedForUrls,
130 PrefRegistrySyncable::UNSYNCABLE_PREF); 131 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
131 registry->RegisterListPref(prefs::kManagedImagesBlockedForUrls, 132 registry->RegisterListPref(prefs::kManagedImagesBlockedForUrls,
132 PrefRegistrySyncable::UNSYNCABLE_PREF); 133 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
133 registry->RegisterListPref(prefs::kManagedJavaScriptAllowedForUrls, 134 registry->RegisterListPref(prefs::kManagedJavaScriptAllowedForUrls,
134 PrefRegistrySyncable::UNSYNCABLE_PREF); 135 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
135 registry->RegisterListPref(prefs::kManagedJavaScriptBlockedForUrls, 136 registry->RegisterListPref(prefs::kManagedJavaScriptBlockedForUrls,
136 PrefRegistrySyncable::UNSYNCABLE_PREF); 137 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
137 registry->RegisterListPref(prefs::kManagedPluginsAllowedForUrls, 138 registry->RegisterListPref(prefs::kManagedPluginsAllowedForUrls,
138 PrefRegistrySyncable::UNSYNCABLE_PREF); 139 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
139 registry->RegisterListPref(prefs::kManagedPluginsBlockedForUrls, 140 registry->RegisterListPref(prefs::kManagedPluginsBlockedForUrls,
140 PrefRegistrySyncable::UNSYNCABLE_PREF); 141 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
141 registry->RegisterListPref(prefs::kManagedPopupsAllowedForUrls, 142 registry->RegisterListPref(prefs::kManagedPopupsAllowedForUrls,
142 PrefRegistrySyncable::UNSYNCABLE_PREF); 143 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
143 registry->RegisterListPref(prefs::kManagedPopupsBlockedForUrls, 144 registry->RegisterListPref(prefs::kManagedPopupsBlockedForUrls,
144 PrefRegistrySyncable::UNSYNCABLE_PREF); 145 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
145 registry->RegisterListPref(prefs::kManagedNotificationsAllowedForUrls, 146 registry->RegisterListPref(prefs::kManagedNotificationsAllowedForUrls,
146 PrefRegistrySyncable::UNSYNCABLE_PREF); 147 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
147 registry->RegisterListPref(prefs::kManagedNotificationsBlockedForUrls, 148 registry->RegisterListPref(prefs::kManagedNotificationsBlockedForUrls,
148 PrefRegistrySyncable::UNSYNCABLE_PREF); 149 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
149 // Preferences for default content setting policies. If a policy is not set of 150 // Preferences for default content setting policies. If a policy is not set of
150 // the corresponding preferences below is set to CONTENT_SETTING_DEFAULT. 151 // the corresponding preferences below is set to CONTENT_SETTING_DEFAULT.
151 registry->RegisterIntegerPref(prefs::kManagedDefaultCookiesSetting, 152 registry->RegisterIntegerPref(
152 CONTENT_SETTING_DEFAULT, 153 prefs::kManagedDefaultCookiesSetting,
153 PrefRegistrySyncable::UNSYNCABLE_PREF); 154 CONTENT_SETTING_DEFAULT,
154 registry->RegisterIntegerPref(prefs::kManagedDefaultImagesSetting, 155 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
155 CONTENT_SETTING_DEFAULT, 156 registry->RegisterIntegerPref(
156 PrefRegistrySyncable::UNSYNCABLE_PREF); 157 prefs::kManagedDefaultImagesSetting,
157 registry->RegisterIntegerPref(prefs::kManagedDefaultJavaScriptSetting, 158 CONTENT_SETTING_DEFAULT,
158 CONTENT_SETTING_DEFAULT, 159 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
159 PrefRegistrySyncable::UNSYNCABLE_PREF); 160 registry->RegisterIntegerPref(
160 registry->RegisterIntegerPref(prefs::kManagedDefaultPluginsSetting, 161 prefs::kManagedDefaultJavaScriptSetting,
161 CONTENT_SETTING_DEFAULT, 162 CONTENT_SETTING_DEFAULT,
162 PrefRegistrySyncable::UNSYNCABLE_PREF); 163 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
163 registry->RegisterIntegerPref(prefs::kManagedDefaultPopupsSetting, 164 registry->RegisterIntegerPref(
164 CONTENT_SETTING_DEFAULT, 165 prefs::kManagedDefaultPluginsSetting,
165 PrefRegistrySyncable::UNSYNCABLE_PREF); 166 CONTENT_SETTING_DEFAULT,
166 registry->RegisterIntegerPref(prefs::kManagedDefaultGeolocationSetting, 167 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
167 CONTENT_SETTING_DEFAULT, 168 registry->RegisterIntegerPref(
168 PrefRegistrySyncable::UNSYNCABLE_PREF); 169 prefs::kManagedDefaultPopupsSetting,
169 registry->RegisterIntegerPref(prefs::kManagedDefaultNotificationsSetting, 170 CONTENT_SETTING_DEFAULT,
170 CONTENT_SETTING_DEFAULT, 171 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
171 PrefRegistrySyncable::UNSYNCABLE_PREF); 172 registry->RegisterIntegerPref(
172 registry->RegisterIntegerPref(prefs::kManagedDefaultMediaStreamSetting, 173 prefs::kManagedDefaultGeolocationSetting,
173 CONTENT_SETTING_DEFAULT, 174 CONTENT_SETTING_DEFAULT,
174 PrefRegistrySyncable::UNSYNCABLE_PREF); 175 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
176 registry->RegisterIntegerPref(
177 prefs::kManagedDefaultNotificationsSetting,
178 CONTENT_SETTING_DEFAULT,
179 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
180 registry->RegisterIntegerPref(
181 prefs::kManagedDefaultMediaStreamSetting,
182 CONTENT_SETTING_DEFAULT,
183 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
175 } 184 }
176 185
177 PolicyProvider::PolicyProvider(PrefService* prefs) : prefs_(prefs) { 186 PolicyProvider::PolicyProvider(PrefService* prefs) : prefs_(prefs) {
178 ReadManagedDefaultSettings(); 187 ReadManagedDefaultSettings();
179 ReadManagedContentSettings(false); 188 ReadManagedContentSettings(false);
180 189
181 pref_change_registrar_.Init(prefs_); 190 pref_change_registrar_.Init(prefs_);
182 PrefChangeRegistrar::NamedChangeCallback callback = 191 PrefChangeRegistrar::NamedChangeCallback callback =
183 base::Bind(&PolicyProvider::OnPreferenceChanged, base::Unretained(this)); 192 base::Bind(&PolicyProvider::OnPreferenceChanged, base::Unretained(this));
184 pref_change_registrar_.Add( 193 pref_change_registrar_.Add(
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 ReadManagedDefaultSettings(); 482 ReadManagedDefaultSettings();
474 } 483 }
475 484
476 NotifyObservers(ContentSettingsPattern(), 485 NotifyObservers(ContentSettingsPattern(),
477 ContentSettingsPattern(), 486 ContentSettingsPattern(),
478 CONTENT_SETTINGS_TYPE_DEFAULT, 487 CONTENT_SETTINGS_TYPE_DEFAULT,
479 std::string()); 488 std::string());
480 } 489 }
481 490
482 } // namespace content_settings 491 } // namespace content_settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698