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

Side by Side Diff: chrome/browser/extensions/extension_content_settings_provider.h

Issue 6927028: TODO (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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
(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_EXTENSIONS_EXTENSION_CONTENT_SETTINGS_PROVIDER_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_CONTENT_SETTINGS_PROVIDER_H_
7
8 #include "chrome/browser/content_settings/content_settings_base.h"
9 #include "chrome/browser/content_settings/content_settings_provider.h"
10 #include "chrome/browser/extensions/extension_content_settings_store.h"
11 #include "content/common/notification_details.h"
12
13 class ContentSettingsDetails;
14 class Profile;
15
16 class ExtensionDefaultContentSettingsProvider
17 : content_settings::DefaultProviderInterface,
18 ExtensionContentSettingsStore::Observer {
19 public:
20 ExtensionDefaultContentSettingsProvider(
21 Profile* profile,
22 ExtensionContentSettingsStore* extensions_settings,
23 bool incognito);
24
25 virtual ~ExtensionDefaultContentSettingsProvider();
26
27 // content_settings::DefaultProviderInterface
28 virtual ContentSetting ProvideDefaultSetting(
29 ContentSettingsType content_type) const;
30
31 virtual void UpdateDefaultSetting(ContentSettingsType content_type,
32 ContentSetting setting) {}
33
34 virtual void ResetToDefaults() {}
35
36 virtual bool DefaultSettingIsManaged(
37 ContentSettingsType content_type) const;
38
39 // ExtensionContentSettingsStore::Observer
40 void OnDefaultContentSettingChanged(
41 const ContentSettingsType& type,
42 ContentSetting setting,
43 bool incognito);
44
45 void OnContentSettingChanged(
46 const ContentSettingsPattern& pattern,
47 const ContentSettingsPattern& embedder_pattern,
48 const ContentSettingsType& type,
49 const content_settings::ResourceIdentifier& identifier,
50 ContentSetting setting,
51 bool incognito);
52
53 void OnDestruction();
54
55 private:
56 void NotifyObservers(const ContentSettingsDetails& details);
57
58 Profile* profile_;
59
60 bool incognito_;
61
62 ExtensionContentSettingsStore* extensions_settings_; // Weak Pointer
63
64 DISALLOW_COPY_AND_ASSIGN(ExtensionDefaultContentSettingsProvider);
65 };
66
67 class ExtensionContentSettingsProvider
68 : content_settings::ProviderInterface,
69 ExtensionContentSettingsStore::Observer {
70 public:
71 ExtensionContentSettingsProvider(
72 Profile* profile,
73 ExtensionContentSettingsStore* extensions_settings,
74 bool incognito);
75
76 virtual ~ExtensionContentSettingsProvider();
77
78 // Overrides from content_settings::ProviderInterface
79 virtual bool ContentSettingsTypeIsManaged(ContentSettingsType content_type);
80
81 virtual ContentSetting GetContentSetting(
82 const GURL& requesting_url,
83 const GURL& embedding_url,
84 ContentSettingsType content_type,
85 const ResourceIdentifier& resource_identifier) const;
86
87 virtual void SetContentSetting(
88 const ContentSettingsPattern& requesting_url_pattern,
89 const ContentSettingsPattern& embedding_url_pattern,
90 ContentSettingsType content_type,
91 const ResourceIdentifier& resource_identifier,
92 ContentSetting content_setting) {}
93
94 // TODO(markusheintz): The UI needs a way to discover that these rules are
95 // managed by an extension.
96 virtual void GetAllContentSettingsRules(
97 ContentSettingsType content_type,
98 const ResourceIdentifier& resource_identifier,
99 Rules* content_setting_rules) const;
100
101 virtual void ClearAllContentSettingsRules(
102 ContentSettingsType content_type) {}
103
104 virtual void ResetToDefaults() {}
105
106 // Overrides from ExtensionContentSettingsStore::Observer
107 virtual void OnDefaultContentSettingChanged(
108 const ContentSettingsType& type,
109 ContentSetting setting,
110 bool incognito);
111
112 virtual void OnContentSettingChanged(
113 const ContentSettingsPattern& pattern,
114 const ContentSettingsPattern& embedder_pattern,
115 const ContentSettingsType& type,
116 const content_settings::ResourceIdentifier& identifier,
117 ContentSetting setting,
118 bool incognito);
119
120 virtual void OnDestruction();
121
122 private:
123 void NotifyObservers(const ContentSettingsDetails& details);
124
125 // TODO(markusheintz): That's only needed to send Notifications about changed
126 // ContentSettings. This will be changed for all ContentSettingsProviders.
127 // The HCSM will become an Observer of the ContentSettings Provider and send
128 // out the Notifications itselve.
129 Profile* profile_;
130
131 bool incognito_;
132
133 ExtensionContentSettingsStore* extensions_settings_; // Weak Pointer
134
135 DISALLOW_COPY_AND_ASSIGN(ExtensionContentSettingsProvider);
136 };
137
138 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_CONTENT_SETTINGS_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698