| 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 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_EXTENSION_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_EXTENSION_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_EXTENSION_PROVIDER_H_ | 6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_EXTENSION_PROVIDER_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/content_settings/content_settings_provider.h" | 8 #include "chrome/browser/content_settings/content_settings_provider.h" |
| 9 #include "chrome/browser/extensions/extension_content_settings_store.h" | 9 #include "chrome/browser/extensions/extension_content_settings_store.h" |
| 10 #include "content/common/notification_details.h" | |
| 11 | 10 |
| 12 class ContentSettingsDetails; | 11 class ContentSettingsDetails; |
| 13 class Profile; | 12 class Profile; |
| 14 | 13 |
| 15 namespace content_settings { | 14 namespace content_settings { |
| 16 | 15 |
| 17 // A content settings provider which uses settings defined by extensions. | 16 // A content settings provider which uses settings defined by extensions. |
| 18 class ExtensionProvider : public ProviderInterface, | 17 class ExtensionProvider : public ProviderInterface, |
| 19 public ExtensionContentSettingsStore::Observer { | 18 public ExtensionContentSettingsStore::Observer { |
| 20 public: | 19 public: |
| (...skipping 17 matching lines...) Expand all Loading... |
| 38 const ResourceIdentifier& resource_identifier, | 37 const ResourceIdentifier& resource_identifier, |
| 39 ContentSetting content_setting) {} | 38 ContentSetting content_setting) {} |
| 40 | 39 |
| 41 // TODO(markusheintz): The UI needs a way to discover that these rules are | 40 // TODO(markusheintz): The UI needs a way to discover that these rules are |
| 42 // managed by an extension. | 41 // managed by an extension. |
| 43 virtual void GetAllContentSettingsRules( | 42 virtual void GetAllContentSettingsRules( |
| 44 ContentSettingsType content_type, | 43 ContentSettingsType content_type, |
| 45 const ResourceIdentifier& resource_identifier, | 44 const ResourceIdentifier& resource_identifier, |
| 46 Rules* content_setting_rules) const; | 45 Rules* content_setting_rules) const; |
| 47 | 46 |
| 48 virtual void ClearAllContentSettingsRules( | 47 virtual void ClearAllContentSettingsRules(ContentSettingsType content_type) {} |
| 49 ContentSettingsType content_type) {} | |
| 50 | 48 |
| 51 virtual void ResetToDefaults() {} | 49 virtual void ResetToDefaults() {} |
| 52 | 50 |
| 53 // ExtensionContentSettingsStore::Observer methods: | 51 // ExtensionContentSettingsStore::Observer methods: |
| 54 virtual void OnContentSettingChanged(const std::string& extension_id, | 52 virtual void OnContentSettingChanged(const std::string& extension_id, |
| 55 bool incognito); | 53 bool incognito); |
| 56 | 54 |
| 57 virtual void OnDestruction(); | 55 virtual void OnDestruction(); |
| 58 | 56 |
| 59 private: | 57 private: |
| 60 void NotifyObservers(const ContentSettingsDetails& details); | 58 void NotifyObservers(const ContentSettingsDetails& details); |
| 61 | 59 |
| 62 // TODO(markusheintz): That's only needed to send Notifications about changed | 60 // TODO(markusheintz): That's only needed to send Notifications about changed |
| 63 // ContentSettings. This will be changed for all ContentSettingsProviders. | 61 // ContentSettings. This will be changed for all ContentSettingsProviders. |
| 64 // The HCSM will become an Observer of the ContentSettings Provider and send | 62 // The HCSM will become an Observer of the ContentSettings Provider and send |
| 65 // out the Notifications itself. | 63 // out the Notifications itself. |
| 66 Profile* profile_; | 64 Profile* profile_; |
| 67 | 65 |
| 68 bool incognito_; | 66 bool incognito_; |
| 69 | 67 |
| 70 ExtensionContentSettingsStore* extensions_settings_; // Weak Pointer | 68 ExtensionContentSettingsStore* extensions_settings_; // Weak Pointer |
| 71 | 69 |
| 72 DISALLOW_COPY_AND_ASSIGN(ExtensionProvider); | 70 DISALLOW_COPY_AND_ASSIGN(ExtensionProvider); |
| 73 }; | 71 }; |
| 74 | 72 |
| 75 } // namespace content_settings | 73 } // namespace content_settings |
| 76 | 74 |
| 77 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_EXTENSION_PROVIDER_H
_ | 75 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_EXTENSION_PROVIDER_H
_ |
| OLD | NEW |