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 24 matching lines...) Expand all Loading... |
35 // normal mode. Otherwise, it returns the content settings for the normal | 35 // normal mode. Otherwise, it returns the content settings for the normal |
36 // mode. The caller takes the ownership of the returned |RuleIterator|. It is | 36 // mode. The caller takes the ownership of the returned |RuleIterator|. It is |
37 // not allowed to call other |ProviderInterface| functions (including | 37 // not allowed to call other |ProviderInterface| functions (including |
38 // |GetRuleIterator|) for the same provider until the |RuleIterator| is | 38 // |GetRuleIterator|) for the same provider until the |RuleIterator| is |
39 // destroyed. | 39 // destroyed. |
40 virtual RuleIterator* GetRuleIterator( | 40 virtual RuleIterator* GetRuleIterator( |
41 ContentSettingsType content_type, | 41 ContentSettingsType content_type, |
42 const ResourceIdentifier& resource_identifier, | 42 const ResourceIdentifier& resource_identifier, |
43 bool incognito) const = 0; | 43 bool incognito) const = 0; |
44 | 44 |
45 // Sets the content setting for a particular |primary_pattern|, | 45 // Askes the provider to set the website setting for a particular |
46 // |secondary_pattern|, |content_type| tuple. For ContentSettingsTypes that | 46 // |primary_pattern|, |secondary_pattern|, |content_type| tuple. If the |
47 // require a resource identifier to be specified, the |resource_identifier| | 47 // provider accepts the setting it returns true and takes the ownership of the |
48 // must be non-empty. | 48 // |value|. Otherwise false is returned and the ownership of the |value| stays |
| 49 // with the caller. |
49 // | 50 // |
50 // This should only be called on the UI thread, and not after | 51 // This should only be called on the UI thread, and not after |
51 // ShutdownOnUIThread has been called. | 52 // ShutdownOnUIThread has been called. |
52 virtual void SetContentSetting( | 53 virtual bool SetWebsiteSetting( |
53 const ContentSettingsPattern& primary_pattern, | 54 const ContentSettingsPattern& primary_pattern, |
54 const ContentSettingsPattern& secondary_pattern, | 55 const ContentSettingsPattern& secondary_pattern, |
55 ContentSettingsType content_type, | 56 ContentSettingsType content_type, |
56 const ResourceIdentifier& resource_identifier, | 57 const ResourceIdentifier& resource_identifier, |
57 ContentSetting content_setting) = 0; | 58 Value* value) = 0; |
58 | 59 |
59 // Resets all content settings for the given |content_type| and empty resource | 60 // Resets all content settings for the given |content_type| and empty resource |
60 // identifier to CONTENT_SETTING_DEFAULT. | 61 // identifier to CONTENT_SETTING_DEFAULT. |
61 // | 62 // |
62 // This should only be called on the UI thread, and not after | 63 // This should only be called on the UI thread, and not after |
63 // ShutdownOnUIThread has been called. | 64 // ShutdownOnUIThread has been called. |
64 virtual void ClearAllContentSettingsRules( | 65 virtual void ClearAllContentSettingsRules( |
65 ContentSettingsType content_type) = 0; | 66 ContentSettingsType content_type) = 0; |
66 | 67 |
67 // Detaches the Provider from all Profile-related objects like PrefService. | 68 // Detaches the Provider from all Profile-related objects like PrefService. |
68 // This methods needs to be called before destroying the Profile. | 69 // This methods needs to be called before destroying the Profile. |
69 // Afterwards, none of the methods above that should only be called on the UI | 70 // Afterwards, none of the methods above that should only be called on the UI |
70 // thread should be called anymore. | 71 // thread should be called anymore. |
71 virtual void ShutdownOnUIThread() = 0; | 72 virtual void ShutdownOnUIThread() = 0; |
72 }; | 73 }; |
73 | 74 |
74 } // namespace content_settings | 75 } // namespace content_settings |
75 | 76 |
76 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_ | 77 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_ |
OLD | NEW |