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

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

Issue 7275018: Make ExtensionContentSettingsStore refcounted. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review 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
« no previous file with comments | « no previous file | chrome/browser/content_settings/content_settings_extension_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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_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 Profile; 15 class Profile;
15 16
16 namespace content_settings { 17 namespace content_settings {
17 18
18 // A content settings provider which uses settings defined by extensions. 19 // A content settings provider which manages settings defined by extensions.
19 class ExtensionProvider : public ProviderInterface, 20 class ExtensionProvider : public ProviderInterface,
20 public ExtensionContentSettingsStore::Observer { 21 public ExtensionContentSettingsStore::Observer {
21 public: 22 public:
22 ExtensionProvider(Profile* profile, 23 ExtensionProvider(HostContentSettingsMap* map,
23 ExtensionContentSettingsStore* extensions_settings, 24 ExtensionContentSettingsStore* extensions_settings,
24 bool incognito); 25 bool incognito);
25 26
26 virtual ~ExtensionProvider(); 27 virtual ~ExtensionProvider();
27 28
28 // ProviderInterface methods: 29 // ProviderInterface methods:
29 virtual ContentSetting GetContentSetting( 30 virtual ContentSetting GetContentSetting(
30 const GURL& embedded_url, 31 const GURL& embedded_url,
31 const GURL& top_level_url, 32 const GURL& top_level_url,
32 ContentSettingsType content_type, 33 ContentSettingsType content_type,
33 const ResourceIdentifier& resource_identifier) const; 34 const ResourceIdentifier& resource_identifier) const;
34 35
35 virtual void SetContentSetting( 36 virtual void SetContentSetting(
36 const ContentSettingsPattern& embedded_url_pattern, 37 const ContentSettingsPattern& embedded_url_pattern,
37 const ContentSettingsPattern& top_level_url_pattern, 38 const ContentSettingsPattern& top_level_url_pattern,
38 ContentSettingsType content_type, 39 ContentSettingsType content_type,
39 const ResourceIdentifier& resource_identifier, 40 const ResourceIdentifier& resource_identifier,
40 ContentSetting content_setting) {} 41 ContentSetting content_setting) {}
41 42
42 virtual void GetAllContentSettingsRules( 43 virtual void GetAllContentSettingsRules(
43 ContentSettingsType content_type, 44 ContentSettingsType content_type,
44 const ResourceIdentifier& resource_identifier, 45 const ResourceIdentifier& resource_identifier,
45 Rules* content_setting_rules) const; 46 Rules* content_setting_rules) const;
46 47
47 virtual void ClearAllContentSettingsRules(ContentSettingsType content_type) {} 48 virtual void ClearAllContentSettingsRules(ContentSettingsType content_type) {}
48 49
49 virtual void ResetToDefaults() {} 50 virtual void ResetToDefaults() {}
50 51
52 virtual void ShutdownOnUIThread();
53
51 // ExtensionContentSettingsStore::Observer methods: 54 // ExtensionContentSettingsStore::Observer methods:
52 virtual void OnContentSettingChanged(const std::string& extension_id, 55 virtual void OnContentSettingChanged(const std::string& extension_id,
53 bool incognito); 56 bool incognito);
54 57
55 virtual void OnDestruction();
56
57 private: 58 private:
58 void NotifyObservers(const ContentSettingsDetails& details); 59 void NotifyObservers(const ContentSettingsDetails& details);
59 60
60 // TODO(markusheintz): That's only needed to send Notifications about changed 61 // The HostContentSettingsMap this provider belongs to. It is only
61 // ContentSettings. This will be changed for all ContentSettingsProviders. 62 // used as the source for notifications.
62 // The HCSM will become an Observer of the ContentSettings Provider and send 63 // TODO(markusheintz): Make the HCSM an Observer of the
63 // out the Notifications itself. 64 // ContentSettingsProvider and send out the Notifications itself.
64 Profile* profile_; 65 HostContentSettingsMap* map_;
65 66
67 // Specifies whether this provider manages settings for incognito or regular
68 // sessions.
66 bool incognito_; 69 bool incognito_;
67 70
68 ExtensionContentSettingsStore* extensions_settings_; // Weak Pointer 71 // The backend storing content setting rules defined by extensions.
72 scoped_refptr<ExtensionContentSettingsStore> extensions_settings_;
69 73
70 DISALLOW_COPY_AND_ASSIGN(ExtensionProvider); 74 DISALLOW_COPY_AND_ASSIGN(ExtensionProvider);
71 }; 75 };
72 76
73 } // namespace content_settings 77 } // namespace content_settings
74 78
75 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_EXTENSION_PROVIDER_H _ 79 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_EXTENSION_PROVIDER_H _
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/content_settings/content_settings_extension_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698