| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 const GURL& primary_url, | 74 const GURL& primary_url, |
| 75 const GURL& secondary_url, | 75 const GURL& secondary_url, |
| 76 ContentSettingsType content_type, | 76 ContentSettingsType content_type, |
| 77 const ResourceIdentifier& resource_identifier) const = 0; | 77 const ResourceIdentifier& resource_identifier) const = 0; |
| 78 | 78 |
| 79 // Sets the content setting for a particular |primary_pattern|, | 79 // Sets the content setting for a particular |primary_pattern|, |
| 80 // |secondary_pattern|, |content_type| tuple. For ContentSettingsTypes that | 80 // |secondary_pattern|, |content_type| tuple. For ContentSettingsTypes that |
| 81 // require a resource identifier to be specified, the |resource_identifier| | 81 // require a resource identifier to be specified, the |resource_identifier| |
| 82 // must be non-empty. | 82 // must be non-empty. |
| 83 // | 83 // |
| 84 // This should only be called on the UI thread. | 84 // This should only be called on the UI thread, and not after |
| 85 // ShutdownOnUIThread has been called. |
| 85 virtual void SetContentSetting( | 86 virtual void SetContentSetting( |
| 86 const ContentSettingsPattern& primary_pattern, | 87 const ContentSettingsPattern& primary_pattern, |
| 87 const ContentSettingsPattern& secondary_pattern, | 88 const ContentSettingsPattern& secondary_pattern, |
| 88 ContentSettingsType content_type, | 89 ContentSettingsType content_type, |
| 89 const ResourceIdentifier& resource_identifier, | 90 const ResourceIdentifier& resource_identifier, |
| 90 ContentSetting content_setting) = 0; | 91 ContentSetting content_setting) = 0; |
| 91 | 92 |
| 92 // For a given content type, returns all content setting rules with a | 93 // For a given content type, returns all content setting rules with a |
| 93 // non-default setting, mapped to their actual settings. | 94 // non-default setting, mapped to their actual settings. |
| 94 // |content_settings_rules| must be non-NULL. If this provider was created for | 95 // |content_settings_rules| must be non-NULL. If this provider was created for |
| 95 // the incognito profile, it will only return those settings differing | 96 // the incognito profile, it will only return those settings differing |
| 96 // from the corresponding regular provider. For ContentSettingsTypes that | 97 // from the corresponding regular provider. For ContentSettingsTypes that |
| 97 // require a resource identifier to be specified, the |resource_identifier| | 98 // require a resource identifier to be specified, the |resource_identifier| |
| 98 // must be non-empty. | 99 // must be non-empty. |
| 99 // | 100 // |
| 100 // This may be called on any thread. | 101 // This may be called on any thread. |
| 101 virtual void GetAllContentSettingsRules( | 102 virtual void GetAllContentSettingsRules( |
| 102 ContentSettingsType content_type, | 103 ContentSettingsType content_type, |
| 103 const ResourceIdentifier& resource_identifier, | 104 const ResourceIdentifier& resource_identifier, |
| 104 Rules* content_setting_rules) const = 0; | 105 Rules* content_setting_rules) const = 0; |
| 105 | 106 |
| 106 // Resets all content settings for the given |content_type| to | 107 // Resets all content settings for the given |content_type| to |
| 107 // CONTENT_SETTING_DEFAULT. For content types that require a resource | 108 // CONTENT_SETTING_DEFAULT. For content types that require a resource |
| 108 // identifier all content settings for any resource identifieres of the given | 109 // identifier all content settings for any resource identifieres of the given |
| 109 // |content_type| will be reset to CONTENT_SETTING_DEFAULT. | 110 // |content_type| will be reset to CONTENT_SETTING_DEFAULT. |
| 110 // | 111 // |
| 111 // This should only be called on the UI thread. | 112 // This should only be called on the UI thread, and not after |
| 113 // ShutdownOnUIThread has been called. |
| 112 virtual void ClearAllContentSettingsRules( | 114 virtual void ClearAllContentSettingsRules( |
| 113 ContentSettingsType content_type) = 0; | 115 ContentSettingsType content_type) = 0; |
| 114 | 116 |
| 115 // Resets all content settings to CONTENT_SETTINGS_DEFAULT. | 117 // Resets all content settings to CONTENT_SETTINGS_DEFAULT. |
| 116 // | 118 // |
| 117 // This should only be called on the UI thread. | 119 // This should only be called on the UI thread, and not after |
| 120 // ShutdownOnUIThread has been called. |
| 118 virtual void ResetToDefaults() = 0; | 121 virtual void ResetToDefaults() = 0; |
| 122 |
| 123 // Detaches the Provider from all Profile-related objects like PrefService. |
| 124 // This methods needs to be called before destroying the Profile. |
| 125 // Afterwards, none of the methods above that should only be called on the UI |
| 126 // thread should be called anymore. |
| 127 virtual void ShutdownOnUIThread() {} |
| 119 }; | 128 }; |
| 120 | 129 |
| 121 } // namespace content_settings | 130 } // namespace content_settings |
| 122 | 131 |
| 123 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_ | 132 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_ |
| OLD | NEW |