OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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. |
| 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_CONTENT_SETTINGS_CONTENT_SETTINGS_SERVICE_
H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_CONTENT_SETTINGS_CONTENT_SETTINGS_SERVICE_
H_ |
| 7 |
| 8 #include "base/memory/ref_counted.h" |
| 9 #include "extensions/browser/browser_context_keyed_api_factory.h" |
| 10 #include "extensions/browser/extension_prefs_observer.h" |
| 11 |
| 12 namespace extensions { |
| 13 |
| 14 class ContentSettingsStore; |
| 15 class ExtensionPrefs; |
| 16 |
| 17 // This service hosts a single ContentSettingsStore for the |
| 18 // chrome.contentSettings API. |
| 19 class ContentSettingsService : public BrowserContextKeyedAPI, |
| 20 public ExtensionPrefsObserver { |
| 21 public: |
| 22 explicit ContentSettingsService(content::BrowserContext* context); |
| 23 virtual ~ContentSettingsService(); |
| 24 |
| 25 scoped_refptr<ContentSettingsStore> content_settings_store() const { |
| 26 return content_settings_store_; |
| 27 } |
| 28 |
| 29 // Convenience function to get the service for some browser context. |
| 30 static ContentSettingsService* Get(content::BrowserContext* context); |
| 31 |
| 32 // BrowserContextKeyedAPI implementation. |
| 33 static BrowserContextKeyedAPIFactory<ContentSettingsService>* |
| 34 GetFactoryInstance(); |
| 35 |
| 36 // ExtensionPrefsObserver implementation. |
| 37 virtual void OnExtensionRegistered(const std::string& extension_id, |
| 38 const base::Time& install_time, |
| 39 bool is_enabled) OVERRIDE; |
| 40 virtual void OnExtensionPrefsLoaded(const std::string& extension_id, |
| 41 const ExtensionPrefs* prefs) OVERRIDE; |
| 42 virtual void OnExtensionPrefsDeleted(const std::string& extension_id) |
| 43 OVERRIDE; |
| 44 virtual void OnExtensionStateChanged(const std::string& extension_id, |
| 45 bool state) OVERRIDE; |
| 46 |
| 47 private: |
| 48 friend class BrowserContextKeyedAPIFactory<ContentSettingsService>; |
| 49 |
| 50 // BrowserContextKeyedAPI implementation. |
| 51 static const char* service_name() { return "ContentSettingsService"; } |
| 52 |
| 53 scoped_refptr<ContentSettingsStore> content_settings_store_; |
| 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(ContentSettingsService); |
| 56 }; |
| 57 |
| 58 } // namespace extensions |
| 59 |
| 60 #endif // CHROME_BROWSER_EXTENSIONS_API_CONTENT_SETTINGS_CONTENT_SETTINGS_SERVI
CE_H_ |
OLD | NEW |