| OLD | NEW |
| 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/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/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 base::AutoLock auto_lock(lock_); | 234 base::AutoLock auto_lock(lock_); |
| 235 managed_default_content_settings_.settings[type] = IntToContentSetting( | 235 managed_default_content_settings_.settings[type] = IntToContentSetting( |
| 236 prefs->GetInteger(kPrefToManageType[type])); | 236 prefs->GetInteger(kPrefToManageType[type])); |
| 237 } | 237 } |
| 238 | 238 |
| 239 // static | 239 // static |
| 240 void PolicyDefaultProvider::RegisterUserPrefs(PrefService* prefs) { | 240 void PolicyDefaultProvider::RegisterUserPrefs(PrefService* prefs) { |
| 241 // Preferences for default content setting policies. A policy is not set of | 241 // Preferences for default content setting policies. A policy is not set of |
| 242 // the corresponding preferences below is set to CONTENT_SETTING_DEFAULT. | 242 // the corresponding preferences below is set to CONTENT_SETTING_DEFAULT. |
| 243 prefs->RegisterIntegerPref(prefs::kManagedDefaultCookiesSetting, | 243 prefs->RegisterIntegerPref(prefs::kManagedDefaultCookiesSetting, |
| 244 CONTENT_SETTING_DEFAULT); | 244 CONTENT_SETTING_DEFAULT, |
| 245 false /* don't sync pref */); |
| 245 prefs->RegisterIntegerPref(prefs::kManagedDefaultImagesSetting, | 246 prefs->RegisterIntegerPref(prefs::kManagedDefaultImagesSetting, |
| 246 CONTENT_SETTING_DEFAULT); | 247 CONTENT_SETTING_DEFAULT, |
| 248 false /* don't sync pref */); |
| 247 prefs->RegisterIntegerPref(prefs::kManagedDefaultJavaScriptSetting, | 249 prefs->RegisterIntegerPref(prefs::kManagedDefaultJavaScriptSetting, |
| 248 CONTENT_SETTING_DEFAULT); | 250 CONTENT_SETTING_DEFAULT, |
| 251 false /* don't sync pref */); |
| 249 prefs->RegisterIntegerPref(prefs::kManagedDefaultPluginsSetting, | 252 prefs->RegisterIntegerPref(prefs::kManagedDefaultPluginsSetting, |
| 250 CONTENT_SETTING_DEFAULT); | 253 CONTENT_SETTING_DEFAULT, |
| 254 false /* don't sync pref */); |
| 251 prefs->RegisterIntegerPref(prefs::kManagedDefaultPopupsSetting, | 255 prefs->RegisterIntegerPref(prefs::kManagedDefaultPopupsSetting, |
| 252 CONTENT_SETTING_DEFAULT); | 256 CONTENT_SETTING_DEFAULT, |
| 257 false /* don't sync pref */); |
| 253 } | 258 } |
| 254 | 259 |
| 255 // //////////////////////////////////////////////////////////////////////////// | 260 // //////////////////////////////////////////////////////////////////////////// |
| 256 // PolicyProvider | 261 // PolicyProvider |
| 257 | 262 |
| 258 // static | 263 // static |
| 259 void PolicyProvider::RegisterUserPrefs(PrefService* prefs) { | 264 void PolicyProvider::RegisterUserPrefs(PrefService* prefs) { |
| 260 prefs->RegisterListPref(prefs::kManagedCookiesAllowedForUrls); | 265 prefs->RegisterListPref(prefs::kManagedCookiesAllowedForUrls, |
| 261 prefs->RegisterListPref(prefs::kManagedCookiesBlockedForUrls); | 266 false /* don't sync pref */); |
| 262 prefs->RegisterListPref(prefs::kManagedCookiesSessionOnlyForUrls); | 267 prefs->RegisterListPref(prefs::kManagedCookiesBlockedForUrls, |
| 263 prefs->RegisterListPref(prefs::kManagedImagesAllowedForUrls); | 268 false /* don't sync pref */); |
| 264 prefs->RegisterListPref(prefs::kManagedImagesBlockedForUrls); | 269 prefs->RegisterListPref(prefs::kManagedCookiesSessionOnlyForUrls, |
| 265 prefs->RegisterListPref(prefs::kManagedJavaScriptAllowedForUrls); | 270 false /* don't sync pref */); |
| 266 prefs->RegisterListPref(prefs::kManagedJavaScriptBlockedForUrls); | 271 prefs->RegisterListPref(prefs::kManagedImagesAllowedForUrls, |
| 267 prefs->RegisterListPref(prefs::kManagedPluginsAllowedForUrls); | 272 false /* don't sync pref */); |
| 268 prefs->RegisterListPref(prefs::kManagedPluginsBlockedForUrls); | 273 prefs->RegisterListPref(prefs::kManagedImagesBlockedForUrls, |
| 269 prefs->RegisterListPref(prefs::kManagedPopupsAllowedForUrls); | 274 false /* don't sync pref */); |
| 270 prefs->RegisterListPref(prefs::kManagedPopupsBlockedForUrls); | 275 prefs->RegisterListPref(prefs::kManagedJavaScriptAllowedForUrls, |
| 276 false /* don't sync pref */); |
| 277 prefs->RegisterListPref(prefs::kManagedJavaScriptBlockedForUrls, |
| 278 false /* don't sync pref */); |
| 279 prefs->RegisterListPref(prefs::kManagedPluginsAllowedForUrls, |
| 280 false /* don't sync pref */); |
| 281 prefs->RegisterListPref(prefs::kManagedPluginsBlockedForUrls, |
| 282 false /* don't sync pref */); |
| 283 prefs->RegisterListPref(prefs::kManagedPopupsAllowedForUrls, |
| 284 false /* don't sync pref */); |
| 285 prefs->RegisterListPref(prefs::kManagedPopupsBlockedForUrls, |
| 286 false /* don't sync pref */); |
| 271 } | 287 } |
| 272 | 288 |
| 273 PolicyProvider::PolicyProvider(Profile* profile) | 289 PolicyProvider::PolicyProvider(Profile* profile) |
| 274 : BaseProvider(profile->IsOffTheRecord()), | 290 : BaseProvider(profile->IsOffTheRecord()), |
| 275 profile_(profile) { | 291 profile_(profile) { |
| 276 Init(); | 292 Init(); |
| 277 } | 293 } |
| 278 | 294 |
| 279 PolicyProvider::~PolicyProvider() { | 295 PolicyProvider::~PolicyProvider() { |
| 280 UnregisterObservers(); | 296 UnregisterObservers(); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 } | 487 } |
| 472 } else if (type == NotificationType::PROFILE_DESTROYED) { | 488 } else if (type == NotificationType::PROFILE_DESTROYED) { |
| 473 DCHECK_EQ(profile_, Source<Profile>(source).ptr()); | 489 DCHECK_EQ(profile_, Source<Profile>(source).ptr()); |
| 474 UnregisterObservers(); | 490 UnregisterObservers(); |
| 475 } else { | 491 } else { |
| 476 NOTREACHED() << "Unexpected notification"; | 492 NOTREACHED() << "Unexpected notification"; |
| 477 } | 493 } |
| 478 } | 494 } |
| 479 | 495 |
| 480 } // namespace content_settings | 496 } // namespace content_settings |
| OLD | NEW |