| 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 // Interface for objects providing content setting rules. | 5 // Interface for objects providing content setting rules. |
| 6 | 6 |
| 7 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_ | 7 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_ |
| 8 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_ | 8 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_ |
| 9 #pragma once | 9 #pragma once |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 struct Rule { | 50 struct Rule { |
| 51 Rule() {} | 51 Rule() {} |
| 52 Rule(const ContentSettingsPattern& requesting_pattern, | 52 Rule(const ContentSettingsPattern& requesting_pattern, |
| 53 const ContentSettingsPattern& embedding_pattern, | 53 const ContentSettingsPattern& embedding_pattern, |
| 54 ContentSetting setting) | 54 ContentSetting setting) |
| 55 : requesting_url_pattern(requesting_pattern), | 55 : requesting_url_pattern(requesting_pattern), |
| 56 embedding_url_pattern(embedding_pattern), | 56 embedding_url_pattern(embedding_pattern), |
| 57 content_setting(setting) {} | 57 content_setting(setting) {} |
| 58 | 58 |
| 59 const ContentSettingsPattern requesting_url_pattern; | 59 ContentSettingsPattern requesting_url_pattern; |
| 60 const ContentSettingsPattern embedding_url_pattern; | 60 ContentSettingsPattern embedding_url_pattern; |
| 61 ContentSetting content_setting; | 61 ContentSetting content_setting; |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 typedef std::vector<Rule> Rules; | 64 typedef std::vector<Rule> Rules; |
| 65 | 65 |
| 66 virtual ~ProviderInterface() {} | 66 virtual ~ProviderInterface() {} |
| 67 | 67 |
| 68 // Returns a single ContentSetting which applies to a given |requesting_url|, | 68 // Returns a single ContentSetting which applies to a given |requesting_url|, |
| 69 // |embedding_url| pair or CONTENT_SETTING_DEFAULT, if no rule applies. For | 69 // |embedding_url| pair or CONTENT_SETTING_DEFAULT, if no rule applies. For |
| 70 // ContentSettingsTypes that require a resource identifier to be specified, | 70 // ContentSettingsTypes that require a resource identifier to be specified, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 97 // from the corresponding regular provider. For ContentSettingsTypes that | 97 // from the corresponding regular provider. For ContentSettingsTypes that |
| 98 // require a resource identifier to be specified, the |resource_identifier| | 98 // require a resource identifier to be specified, the |resource_identifier| |
| 99 // must be non-empty. | 99 // must be non-empty. |
| 100 // | 100 // |
| 101 // This may be called on any thread. | 101 // This may be called on any thread. |
| 102 virtual void GetAllContentSettingsRules( | 102 virtual void GetAllContentSettingsRules( |
| 103 ContentSettingsType content_type, | 103 ContentSettingsType content_type, |
| 104 const ResourceIdentifier& resource_identifier, | 104 const ResourceIdentifier& resource_identifier, |
| 105 Rules* content_setting_rules) const = 0; | 105 Rules* content_setting_rules) const = 0; |
| 106 | 106 |
| 107 // Resets all content settings to CONTENT_SETTING_DEFAULT. | 107 // Resets all content settings for the given |content_type| to |
| 108 // CONTENT_SETTING_DEFAULT. For content types that require a resource |
| 109 // identifier all content settings for any resource identifieres of the given |
| 110 // |content_type| will be reset to CONTENT_SETTING_DEFAULT. |
| 108 // | 111 // |
| 109 // This should only be called on the UI thread. | 112 // This should only be called on the UI thread. |
| 110 virtual void ClearAllContentSettingsRules() = 0; | 113 virtual void ClearAllContentSettingsRules( |
| 114 ContentSettingsType content_type) = 0; |
| 115 |
| 116 // Resets all content settings to CONTENT_SETTINGS_DEFAULT. |
| 117 // |
| 118 // This should only be called on the UI thread. |
| 119 virtual void ResetToDefaults() = 0; |
| 111 }; | 120 }; |
| 112 | 121 |
| 113 } // namespace content_settings | 122 } // namespace content_settings |
| 114 | 123 |
| 115 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_ | 124 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_ |
| OLD | NEW |