OLD | NEW |
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 Loading... |
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(PrefService* prefs) { | 120 void PolicyProvider::RegisterUserPrefs(PrefServiceSyncable* prefs) { |
121 prefs->RegisterListPref(prefs::kManagedAutoSelectCertificateForUrls, | 121 prefs->RegisterListPref(prefs::kManagedAutoSelectCertificateForUrls, |
122 PrefService::UNSYNCABLE_PREF); | 122 PrefServiceSyncable::UNSYNCABLE_PREF); |
123 prefs->RegisterListPref(prefs::kManagedCookiesAllowedForUrls, | 123 prefs->RegisterListPref(prefs::kManagedCookiesAllowedForUrls, |
124 PrefService::UNSYNCABLE_PREF); | 124 PrefServiceSyncable::UNSYNCABLE_PREF); |
125 prefs->RegisterListPref(prefs::kManagedCookiesBlockedForUrls, | 125 prefs->RegisterListPref(prefs::kManagedCookiesBlockedForUrls, |
126 PrefService::UNSYNCABLE_PREF); | 126 PrefServiceSyncable::UNSYNCABLE_PREF); |
127 prefs->RegisterListPref(prefs::kManagedCookiesSessionOnlyForUrls, | 127 prefs->RegisterListPref(prefs::kManagedCookiesSessionOnlyForUrls, |
128 PrefService::UNSYNCABLE_PREF); | 128 PrefServiceSyncable::UNSYNCABLE_PREF); |
129 prefs->RegisterListPref(prefs::kManagedImagesAllowedForUrls, | 129 prefs->RegisterListPref(prefs::kManagedImagesAllowedForUrls, |
130 PrefService::UNSYNCABLE_PREF); | 130 PrefServiceSyncable::UNSYNCABLE_PREF); |
131 prefs->RegisterListPref(prefs::kManagedImagesBlockedForUrls, | 131 prefs->RegisterListPref(prefs::kManagedImagesBlockedForUrls, |
132 PrefService::UNSYNCABLE_PREF); | 132 PrefServiceSyncable::UNSYNCABLE_PREF); |
133 prefs->RegisterListPref(prefs::kManagedJavaScriptAllowedForUrls, | 133 prefs->RegisterListPref(prefs::kManagedJavaScriptAllowedForUrls, |
134 PrefService::UNSYNCABLE_PREF); | 134 PrefServiceSyncable::UNSYNCABLE_PREF); |
135 prefs->RegisterListPref(prefs::kManagedJavaScriptBlockedForUrls, | 135 prefs->RegisterListPref(prefs::kManagedJavaScriptBlockedForUrls, |
136 PrefService::UNSYNCABLE_PREF); | 136 PrefServiceSyncable::UNSYNCABLE_PREF); |
137 prefs->RegisterListPref(prefs::kManagedPluginsAllowedForUrls, | 137 prefs->RegisterListPref(prefs::kManagedPluginsAllowedForUrls, |
138 PrefService::UNSYNCABLE_PREF); | 138 PrefServiceSyncable::UNSYNCABLE_PREF); |
139 prefs->RegisterListPref(prefs::kManagedPluginsBlockedForUrls, | 139 prefs->RegisterListPref(prefs::kManagedPluginsBlockedForUrls, |
140 PrefService::UNSYNCABLE_PREF); | 140 PrefServiceSyncable::UNSYNCABLE_PREF); |
141 prefs->RegisterListPref(prefs::kManagedPopupsAllowedForUrls, | 141 prefs->RegisterListPref(prefs::kManagedPopupsAllowedForUrls, |
142 PrefService::UNSYNCABLE_PREF); | 142 PrefServiceSyncable::UNSYNCABLE_PREF); |
143 prefs->RegisterListPref(prefs::kManagedPopupsBlockedForUrls, | 143 prefs->RegisterListPref(prefs::kManagedPopupsBlockedForUrls, |
144 PrefService::UNSYNCABLE_PREF); | 144 PrefServiceSyncable::UNSYNCABLE_PREF); |
145 prefs->RegisterListPref(prefs::kManagedNotificationsAllowedForUrls, | 145 prefs->RegisterListPref(prefs::kManagedNotificationsAllowedForUrls, |
146 PrefService::UNSYNCABLE_PREF); | 146 PrefServiceSyncable::UNSYNCABLE_PREF); |
147 prefs->RegisterListPref(prefs::kManagedNotificationsBlockedForUrls, | 147 prefs->RegisterListPref(prefs::kManagedNotificationsBlockedForUrls, |
148 PrefService::UNSYNCABLE_PREF); | 148 PrefServiceSyncable::UNSYNCABLE_PREF); |
149 // Preferences for default content setting policies. If a policy is not set of | 149 // Preferences for default content setting policies. If a policy is not set of |
150 // the corresponding preferences below is set to CONTENT_SETTING_DEFAULT. | 150 // the corresponding preferences below is set to CONTENT_SETTING_DEFAULT. |
151 prefs->RegisterIntegerPref(prefs::kManagedDefaultCookiesSetting, | 151 prefs->RegisterIntegerPref(prefs::kManagedDefaultCookiesSetting, |
152 CONTENT_SETTING_DEFAULT, | 152 CONTENT_SETTING_DEFAULT, |
153 PrefService::UNSYNCABLE_PREF); | 153 PrefServiceSyncable::UNSYNCABLE_PREF); |
154 prefs->RegisterIntegerPref(prefs::kManagedDefaultImagesSetting, | 154 prefs->RegisterIntegerPref(prefs::kManagedDefaultImagesSetting, |
155 CONTENT_SETTING_DEFAULT, | 155 CONTENT_SETTING_DEFAULT, |
156 PrefService::UNSYNCABLE_PREF); | 156 PrefServiceSyncable::UNSYNCABLE_PREF); |
157 prefs->RegisterIntegerPref(prefs::kManagedDefaultJavaScriptSetting, | 157 prefs->RegisterIntegerPref(prefs::kManagedDefaultJavaScriptSetting, |
158 CONTENT_SETTING_DEFAULT, | 158 CONTENT_SETTING_DEFAULT, |
159 PrefService::UNSYNCABLE_PREF); | 159 PrefServiceSyncable::UNSYNCABLE_PREF); |
160 prefs->RegisterIntegerPref(prefs::kManagedDefaultPluginsSetting, | 160 prefs->RegisterIntegerPref(prefs::kManagedDefaultPluginsSetting, |
161 CONTENT_SETTING_DEFAULT, | 161 CONTENT_SETTING_DEFAULT, |
162 PrefService::UNSYNCABLE_PREF); | 162 PrefServiceSyncable::UNSYNCABLE_PREF); |
163 prefs->RegisterIntegerPref(prefs::kManagedDefaultPopupsSetting, | 163 prefs->RegisterIntegerPref(prefs::kManagedDefaultPopupsSetting, |
164 CONTENT_SETTING_DEFAULT, | 164 CONTENT_SETTING_DEFAULT, |
165 PrefService::UNSYNCABLE_PREF); | 165 PrefServiceSyncable::UNSYNCABLE_PREF); |
166 prefs->RegisterIntegerPref(prefs::kManagedDefaultGeolocationSetting, | 166 prefs->RegisterIntegerPref(prefs::kManagedDefaultGeolocationSetting, |
167 CONTENT_SETTING_DEFAULT, | 167 CONTENT_SETTING_DEFAULT, |
168 PrefService::UNSYNCABLE_PREF); | 168 PrefServiceSyncable::UNSYNCABLE_PREF); |
169 prefs->RegisterIntegerPref(prefs::kManagedDefaultNotificationsSetting, | 169 prefs->RegisterIntegerPref(prefs::kManagedDefaultNotificationsSetting, |
170 CONTENT_SETTING_DEFAULT, | 170 CONTENT_SETTING_DEFAULT, |
171 PrefService::UNSYNCABLE_PREF); | 171 PrefServiceSyncable::UNSYNCABLE_PREF); |
172 prefs->RegisterIntegerPref(prefs::kManagedDefaultMediaStreamSetting, | 172 prefs->RegisterIntegerPref(prefs::kManagedDefaultMediaStreamSetting, |
173 CONTENT_SETTING_DEFAULT, | 173 CONTENT_SETTING_DEFAULT, |
174 PrefService::UNSYNCABLE_PREF); | 174 PrefServiceSyncable::UNSYNCABLE_PREF); |
175 } | 175 } |
176 | 176 |
177 PolicyProvider::PolicyProvider(PrefService* prefs) : prefs_(prefs) { | 177 PolicyProvider::PolicyProvider(PrefService* prefs) : prefs_(prefs) { |
178 ReadManagedDefaultSettings(); | 178 ReadManagedDefaultSettings(); |
179 ReadManagedContentSettings(false); | 179 ReadManagedContentSettings(false); |
180 | 180 |
181 pref_change_registrar_.Init(prefs_); | 181 pref_change_registrar_.Init(prefs_); |
182 PrefChangeRegistrar::NamedChangeCallback callback = | 182 PrefChangeRegistrar::NamedChangeCallback callback = |
183 base::Bind(&PolicyProvider::OnPreferenceChanged, base::Unretained(this)); | 183 base::Bind(&PolicyProvider::OnPreferenceChanged, base::Unretained(this)); |
184 pref_change_registrar_.Add( | 184 pref_change_registrar_.Add( |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 ReadManagedDefaultSettings(); | 473 ReadManagedDefaultSettings(); |
474 } | 474 } |
475 | 475 |
476 NotifyObservers(ContentSettingsPattern(), | 476 NotifyObservers(ContentSettingsPattern(), |
477 ContentSettingsPattern(), | 477 ContentSettingsPattern(), |
478 CONTENT_SETTINGS_TYPE_DEFAULT, | 478 CONTENT_SETTINGS_TYPE_DEFAULT, |
479 std::string()); | 479 std::string()); |
480 } | 480 } |
481 | 481 |
482 } // namespace content_settings | 482 } // namespace content_settings |
OLD | NEW |