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_BASE_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_BASE_PROVIDER_H_ |
6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_BASE_PROVIDER_H_ | 6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_BASE_PROVIDER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 23 matching lines...) Expand all Loading... | |
34 | 34 |
35 // BaseProvider is the abstract base class for all content-settings-provider | 35 // BaseProvider is the abstract base class for all content-settings-provider |
36 // classes. | 36 // classes. |
37 class BaseProvider : public ProviderInterface { | 37 class BaseProvider : public ProviderInterface { |
38 public: | 38 public: |
39 // Maps CONTENT_SETTING_ASK for the CONTENT_SETTINGS_TYPE_PLUGINS to | 39 // Maps CONTENT_SETTING_ASK for the CONTENT_SETTINGS_TYPE_PLUGINS to |
40 // CONTENT_SETTING_BLOCK if click-to-play is not enabled. | 40 // CONTENT_SETTING_BLOCK if click-to-play is not enabled. |
41 static ContentSetting ClickToPlayFixup(ContentSettingsType content_type, | 41 static ContentSetting ClickToPlayFixup(ContentSettingsType content_type, |
42 ContentSetting setting); | 42 ContentSetting setting); |
43 | 43 |
44 // Returns true if the |content_type| requires a resource identifier. | |
45 static bool RequiresResourceIdentifier( | |
Bernhard Bauer
2011/05/24 14:21:29
I think that method might be useful to clients of
markusheintz_
2011/05/26 13:22:13
Strike :) Already committed in a separate CL :)
| |
46 ContentSettingsType content_type); | |
47 | |
44 explicit BaseProvider(bool is_otr); | 48 explicit BaseProvider(bool is_otr); |
45 virtual ~BaseProvider(); | 49 virtual ~BaseProvider(); |
46 | 50 |
47 | 51 |
48 // Initializes the Provider. | 52 // Initializes the Provider. |
49 virtual void Init() = 0; | 53 virtual void Init() = 0; |
50 | 54 |
51 virtual ContentSetting GetContentSetting( | 55 virtual ContentSetting GetContentSetting( |
52 const GURL& requesting_url, | 56 const GURL& requesting_url, |
53 const GURL& embedding_url, | 57 const GURL& embedding_url, |
(...skipping 11 matching lines...) Expand all Loading... | |
65 ContentSettingsType content_type, | 69 ContentSettingsType content_type, |
66 const ResourceIdentifier& resource_identifier, | 70 const ResourceIdentifier& resource_identifier, |
67 Rules* content_setting_rules) const; | 71 Rules* content_setting_rules) const; |
68 | 72 |
69 virtual void ClearAllContentSettingsRules( | 73 virtual void ClearAllContentSettingsRules( |
70 ContentSettingsType content_type) = 0; | 74 ContentSettingsType content_type) = 0; |
71 | 75 |
72 virtual void ResetToDefaults() = 0; | 76 virtual void ResetToDefaults() = 0; |
73 | 77 |
74 protected: | 78 protected: |
75 // Returns true if the |content_type| requires a resource identifier. | |
76 bool RequiresResourceIdentifier( | |
77 ContentSettingsType content_type) const; | |
78 | |
79 // Returns true if the passed |settings| object contains only | 79 // Returns true if the passed |settings| object contains only |
80 // CONTENT_SETTING_DEFAULT values. | 80 // CONTENT_SETTING_DEFAULT values. |
81 bool AllDefault(const ExtendedContentSettings& settings) const; | 81 bool AllDefault(const ExtendedContentSettings& settings) const; |
82 | 82 |
83 void UpdateContentSettingsMap( | 83 void UpdateContentSettingsMap( |
84 const ContentSettingsPattern& requesting_pattern, | 84 const ContentSettingsPattern& requesting_pattern, |
85 const ContentSettingsPattern& embedding_pattern, | 85 const ContentSettingsPattern& embedding_pattern, |
86 ContentSettingsType content_type, | 86 ContentSettingsType content_type, |
87 const ResourceIdentifier& resource_identifier, | 87 const ResourceIdentifier& resource_identifier, |
88 ContentSetting content_setting); | 88 ContentSetting content_setting); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
121 HostContentSettings incognito_settings_; | 121 HostContentSettings incognito_settings_; |
122 | 122 |
123 // Used around accesses to the content_settings_ object to guarantee | 123 // Used around accesses to the content_settings_ object to guarantee |
124 // thread safety. | 124 // thread safety. |
125 mutable base::Lock lock_; | 125 mutable base::Lock lock_; |
126 }; | 126 }; |
127 | 127 |
128 } // namespace content_settings | 128 } // namespace content_settings |
129 | 129 |
130 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_BASE_PROVIDER_H_ | 130 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_BASE_PROVIDER_H_ |
OLD | NEW |