Index: components/content_settings/core/browser/website_settings_registry.h |
diff --git a/components/content_settings/core/browser/website_settings_registry.h b/components/content_settings/core/browser/website_settings_registry.h |
index a10f1b08ceeaa310e68626ae19500df312e27bc9..1f4ec47e9e4a9cc8b5cefda00fe65feed9c5b21d 100644 |
--- a/components/content_settings/core/browser/website_settings_registry.h |
+++ b/components/content_settings/core/browser/website_settings_registry.h |
@@ -25,6 +25,27 @@ namespace content_settings { |
// const. |
class WebsiteSettingsRegistry { |
public: |
+ typedef uint32_t Platforms; |
+ // TODO(lshang): Remove this enum when content settings can be registered from |
+ // within the component in which they are used. When this is possible then |
+ // ifdefs can be contained within each component. |
+ enum Platform : Platforms { |
+ PLATFORM_WINDOWS = 1 << 0, |
+ PLATFORM_LINUX = 1 << 1, |
+ PLATFORM_CHROMEOS = 1 << 2, |
+ PLATFORM_MAC = 1 << 3, |
+ PLATFORM_ANDROID = 1 << 4, |
+ PLATFORM_IOS = 1 << 5, |
+ |
+ // Settings only applied to win, mac, linux and chromeos. |
+ DESKTOP = |
+ PLATFORM_WINDOWS | PLATFORM_LINUX | PLATFORM_CHROMEOS | PLATFORM_MAC, |
+ |
+ // Settings applied to all platforms, including win, mac, linux, chromeos, |
+ // android, ios. |
+ ALL_PLATFORMS = DESKTOP | PLATFORM_ANDROID | PLATFORM_IOS, |
+ }; |
+ |
using Map = |
std::map<ContentSettingsType, std::unique_ptr<WebsiteSettingsInfo>>; |
using const_iterator = MapValueIterator<typename Map::const_iterator, |
@@ -41,6 +62,8 @@ class WebsiteSettingsRegistry { |
// Register a new website setting. This maps an origin to an arbitrary |
// base::Value. Returns a pointer to the registered WebsiteSettingsInfo which |
// is owned by the registry. |
+ // A nullptr will be returned if registration fails (for example if |
+ // |platforms| doesn't match the current platform). |
const WebsiteSettingsInfo* Register( |
ContentSettingsType type, |
const std::string& name, |
@@ -48,6 +71,7 @@ class WebsiteSettingsRegistry { |
WebsiteSettingsInfo::SyncStatus sync_status, |
WebsiteSettingsInfo::LossyStatus lossy_status, |
WebsiteSettingsInfo::ScopingType scoping_type, |
+ Platforms platforms, |
WebsiteSettingsInfo::IncognitoBehavior incognito_behavior); |
const_iterator begin() const; |