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

Side by Side Diff: chrome/browser/content_settings/content_settings_policy_provider.h

Issue 670953006: Componentize HostContentSettingsMap and content settings providers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: win64 suppress warnings Created 6 years, 1 month 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_POLICY_PROVIDER_H_
6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_POLICY_PROVIDER_H_
7
8 // A content settings provider that takes its settings out of policies.
9
10 #include <vector>
11
12 #include "base/basictypes.h"
13 #include "base/prefs/pref_change_registrar.h"
14 #include "base/synchronization/lock.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"
17
18 class PrefService;
19
20 namespace user_prefs {
21 class PrefRegistrySyncable;
22 }
23
24 namespace content_settings {
25
26 // PolicyProvider that provides managed content-settings.
27 class PolicyProvider : public ObservableProvider {
28 public:
29 explicit PolicyProvider(PrefService* prefs);
30 ~PolicyProvider() override;
31 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
32
33 // ProviderInterface implementations.
34 RuleIterator* GetRuleIterator(ContentSettingsType content_type,
35 const ResourceIdentifier& resource_identifier,
36 bool incognito) const override;
37
38 bool SetWebsiteSetting(const ContentSettingsPattern& primary_pattern,
39 const ContentSettingsPattern& secondary_pattern,
40 ContentSettingsType content_type,
41 const ResourceIdentifier& resource_identifier,
42 base::Value* value) override;
43
44 void ClearAllContentSettingsRules(ContentSettingsType content_type) override;
45
46 void ShutdownOnUIThread() override;
47
48 private:
49 // Reads the policy managed default settings.
50 void ReadManagedDefaultSettings();
51
52 // Callback for preference changes.
53 void OnPreferenceChanged(const std::string& pref_name);
54
55 // Reads the policy controlled default settings for a specific content type.
56 void UpdateManagedDefaultSetting(ContentSettingsType content_type);
57
58 void ReadManagedContentSettings(bool overwrite);
59
60 void GetContentSettingsFromPreferences(OriginIdentifierValueMap* rules);
61
62 void GetAutoSelectCertificateSettingsFromPreferences(
63 OriginIdentifierValueMap* value_map);
64
65 void ReadManagedContentSettingsTypes(ContentSettingsType content_type);
66
67 OriginIdentifierValueMap value_map_;
68
69 PrefService* prefs_;
70
71 PrefChangeRegistrar pref_change_registrar_;
72
73 // Used around accesses to the |value_map_| object to guarantee
74 // thread safety.
75 mutable base::Lock lock_;
76
77 DISALLOW_COPY_AND_ASSIGN(PolicyProvider);
78 };
79
80 } // namespace content_settings
81
82 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_POLICY_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698