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> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "chrome/browser/content_settings/content_settings_pattern.h" | 14 #include "chrome/browser/content_settings/content_settings_pattern.h" |
| 15 #include "chrome/common/content_settings.h" | 15 #include "chrome/common/content_settings.h" |
| 16 | 16 |
| 17 class GURL; | 17 class GURL; |
| 18 | 18 |
| 19 namespace content_settings { | 19 namespace content_settings { |
| 20 | 20 |
| 21 class DefaultProviderInterface { | 21 class DefaultProviderInterface { |
| 22 public: | 22 public: |
| 23 virtual ~DefaultProviderInterface() {} | 23 virtual ~DefaultProviderInterface() {} |
| 24 | 24 |
| 25 // Returns the default content setting this provider has for the given | 25 // Returns the default content setting this provider has for the given |
| 26 // |content_type|, or CONTENT_SETTING_DEFAULT if nothing be provided for this | 26 // |content_type|, or CONTENT_SETTING_DEFAULT if nothing be provided for this |
| 27 // type. | 27 // type. |
| 28 virtual ContentSetting ProvideDefaultSetting( | 28 virtual ContentSetting ProvideDefaultSetting( |
| 29 | |
|
Bernhard Bauer
2011/02/23 13:18:53
Nit: Remove blank line.
markusheintz_
2011/02/23 18:42:09
Done.
| |
| 29 ContentSettingsType content_type) const = 0; | 30 ContentSettingsType content_type) const = 0; |
| 30 | 31 |
| 31 // Notifies the provider that the host content settings map would like to | 32 // Notifies the provider that the host content settings map would like to |
| 32 // update the default setting for the given |content_type|. The provider may | 33 // update the default setting for the given |content_type|. The provider may |
| 33 // ignore this. | 34 // ignore this. |
| 34 virtual void UpdateDefaultSetting(ContentSettingsType content_type, | 35 virtual void UpdateDefaultSetting(ContentSettingsType content_type, |
| 35 ContentSetting setting) = 0; | 36 ContentSetting setting) = 0; |
| 36 | 37 |
| 37 // Resets the state of the provider to the default. | 38 // Resets the state of the provider to the default. |
| 38 virtual void ResetToDefaults() = 0; | 39 virtual void ResetToDefaults() = 0; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 58 | 59 |
| 59 ContentSettingsPattern requesting_url_pattern; | 60 ContentSettingsPattern requesting_url_pattern; |
| 60 ContentSettingsPattern embedding_url_pattern; | 61 ContentSettingsPattern embedding_url_pattern; |
| 61 ContentSetting content_setting; | 62 ContentSetting content_setting; |
| 62 }; | 63 }; |
| 63 | 64 |
| 64 typedef std::vector<Rule> Rules; | 65 typedef std::vector<Rule> Rules; |
| 65 | 66 |
| 66 virtual ~ProviderInterface() {} | 67 virtual ~ProviderInterface() {} |
| 67 | 68 |
| 69 // Returns true whether the content settings provider manages the | |
| 70 // |content_type|. | |
| 71 virtual bool ContentSettingsTypeIsManaged( | |
| 72 ContentSettingsType content_type) = 0; | |
| 73 | |
| 68 // Returns a single ContentSetting which applies to a given |requesting_url|, | 74 // Returns a single ContentSetting which applies to a given |requesting_url|, |
| 69 // |embedding_url| pair or CONTENT_SETTING_DEFAULT, if no rule applies. For | 75 // |embedding_url| pair or CONTENT_SETTING_DEFAULT, if no rule applies. For |
| 70 // ContentSettingsTypes that require a resource identifier to be specified, | 76 // ContentSettingsTypes that require a resource identifier to be specified, |
| 71 // the |resource_identifier| must be non-empty. | 77 // the |resource_identifier| must be non-empty. |
| 72 // | 78 // |
| 73 // This may be called on any thread. | 79 // This may be called on any thread. |
| 74 virtual ContentSetting GetContentSetting( | 80 virtual ContentSetting GetContentSetting( |
| 75 const GURL& requesting_url, | 81 const GURL& requesting_url, |
| 76 const GURL& embedding_url, | 82 const GURL& embedding_url, |
| 77 ContentSettingsType content_type, | 83 ContentSettingsType content_type, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 115 | 121 |
| 116 // Resets all content settings to CONTENT_SETTINGS_DEFAULT. | 122 // Resets all content settings to CONTENT_SETTINGS_DEFAULT. |
| 117 // | 123 // |
| 118 // This should only be called on the UI thread. | 124 // This should only be called on the UI thread. |
| 119 virtual void ResetToDefaults() = 0; | 125 virtual void ResetToDefaults() = 0; |
| 120 }; | 126 }; |
| 121 | 127 |
| 122 } // namespace content_settings | 128 } // namespace content_settings |
| 123 | 129 |
| 124 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_ | 130 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_ |
| OLD | NEW |