Chromium Code Reviews| 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 |
| 11 #include <string> | |
| 12 #include <vector> | |
| 13 | |
| 14 #include "chrome/browser/content_settings/content_settings_pattern.h" | |
| 11 #include "chrome/common/content_settings.h" | 15 #include "chrome/common/content_settings.h" |
| 12 | 16 |
| 17 class GURL; | |
| 18 | |
| 13 namespace content_settings { | 19 namespace content_settings { |
| 14 | 20 |
| 15 class DefaultProviderInterface { | 21 class DefaultProviderInterface { |
| 16 public: | 22 public: |
| 17 virtual ~DefaultProviderInterface() {} | 23 virtual ~DefaultProviderInterface() {} |
| 18 | 24 |
| 19 // True if this provider can provide a default setting for the |content_type|. | 25 // True if this provider can provide a default setting for the |content_type|. |
| 20 virtual bool CanProvideDefaultSetting( | 26 virtual bool CanProvideDefaultSetting( |
| 21 ContentSettingsType content_type) const = 0; | 27 ContentSettingsType content_type) const = 0; |
| 22 | 28 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 34 | 40 |
| 35 // Resets the state of the provider to the default. | 41 // Resets the state of the provider to the default. |
| 36 virtual void ResetToDefaults() = 0; | 42 virtual void ResetToDefaults() = 0; |
| 37 | 43 |
| 38 // True if the default setting for the |content_type| is policy managed, i.e., | 44 // True if the default setting for the |content_type| is policy managed, i.e., |
| 39 // there shouldn't be any UI shown to modify this setting. | 45 // there shouldn't be any UI shown to modify this setting. |
| 40 virtual bool DefaultSettingIsManaged( | 46 virtual bool DefaultSettingIsManaged( |
| 41 ContentSettingsType content_type) const = 0; | 47 ContentSettingsType content_type) const = 0; |
| 42 }; | 48 }; |
| 43 | 49 |
| 50 class ProviderInterface { | |
| 51 public: | |
| 52 typedef std::string ResourceIdentifier; | |
| 53 | |
| 54 struct Rule { | |
| 55 Rule() {} | |
| 56 Rule(const ContentSettingsPattern& requesting_url_pattern, | |
| 57 const ContentSettingsPattern& embedding_url_pattern, | |
| 58 ContentSetting& setting) | |
| 59 : requesting_url_pattern_(requesting_url_pattern), | |
| 60 embedding_url_pattern_(embedding_url_pattern), | |
| 61 content_setting_(setting) {} | |
| 62 | |
| 63 const ContentSettingsPattern requesting_url_pattern_; | |
| 64 const ContentSettingsPattern embedding_url_pattern_; | |
| 65 ContentSetting content_setting_; | |
| 66 }; | |
| 67 | |
| 68 typedef std::vector<Rule> Rules; | |
| 69 | |
| 70 virtual ~ProviderInterface() {} | |
| 71 | |
| 72 virtual bool ContentSettingsTypeIsManaged( | |
| 73 ContentSettingsType content_type) = 0; | |
|
Bernhard Bauer
2011/01/31 13:48:58
Do we need this? What level of strictness does man
markusheintz_
2011/01/31 14:21:19
Actually I think we could get rid of this.
jochen (gone - plz use gerrit)
2011/01/31 14:30:02
If an provider returns true here, the user's setti
| |
| 74 | |
| 75 // This may be called on any thread. | |
| 76 virtual ContentSetting GetContentSetting( | |
| 77 const GURL requesting_url, | |
| 78 const GURL embedding_url, | |
| 79 const ContentSettingsType& content_type, | |
| 80 const ResourceIdentifier& resource_identifier) const = 0; | |
| 81 | |
| 82 // This should only be called on the UI thread. | |
| 83 virtual void SetContentSetting( | |
| 84 const ContentSettingsPattern& requesting_pattern, | |
| 85 const ContentSettingsPattern& embedding_pattern, | |
| 86 const ContentSettingsType& content_type, | |
| 87 const ResourceIdentifier& resource_identifier, | |
| 88 ContentSetting content_setting) = 0; | |
| 89 | |
| 90 // This may be called on any thread. | |
| 91 virtual void GetAllContentSettingsRules( | |
| 92 const ContentSettingsType& content_type, | |
| 93 const ResourceIdentifier& resource_identifier, | |
| 94 Rules* content_setting_rules) const = 0; | |
| 95 | |
| 96 // This should only be called on the UI thread. | |
| 97 virtual void ClearAllContentSettingsRules() = 0; | |
| 98 }; | |
| 99 | |
| 44 } // namespace content_settings | 100 } // namespace content_settings |
| 45 | 101 |
| 46 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_ | 102 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_ |
| OLD | NEW |