| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/policy_content_settings_provider.h" | 5 #include "chrome/browser/content_settings/policy_content_settings_provider.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "chrome/browser/browser_thread.h" | 10 #include "chrome/browser/browser_thread.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 } | 161 } |
| 162 UpdateManagedDefaultSetting(ContentSettingsType(type)); | 162 UpdateManagedDefaultSetting(ContentSettingsType(type)); |
| 163 } | 163 } |
| 164 } | 164 } |
| 165 | 165 |
| 166 void PolicyDefaultProvider::UpdateManagedDefaultSetting( | 166 void PolicyDefaultProvider::UpdateManagedDefaultSetting( |
| 167 ContentSettingsType type) { | 167 ContentSettingsType type) { |
| 168 // If a pref to manage a default-content-setting was not set (NOTICE: | 168 // If a pref to manage a default-content-setting was not set (NOTICE: |
| 169 // "HasPrefPath" returns false if no value was set for a registered pref) then | 169 // "HasPrefPath" returns false if no value was set for a registered pref) then |
| 170 // the default value of the preference is used. The default value of a | 170 // the default value of the preference is used. The default value of a |
| 171 // preference to manage a default-content-settings is | 171 // preference to manage a default-content-settings is CONTENT_SETTING_DEFAULT. |
| 172 // CONTENT_SETTING_DEFAULT. This indicates that no managed value is set. If a | 172 // This indicates that no managed value is set. If a pref was set, than it |
| 173 // pref was set, than it MUST be managed. | 173 // MUST be managed. |
| 174 PrefService* prefs = profile_->GetPrefs(); | 174 PrefService* prefs = profile_->GetPrefs(); |
| 175 DCHECK(!prefs->HasPrefPath(kPrefToManageType[type]) || | 175 DCHECK(!prefs->HasPrefPath(kPrefToManageType[type]) || |
| 176 prefs->IsManagedPreference(kPrefToManageType[type])); | 176 prefs->IsManagedPreference(kPrefToManageType[type])); |
| 177 base::AutoLock auto_lock(lock_); | 177 base::AutoLock auto_lock(lock_); |
| 178 managed_default_content_settings_.settings[type] = IntToContentSetting( | 178 managed_default_content_settings_.settings[type] = IntToContentSetting( |
| 179 prefs->GetInteger(kPrefToManageType[type])); | 179 prefs->GetInteger(kPrefToManageType[type])); |
| 180 } | 180 } |
| 181 | 181 |
| 182 // static | 182 // static |
| 183 void PolicyDefaultProvider::RegisterUserPrefs(PrefService* prefs) { | 183 void PolicyDefaultProvider::RegisterUserPrefs(PrefService* prefs) { |
| 184 // Preferences for default content setting policies. A policy is not set of | 184 // Preferences for default content setting policies. A policy is not set of |
| 185 // the corresponding preferences below is set to CONTENT_SETTING_DEFAULT. | 185 // the corresponding preferences below is set to CONTENT_SETTING_DEFAULT. |
| 186 prefs->RegisterIntegerPref(prefs::kManagedDefaultCookiesSetting, | 186 prefs->RegisterIntegerPref(prefs::kManagedDefaultCookiesSetting, |
| 187 CONTENT_SETTING_DEFAULT); | 187 CONTENT_SETTING_DEFAULT); |
| 188 prefs->RegisterIntegerPref(prefs::kManagedDefaultImagesSetting, | 188 prefs->RegisterIntegerPref(prefs::kManagedDefaultImagesSetting, |
| 189 CONTENT_SETTING_DEFAULT); | 189 CONTENT_SETTING_DEFAULT); |
| 190 prefs->RegisterIntegerPref(prefs::kManagedDefaultJavaScriptSetting, | 190 prefs->RegisterIntegerPref(prefs::kManagedDefaultJavaScriptSetting, |
| 191 CONTENT_SETTING_DEFAULT); | 191 CONTENT_SETTING_DEFAULT); |
| 192 prefs->RegisterIntegerPref(prefs::kManagedDefaultPluginsSetting, | 192 prefs->RegisterIntegerPref(prefs::kManagedDefaultPluginsSetting, |
| 193 CONTENT_SETTING_DEFAULT); | 193 CONTENT_SETTING_DEFAULT); |
| 194 prefs->RegisterIntegerPref(prefs::kManagedDefaultPopupsSetting, | 194 prefs->RegisterIntegerPref(prefs::kManagedDefaultPopupsSetting, |
| 195 CONTENT_SETTING_DEFAULT); | 195 CONTENT_SETTING_DEFAULT); |
| 196 } | 196 } |
| 197 | 197 |
| 198 } // namespace content_settings | 198 } // namespace content_settings |
| OLD | NEW |