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

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

Issue 7344008: Make the hcsm and its providers communicate via an observer interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: "remove commented code" Created 9 years, 5 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) 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 #pragma once 7 #pragma once
8 8
9 // A content settings provider that takes its settings out of policies. 9 // A content settings provider that takes its settings out of policies.
10 10
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/synchronization/lock.h" 14 #include "base/synchronization/lock.h"
15 #include "base/tuple.h" 15 #include "base/tuple.h"
16 #include "chrome/browser/content_settings/content_settings_origin_identifier_val ue_map.h" 16 #include "chrome/browser/content_settings/content_settings_origin_identifier_val ue_map.h"
17 #include "chrome/browser/content_settings/content_settings_provider.h" 17 #include "chrome/browser/content_settings/content_settings_abstract_provider.h"
18 #include "chrome/browser/prefs/pref_change_registrar.h" 18 #include "chrome/browser/prefs/pref_change_registrar.h"
19 #include "content/common/notification_observer.h" 19 #include "content/common/notification_observer.h"
20 #include "content/common/notification_registrar.h" 20 #include "content/common/notification_registrar.h"
21 21
22 class ContentSettingsDetails; 22 class ContentSettingsDetails;
23 class DictionaryValue; 23 class DictionaryValue;
24 class HostContentSettingsMap; 24 class HostContentSettingsMap;
25 class PrefService; 25 class PrefService;
26 26
27 namespace content_settings { 27 namespace content_settings {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // guarantee thread safety. 71 // guarantee thread safety.
72 mutable base::Lock lock_; 72 mutable base::Lock lock_;
73 73
74 PrefChangeRegistrar pref_change_registrar_; 74 PrefChangeRegistrar pref_change_registrar_;
75 NotificationRegistrar notification_registrar_; 75 NotificationRegistrar notification_registrar_;
76 76
77 DISALLOW_COPY_AND_ASSIGN(PolicyDefaultProvider); 77 DISALLOW_COPY_AND_ASSIGN(PolicyDefaultProvider);
78 }; 78 };
79 79
80 // PolicyProvider that provider managed content-settings. 80 // PolicyProvider that provider managed content-settings.
81 class PolicyProvider : public ProviderInterface, 81 class PolicyProvider : public AbstractProvider,
82 public NotificationObserver { 82 public NotificationObserver {
83 public: 83 public:
84 PolicyProvider(HostContentSettingsMap* map, 84 PolicyProvider(Observer* observer,
Bernhard Bauer 2011/07/13 13:21:28 Come to think of it, do we actually *need* an obse
markusheintz_ 2011/07/13 13:28:53 That is totally correct! Basically the host conte
Bernhard Bauer 2011/07/13 13:41:32 No, you don't. At the point where you create the c
markusheintz_ 2011/07/13 14:14:42 Ok.
85 PrefService* prefs, 85 PrefService* prefs,
86 DefaultProviderInterface* default_provider); 86 DefaultProviderInterface* default_provider);
87 virtual ~PolicyProvider(); 87 virtual ~PolicyProvider();
88 static void RegisterUserPrefs(PrefService* prefs); 88 static void RegisterUserPrefs(PrefService* prefs);
89 89
90 // ProviderInterface Implementation 90 // ProviderInterface implementations.
91 virtual void SetContentSetting( 91 virtual void SetContentSetting(
92 const ContentSettingsPattern& primary_pattern, 92 const ContentSettingsPattern& primary_pattern,
93 const ContentSettingsPattern& secondary_pattern, 93 const ContentSettingsPattern& secondary_pattern,
94 ContentSettingsType content_type, 94 ContentSettingsType content_type,
95 const ResourceIdentifier& resource_identifier, 95 const ResourceIdentifier& resource_identifier,
96 ContentSetting content_setting); 96 ContentSetting content_setting);
97 97
98 virtual ContentSetting GetContentSetting( 98 virtual ContentSetting GetContentSetting(
99 const GURL& primary_url, 99 const GURL& primary_url,
100 const GURL& secondary_url, 100 const GURL& secondary_url,
(...skipping 23 matching lines...) Expand all
124 ContentSetting> ContentSettingsRule; 124 ContentSetting> ContentSettingsRule;
125 125
126 typedef std::vector<ContentSettingsRule> ContentSettingsRules; 126 typedef std::vector<ContentSettingsRule> ContentSettingsRules;
127 127
128 void ReadManagedContentSettings(bool overwrite); 128 void ReadManagedContentSettings(bool overwrite);
129 129
130 void GetContentSettingsFromPreferences(ContentSettingsRules* rules); 130 void GetContentSettingsFromPreferences(ContentSettingsRules* rules);
131 131
132 void ReadManagedContentSettingsTypes(ContentSettingsType content_type); 132 void ReadManagedContentSettingsTypes(ContentSettingsType content_type);
133 133
134 void NotifyObservers(const ContentSettingsDetails& details);
135
136 OriginIdentifierValueMap value_map_; 134 OriginIdentifierValueMap value_map_;
137 135
138 HostContentSettingsMap* host_content_settings_map_;
139 PrefService* prefs_; 136 PrefService* prefs_;
140 137
141 // Weak, owned by HostContentSettingsMap. 138 // Weak, owned by HostContentSettingsMap.
142 DefaultProviderInterface* default_provider_; 139 DefaultProviderInterface* default_provider_;
143 140
144 PrefChangeRegistrar pref_change_registrar_; 141 PrefChangeRegistrar pref_change_registrar_;
145 142
146 // Used around accesses to the content_settings_ object to guarantee 143 // Used around accesses to the content_settings_ object to guarantee
147 // thread safety. 144 // thread safety.
148 mutable base::Lock lock_; 145 mutable base::Lock lock_;
149 146
150 DISALLOW_COPY_AND_ASSIGN(PolicyProvider); 147 DISALLOW_COPY_AND_ASSIGN(PolicyProvider);
151 }; 148 };
152 149
153 } // namespace content_settings 150 } // namespace content_settings
154 151
155 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_POLICY_PROVIDER_H_ 152 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_POLICY_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698