| 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 #define NO_RESOURCE_IDENTIFIER "" | 11 #define NO_RESOURCE_IDENTIFIER "" |
| 12 | 12 |
| 13 #include <string> | 13 #include <string> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/values.h" |
| 16 #include "chrome/browser/content_settings/content_settings_pattern.h" | 17 #include "chrome/browser/content_settings/content_settings_pattern.h" |
| 17 #include "chrome/common/content_settings.h" | 18 #include "chrome/common/content_settings.h" |
| 18 | 19 |
| 19 class GURL; | 20 class GURL; |
| 20 | 21 |
| 21 namespace content_settings { | 22 namespace content_settings { |
| 22 | 23 |
| 23 typedef std::string ResourceIdentifier; | 24 typedef std::string ResourceIdentifier; |
| 24 | 25 |
| 25 class DefaultProviderInterface { | 26 class DefaultProviderInterface { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 // ContentSettingsTypes that require a resource identifier to be specified, | 69 // ContentSettingsTypes that require a resource identifier to be specified, |
| 69 // the |resource_identifier| must be non-empty. | 70 // the |resource_identifier| must be non-empty. |
| 70 // | 71 // |
| 71 // This may be called on any thread. | 72 // This may be called on any thread. |
| 72 virtual ContentSetting GetContentSetting( | 73 virtual ContentSetting GetContentSetting( |
| 73 const GURL& primary_url, | 74 const GURL& primary_url, |
| 74 const GURL& secondary_url, | 75 const GURL& secondary_url, |
| 75 ContentSettingsType content_type, | 76 ContentSettingsType content_type, |
| 76 const ResourceIdentifier& resource_identifier) const = 0; | 77 const ResourceIdentifier& resource_identifier) const = 0; |
| 77 | 78 |
| 79 // Returns the content setting |Value| for the given |content_type| which |
| 80 // applies to the given |primary_url|, |secondary_url| pair. The ownership of |
| 81 // the returned |Value| pointer is transfered to the caller. If no content |
| 82 // settings value is available for the given parameters then NULL is returned. |
| 83 // For ContentSettingsTypes that require a resource identifier to be |
| 84 // specified, the |resource_identifier| must be non-empty. |
| 85 // |
| 86 // This may be called on any thread. |
| 87 virtual Value* GetContentSettingValue( |
| 88 const GURL& primary_url, |
| 89 const GURL& secondary_url, |
| 90 ContentSettingsType content_type, |
| 91 const ResourceIdentifier& resource_identifier) const = 0; |
| 92 |
| 93 |
| 78 // Sets the content setting for a particular |primary_pattern|, | 94 // Sets the content setting for a particular |primary_pattern|, |
| 79 // |secondary_pattern|, |content_type| tuple. For ContentSettingsTypes that | 95 // |secondary_pattern|, |content_type| tuple. For ContentSettingsTypes that |
| 80 // require a resource identifier to be specified, the |resource_identifier| | 96 // require a resource identifier to be specified, the |resource_identifier| |
| 81 // must be non-empty. | 97 // must be non-empty. |
| 82 // | 98 // |
| 83 // This should only be called on the UI thread, and not after | 99 // This should only be called on the UI thread, and not after |
| 84 // ShutdownOnUIThread has been called. | 100 // ShutdownOnUIThread has been called. |
| 85 virtual void SetContentSetting( | 101 virtual void SetContentSetting( |
| 86 const ContentSettingsPattern& primary_pattern, | 102 const ContentSettingsPattern& primary_pattern, |
| 87 const ContentSettingsPattern& secondary_pattern, | 103 const ContentSettingsPattern& secondary_pattern, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 116 // Detaches the Provider from all Profile-related objects like PrefService. | 132 // Detaches the Provider from all Profile-related objects like PrefService. |
| 117 // This methods needs to be called before destroying the Profile. | 133 // This methods needs to be called before destroying the Profile. |
| 118 // Afterwards, none of the methods above that should only be called on the UI | 134 // Afterwards, none of the methods above that should only be called on the UI |
| 119 // thread should be called anymore. | 135 // thread should be called anymore. |
| 120 virtual void ShutdownOnUIThread() = 0; | 136 virtual void ShutdownOnUIThread() = 0; |
| 121 }; | 137 }; |
| 122 | 138 |
| 123 } // namespace content_settings | 139 } // namespace content_settings |
| 124 | 140 |
| 125 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_ | 141 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_PROVIDER_H_ |
| OLD | NEW |