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 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_POLICY_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_POLICY_PROVIDER_H_ |
6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_POLICY_PROVIDER_H_ | 6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_POLICY_PROVIDER_H_ |
7 | 7 |
8 // A content settings provider that takes its settings out of policies. | 8 // A content settings provider that takes its settings out of policies. |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/prefs/pref_change_registrar.h" | 13 #include "base/prefs/pref_change_registrar.h" |
14 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
15 #include "components/content_settings/core/browser/content_settings_observable_p
rovider.h" | 15 #include "components/content_settings/core/browser/content_settings_observable_p
rovider.h" |
16 #include "components/content_settings/core/browser/content_settings_origin_ident
ifier_value_map.h" | 16 #include "components/content_settings/core/browser/content_settings_origin_ident
ifier_value_map.h" |
17 | 17 |
18 class PrefService; | 18 class PrefService; |
19 | 19 |
20 namespace user_prefs { | 20 namespace user_prefs { |
21 class PrefRegistrySyncable; | 21 class PrefRegistrySyncable; |
22 } | 22 } |
23 | 23 |
24 namespace content_settings { | 24 namespace content_settings { |
25 | 25 |
26 // PolicyProvider that provides managed content-settings. | 26 // PolicyProvider that provides managed content-settings. |
27 class PolicyProvider : public ObservableProvider { | 27 class PolicyProvider : public ObservableProvider { |
28 public: | 28 public: |
29 explicit PolicyProvider(PrefService* prefs); | 29 explicit PolicyProvider(PrefService* prefs); |
30 virtual ~PolicyProvider(); | 30 ~PolicyProvider() override; |
31 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 31 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
32 | 32 |
33 // ProviderInterface implementations. | 33 // ProviderInterface implementations. |
34 virtual RuleIterator* GetRuleIterator( | 34 RuleIterator* GetRuleIterator(ContentSettingsType content_type, |
35 ContentSettingsType content_type, | 35 const ResourceIdentifier& resource_identifier, |
36 const ResourceIdentifier& resource_identifier, | 36 bool incognito) const override; |
37 bool incognito) const override; | |
38 | 37 |
39 virtual bool SetWebsiteSetting( | 38 bool SetWebsiteSetting(const ContentSettingsPattern& primary_pattern, |
40 const ContentSettingsPattern& primary_pattern, | 39 const ContentSettingsPattern& secondary_pattern, |
41 const ContentSettingsPattern& secondary_pattern, | 40 ContentSettingsType content_type, |
42 ContentSettingsType content_type, | 41 const ResourceIdentifier& resource_identifier, |
43 const ResourceIdentifier& resource_identifier, | 42 base::Value* value) override; |
44 base::Value* value) override; | |
45 | 43 |
46 virtual void ClearAllContentSettingsRules( | 44 void ClearAllContentSettingsRules(ContentSettingsType content_type) override; |
47 ContentSettingsType content_type) override; | |
48 | 45 |
49 virtual void ShutdownOnUIThread() override; | 46 void ShutdownOnUIThread() override; |
50 | 47 |
51 private: | 48 private: |
52 // Reads the policy managed default settings. | 49 // Reads the policy managed default settings. |
53 void ReadManagedDefaultSettings(); | 50 void ReadManagedDefaultSettings(); |
54 | 51 |
55 // Callback for preference changes. | 52 // Callback for preference changes. |
56 void OnPreferenceChanged(const std::string& pref_name); | 53 void OnPreferenceChanged(const std::string& pref_name); |
57 | 54 |
58 // Reads the policy controlled default settings for a specific content type. | 55 // Reads the policy controlled default settings for a specific content type. |
59 void UpdateManagedDefaultSetting(ContentSettingsType content_type); | 56 void UpdateManagedDefaultSetting(ContentSettingsType content_type); |
(...skipping 16 matching lines...) Expand all Loading... |
76 // Used around accesses to the |value_map_| object to guarantee | 73 // Used around accesses to the |value_map_| object to guarantee |
77 // thread safety. | 74 // thread safety. |
78 mutable base::Lock lock_; | 75 mutable base::Lock lock_; |
79 | 76 |
80 DISALLOW_COPY_AND_ASSIGN(PolicyProvider); | 77 DISALLOW_COPY_AND_ASSIGN(PolicyProvider); |
81 }; | 78 }; |
82 | 79 |
83 } // namespace content_settings | 80 } // namespace content_settings |
84 | 81 |
85 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_POLICY_PROVIDER_H_ | 82 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_POLICY_PROVIDER_H_ |
OLD | NEW |