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_EXTENSION_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_EXTENSION_PROVIDER_H_ |
6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_EXTENSION_PROVIDER_H_ | 6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_EXTENSION_PROVIDER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chrome/browser/content_settings/content_settings_provider.h" | 10 #include "chrome/browser/content_settings/content_settings_abstract_provider.h" |
11 #include "chrome/browser/extensions/extension_content_settings_store.h" | 11 #include "chrome/browser/extensions/extension_content_settings_store.h" |
12 | 12 |
13 class ContentSettingsDetails; | 13 class ContentSettingsDetails; |
14 class HostContentSettingsMap; | 14 class HostContentSettingsMap; |
15 class Profile; | 15 class Profile; |
16 | 16 |
17 namespace content_settings { | 17 namespace content_settings { |
18 | 18 |
19 class Observer; | |
20 | |
19 // A content settings provider which manages settings defined by extensions. | 21 // A content settings provider which manages settings defined by extensions. |
20 class ExtensionProvider : public ProviderInterface, | 22 class ExtensionProvider : public AbstractProvider, |
21 public ExtensionContentSettingsStore::Observer { | 23 public ExtensionContentSettingsStore::Observer { |
22 public: | 24 public: |
23 ExtensionProvider(HostContentSettingsMap* map, | 25 ExtensionProvider(content_settings::Observer* observer, |
Bernhard Bauer
2011/07/13 07:58:18
Nit: Namespace content_settings is unnecessary.
markusheintz_
2011/07/13 12:48:16
I need it here since the name otherwise collides w
| |
24 ExtensionContentSettingsStore* extensions_settings, | 26 ExtensionContentSettingsStore* extensions_settings, |
25 bool incognito); | 27 bool incognito); |
26 | 28 |
27 virtual ~ExtensionProvider(); | 29 virtual ~ExtensionProvider(); |
28 | 30 |
29 // ProviderInterface methods: | 31 // AbstractProvider methods: |
Bernhard Bauer
2011/07/13 07:58:18
Nit: I think you could leave this comment as "Prov
markusheintz_
2011/07/13 12:48:16
Done. I also changed this comment in all the other
| |
30 virtual ContentSetting GetContentSetting( | 32 virtual ContentSetting GetContentSetting( |
31 const GURL& embedded_url, | 33 const GURL& embedded_url, |
32 const GURL& top_level_url, | 34 const GURL& top_level_url, |
33 ContentSettingsType content_type, | 35 ContentSettingsType content_type, |
34 const ResourceIdentifier& resource_identifier) const; | 36 const ResourceIdentifier& resource_identifier) const; |
35 | 37 |
36 virtual void SetContentSetting( | 38 virtual void SetContentSetting( |
37 const ContentSettingsPattern& embedded_url_pattern, | 39 const ContentSettingsPattern& embedded_url_pattern, |
38 const ContentSettingsPattern& top_level_url_pattern, | 40 const ContentSettingsPattern& top_level_url_pattern, |
39 ContentSettingsType content_type, | 41 ContentSettingsType content_type, |
40 const ResourceIdentifier& resource_identifier, | 42 const ResourceIdentifier& resource_identifier, |
41 ContentSetting content_setting) {} | 43 ContentSetting content_setting) {} |
42 | 44 |
43 virtual void GetAllContentSettingsRules( | 45 virtual void GetAllContentSettingsRules( |
44 ContentSettingsType content_type, | 46 ContentSettingsType content_type, |
45 const ResourceIdentifier& resource_identifier, | 47 const ResourceIdentifier& resource_identifier, |
46 Rules* content_setting_rules) const; | 48 Rules* content_setting_rules) const; |
47 | 49 |
48 virtual void ClearAllContentSettingsRules(ContentSettingsType content_type) {} | 50 virtual void ClearAllContentSettingsRules(ContentSettingsType content_type) {} |
49 | 51 |
50 virtual void ResetToDefaults() {} | 52 virtual void ResetToDefaults() {} |
51 | 53 |
52 virtual void ShutdownOnUIThread(); | 54 virtual void ShutdownOnUIThread(); |
53 | 55 |
54 // ExtensionContentSettingsStore::Observer methods: | 56 // ExtensionContentSettingsStore::Observer methods: |
55 virtual void OnContentSettingChanged(const std::string& extension_id, | 57 virtual void OnContentSettingChanged(const std::string& extension_id, |
56 bool incognito); | 58 bool incognito); |
57 | 59 |
58 private: | 60 private: |
59 void NotifyObservers(const ContentSettingsDetails& details); | |
60 | |
61 // The HostContentSettingsMap this provider belongs to. It is only | |
62 // used as the source for notifications. | |
63 // TODO(markusheintz): Make the HCSM an Observer of the | |
64 // ContentSettingsProvider and send out the Notifications itself. | |
65 HostContentSettingsMap* map_; | |
66 | |
67 // Specifies whether this provider manages settings for incognito or regular | 61 // Specifies whether this provider manages settings for incognito or regular |
68 // sessions. | 62 // sessions. |
69 bool incognito_; | 63 bool incognito_; |
70 | 64 |
71 // The backend storing content setting rules defined by extensions. | 65 // The backend storing content setting rules defined by extensions. |
72 scoped_refptr<ExtensionContentSettingsStore> extensions_settings_; | 66 scoped_refptr<ExtensionContentSettingsStore> extensions_settings_; |
73 | 67 |
74 DISALLOW_COPY_AND_ASSIGN(ExtensionProvider); | 68 DISALLOW_COPY_AND_ASSIGN(ExtensionProvider); |
75 }; | 69 }; |
76 | 70 |
77 } // namespace content_settings | 71 } // namespace content_settings |
78 | 72 |
79 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_EXTENSION_PROVIDER_H _ | 73 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_EXTENSION_PROVIDER_H _ |
OLD | NEW |