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

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

Issue 6142009: Upating the app, ceee, chrome, ipc, media, and net directories to use the correct lock.h file. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Unified patch updating all references to the new base/synchronization/lock.h Created 9 years, 11 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) 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 notification_registrar_.Add(this, NotificationType::PROFILE_DESTROYED, 64 notification_registrar_.Add(this, NotificationType::PROFILE_DESTROYED,
65 Source<Profile>(profile_)); 65 Source<Profile>(profile_));
66 } 66 }
67 67
68 PolicyContentSettingsProvider::~PolicyContentSettingsProvider() { 68 PolicyContentSettingsProvider::~PolicyContentSettingsProvider() {
69 UnregisterObservers(); 69 UnregisterObservers();
70 } 70 }
71 71
72 bool PolicyContentSettingsProvider::CanProvideDefaultSetting( 72 bool PolicyContentSettingsProvider::CanProvideDefaultSetting(
73 ContentSettingsType content_type) const { 73 ContentSettingsType content_type) const {
74 AutoLock lock(lock_); 74 base::AutoLock lock(lock_);
75 if (managed_default_content_settings_.settings[content_type] != 75 if (managed_default_content_settings_.settings[content_type] !=
76 CONTENT_SETTING_DEFAULT) { 76 CONTENT_SETTING_DEFAULT) {
77 return true; 77 return true;
78 } else { 78 } else {
79 return false; 79 return false;
80 } 80 }
81 } 81 }
82 82
83 ContentSetting PolicyContentSettingsProvider::ProvideDefaultSetting( 83 ContentSetting PolicyContentSettingsProvider::ProvideDefaultSetting(
84 ContentSettingsType content_type) const { 84 ContentSettingsType content_type) const {
85 AutoLock auto_lock(lock_); 85 base::AutoLock auto_lock(lock_);
86 return managed_default_content_settings_.settings[content_type]; 86 return managed_default_content_settings_.settings[content_type];
87 } 87 }
88 88
89 void PolicyContentSettingsProvider::UpdateDefaultSetting( 89 void PolicyContentSettingsProvider::UpdateDefaultSetting(
90 ContentSettingsType content_type, 90 ContentSettingsType content_type,
91 ContentSetting setting) { 91 ContentSetting setting) {
92 } 92 }
93 93
94 bool PolicyContentSettingsProvider::DefaultSettingIsManaged( 94 bool PolicyContentSettingsProvider::DefaultSettingIsManaged(
95 ContentSettingsType content_type) const { 95 ContentSettingsType content_type) const {
96 AutoLock lock(lock_); 96 base::AutoLock lock(lock_);
97 if (managed_default_content_settings_.settings[content_type] != 97 if (managed_default_content_settings_.settings[content_type] !=
98 CONTENT_SETTING_DEFAULT) { 98 CONTENT_SETTING_DEFAULT) {
99 return true; 99 return true;
100 } else { 100 } else {
101 return false; 101 return false;
102 } 102 }
103 } 103 }
104 104
105 void PolicyContentSettingsProvider::ResetToDefaults() { 105 void PolicyContentSettingsProvider::ResetToDefaults() {
106 } 106 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 ContentSettingsType type) { 176 ContentSettingsType type) {
177 // If a pref to manage a default-content-setting was not set (NOTICE: 177 // If a pref to manage a default-content-setting was not set (NOTICE:
178 // "HasPrefPath" returns false if no value was set for a registered pref) then 178 // "HasPrefPath" returns false if no value was set for a registered pref) then
179 // the default value of the preference is used. The default value of a 179 // the default value of the preference is used. The default value of a
180 // preference to manage a default-content-settings is 180 // preference to manage a default-content-settings is
181 // CONTENT_SETTING_DEFAULT. This indicates that no managed value is set. If a 181 // CONTENT_SETTING_DEFAULT. This indicates that no managed value is set. If a
182 // pref was set, than it MUST be managed. 182 // pref was set, than it MUST be managed.
183 PrefService* prefs = profile_->GetPrefs(); 183 PrefService* prefs = profile_->GetPrefs();
184 DCHECK(!prefs->HasPrefPath(kPrefToManageType[type]) || 184 DCHECK(!prefs->HasPrefPath(kPrefToManageType[type]) ||
185 prefs->IsManagedPreference(kPrefToManageType[type])); 185 prefs->IsManagedPreference(kPrefToManageType[type]));
186 AutoLock auto_lock(lock_); 186 base::AutoLock auto_lock(lock_);
187 managed_default_content_settings_.settings[type] = IntToContentSetting( 187 managed_default_content_settings_.settings[type] = IntToContentSetting(
188 prefs->GetInteger(kPrefToManageType[type])); 188 prefs->GetInteger(kPrefToManageType[type]));
189 } 189 }
190 190
191 // static 191 // static
192 void PolicyContentSettingsProvider::RegisterUserPrefs(PrefService* prefs) { 192 void PolicyContentSettingsProvider::RegisterUserPrefs(PrefService* prefs) {
193 // Preferences for default content setting policies. A policy is not set of 193 // Preferences for default content setting policies. A policy is not set of
194 // the corresponding preferences below is set to CONTENT_SETTING_DEFAULT. 194 // the corresponding preferences below is set to CONTENT_SETTING_DEFAULT.
195 prefs->RegisterIntegerPref(prefs::kManagedDefaultCookiesSetting, 195 prefs->RegisterIntegerPref(prefs::kManagedDefaultCookiesSetting,
196 CONTENT_SETTING_DEFAULT); 196 CONTENT_SETTING_DEFAULT);
197 prefs->RegisterIntegerPref(prefs::kManagedDefaultImagesSetting, 197 prefs->RegisterIntegerPref(prefs::kManagedDefaultImagesSetting,
198 CONTENT_SETTING_DEFAULT); 198 CONTENT_SETTING_DEFAULT);
199 prefs->RegisterIntegerPref(prefs::kManagedDefaultJavaScriptSetting, 199 prefs->RegisterIntegerPref(prefs::kManagedDefaultJavaScriptSetting,
200 CONTENT_SETTING_DEFAULT); 200 CONTENT_SETTING_DEFAULT);
201 prefs->RegisterIntegerPref(prefs::kManagedDefaultPluginsSetting, 201 prefs->RegisterIntegerPref(prefs::kManagedDefaultPluginsSetting,
202 CONTENT_SETTING_DEFAULT); 202 CONTENT_SETTING_DEFAULT);
203 prefs->RegisterIntegerPref(prefs::kManagedDefaultPopupsSetting, 203 prefs->RegisterIntegerPref(prefs::kManagedDefaultPopupsSetting,
204 CONTENT_SETTING_DEFAULT); 204 CONTENT_SETTING_DEFAULT);
205 } 205 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698