1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_CUSTOM_EXTENSION_PROVIDER_H_
6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_CUSTOM_EXTENSION_PROVIDER_H_
10 #include "base/memory/ref_counted.h"
11 #include "chrome/browser/content_settings/content_settings_observable_provider.h"
12 #include "chrome/browser/extensions/api/content_settings/content_settings_store.h"
14 namespace content_settings
{
16 // A content settings provider which manages settings defined by extensions.
17 class CustomExtensionProvider
: public ObservableProvider
,
18 public extensions::ContentSettingsStore::Observer
{
20 CustomExtensionProvider(
21 extensions::ContentSettingsStore
* extensions_settings
,
24 virtual ~CustomExtensionProvider();
26 // ProviderInterface methods:
27 virtual RuleIterator
* GetRuleIterator(
28 ContentSettingsType content_type
,
29 const ResourceIdentifier
& resource_identifier
,
30 bool incognito
) const OVERRIDE
;
32 virtual bool SetWebsiteSetting(
33 const ContentSettingsPattern
& primary_pattern
,
34 const ContentSettingsPattern
& secondary_pattern
,
35 ContentSettingsType content_type
,
36 const ResourceIdentifier
& resource_identifier
,
37 Value
* value
) OVERRIDE
;
39 virtual void ClearAllContentSettingsRules(ContentSettingsType content_type
)
42 virtual void ShutdownOnUIThread() OVERRIDE
;
44 // extensions::ContentSettingsStore::Observer methods:
45 virtual void OnContentSettingChanged(const std::string
& extension_id
,
46 bool incognito
) OVERRIDE
;
49 // Specifies whether this provider manages settings for incognito or regular
53 // The backend storing content setting rules defined by extensions.
54 scoped_refptr
<extensions::ContentSettingsStore
> extensions_settings_
;
56 DISALLOW_COPY_AND_ASSIGN(CustomExtensionProvider
);
59 } // namespace content_settings
61 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_CUSTOM_EXTENSION_PROVIDER_H_