ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / components / content_settings / core / browser / content_settings_provider.h
bloba51ed5246ac231a059940194ed74b710fa4814ec
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
3 // found in the LICENSE file.
5 // Interface for objects providing content setting rules.
7 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_PROVIDER_H_
8 #define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_PROVIDER_H_
10 #define NO_RESOURCE_IDENTIFIER std::string()
12 #include <string>
14 #include "base/values.h"
15 #include "components/content_settings/core/common/content_settings_types.h"
17 class ContentSettingsPattern;
19 namespace content_settings {
21 struct Rule;
22 class RuleIterator;
24 typedef std::string ResourceIdentifier;
26 class ProviderInterface {
27 public:
28 virtual ~ProviderInterface() {}
30 // Returns a |RuleIterator| over the content setting rules stored by this
31 // provider. If |incognito| is true, the iterator returns only the content
32 // settings which are applicable to the incognito mode and differ from the
33 // normal mode. Otherwise, it returns the content settings for the normal
34 // mode. The caller takes the ownership of the returned |RuleIterator|. It is
35 // not allowed to call other |ProviderInterface| functions (including
36 // |GetRuleIterator|) for the same provider until the |RuleIterator| is
37 // destroyed.
38 virtual RuleIterator* GetRuleIterator(
39 ContentSettingsType content_type,
40 const ResourceIdentifier& resource_identifier,
41 bool incognito) const = 0;
43 // Asks the provider to set the website setting for a particular
44 // |primary_pattern|, |secondary_pattern|, |content_type| tuple. If the
45 // provider accepts the setting it returns true and takes the ownership of the
46 // |value|. Otherwise false is returned and the ownership of the |value| stays
47 // with the caller.
49 // This should only be called on the UI thread, and not after
50 // ShutdownOnUIThread has been called.
51 virtual bool SetWebsiteSetting(
52 const ContentSettingsPattern& primary_pattern,
53 const ContentSettingsPattern& secondary_pattern,
54 ContentSettingsType content_type,
55 const ResourceIdentifier& resource_identifier,
56 base::Value* value) = 0;
58 // Resets all content settings for the given |content_type| and empty resource
59 // identifier to CONTENT_SETTING_DEFAULT.
61 // This should only be called on the UI thread, and not after
62 // ShutdownOnUIThread has been called.
63 virtual void ClearAllContentSettingsRules(
64 ContentSettingsType content_type) = 0;
66 // Detaches the Provider from all Profile-related objects like PrefService.
67 // This methods needs to be called before destroying the Profile.
68 // Afterwards, none of the methods above that should only be called on the UI
69 // thread should be called anymore.
70 virtual void ShutdownOnUIThread() = 0;
73 } // namespace content_settings
75 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_PROVIDER_H_