| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_CUSTOM_EXTENSION_PROVID
ER_H_ | 5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_CUSTOM_EXTENSION_PROVID
ER_H_ |
| 6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_CUSTOM_EXTENSION_PROVID
ER_H_ | 6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_CUSTOM_EXTENSION_PROVID
ER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "chrome/browser/extensions/api/content_settings/content_settings_store.
h" | 11 #include "chrome/browser/extensions/api/content_settings/content_settings_store.
h" |
| 12 #include "components/content_settings/core/browser/content_settings_observable_p
rovider.h" | 12 #include "components/content_settings/core/browser/content_settings_observable_p
rovider.h" |
| 13 | 13 |
| 14 namespace content_settings { | 14 namespace content_settings { |
| 15 | 15 |
| 16 // A content settings provider which manages settings defined by extensions. | 16 // A content settings provider which manages settings defined by extensions. |
| 17 class CustomExtensionProvider : public ObservableProvider, | 17 class CustomExtensionProvider : public ObservableProvider, |
| 18 public extensions::ContentSettingsStore::Observer { | 18 public extensions::ContentSettingsStore::Observer { |
| 19 public: | 19 public: |
| 20 CustomExtensionProvider(const scoped_refptr<extensions::ContentSettingsStore>& | 20 CustomExtensionProvider(const scoped_refptr<extensions::ContentSettingsStore>& |
| 21 extensions_settings, | 21 extensions_settings, |
| 22 bool incognito); | 22 bool incognito); |
| 23 | 23 |
| 24 virtual ~CustomExtensionProvider(); | 24 ~CustomExtensionProvider() override; |
| 25 | 25 |
| 26 // ProviderInterface methods: | 26 // ProviderInterface methods: |
| 27 virtual RuleIterator* GetRuleIterator( | 27 RuleIterator* GetRuleIterator(ContentSettingsType content_type, |
| 28 ContentSettingsType content_type, | 28 const ResourceIdentifier& resource_identifier, |
| 29 const ResourceIdentifier& resource_identifier, | 29 bool incognito) const override; |
| 30 bool incognito) const override; | |
| 31 | 30 |
| 32 virtual bool SetWebsiteSetting( | 31 bool SetWebsiteSetting(const ContentSettingsPattern& primary_pattern, |
| 33 const ContentSettingsPattern& primary_pattern, | 32 const ContentSettingsPattern& secondary_pattern, |
| 34 const ContentSettingsPattern& secondary_pattern, | 33 ContentSettingsType content_type, |
| 35 ContentSettingsType content_type, | 34 const ResourceIdentifier& resource_identifier, |
| 36 const ResourceIdentifier& resource_identifier, | 35 base::Value* value) override; |
| 37 base::Value* value) override; | |
| 38 | 36 |
| 39 virtual void ClearAllContentSettingsRules(ContentSettingsType content_type) | 37 void ClearAllContentSettingsRules(ContentSettingsType content_type) override { |
| 40 override {} | 38 } |
| 41 | 39 |
| 42 virtual void ShutdownOnUIThread() override; | 40 void ShutdownOnUIThread() override; |
| 43 | 41 |
| 44 // extensions::ContentSettingsStore::Observer methods: | 42 // extensions::ContentSettingsStore::Observer methods: |
| 45 virtual void OnContentSettingChanged(const std::string& extension_id, | 43 void OnContentSettingChanged(const std::string& extension_id, |
| 46 bool incognito) override; | 44 bool incognito) override; |
| 47 | 45 |
| 48 private: | 46 private: |
| 49 // Specifies whether this provider manages settings for incognito or regular | 47 // Specifies whether this provider manages settings for incognito or regular |
| 50 // sessions. | 48 // sessions. |
| 51 bool incognito_; | 49 bool incognito_; |
| 52 | 50 |
| 53 // The backend storing content setting rules defined by extensions. | 51 // The backend storing content setting rules defined by extensions. |
| 54 scoped_refptr<extensions::ContentSettingsStore> extensions_settings_; | 52 scoped_refptr<extensions::ContentSettingsStore> extensions_settings_; |
| 55 | 53 |
| 56 DISALLOW_COPY_AND_ASSIGN(CustomExtensionProvider); | 54 DISALLOW_COPY_AND_ASSIGN(CustomExtensionProvider); |
| 57 }; | 55 }; |
| 58 | 56 |
| 59 } // namespace content_settings | 57 } // namespace content_settings |
| 60 | 58 |
| 61 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_CUSTOM_EXTENSION_PRO
VIDER_H_ | 59 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_CUSTOM_EXTENSION_PRO
VIDER_H_ |
| OLD | NEW |