Chromium Code Reviews| 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.h" | |
| 11 | |
| 12 namespace extensions { | |
| 13 | |
| 14 class ContentSettingsStore; | |
| 15 | |
| 16 // This service hosts a single ContentSettingsStore for the | |
| 17 // chrome.contentSettings API. | |
| 18 class ContentSettingsService : public BrowserContextKeyedAPI, | |
| 19 public ExtensionPrefs::Observer { | |
| 20 public: | |
| 21 explicit ContentSettingsService(content::BrowserContext* context); | |
| 22 virtual ~ContentSettingsService(); | |
| 23 | |
| 24 scoped_refptr<ContentSettingsStore> content_settings_store() const { | |
| 25 return content_settings_store_; | |
| 26 } | |
| 27 | |
| 28 // Convenience function to get the service for some browser context. | |
| 29 static ContentSettingsService* Get(content::BrowserContext* context); | |
| 30 | |
| 31 // BrowserContextKeyedAPI implementation. | |
| 32 static BrowserContextKeyedAPIFactory<ContentSettingsService>* | |
|
James Cook
2014/04/01 18:45:03
Can this go in the private section below?
Ken Rockot(use gerrit already)
2014/04/01 21:34:59
Is this comment on the right line? GetFactoryInsta
| |
| 33 GetFactoryInstance(); | |
| 34 | |
| 35 // ExtensionPrefs::Observer implementation | |
| 36 virtual void OnExtensionRegistered(const std::string& extension_id, | |
| 37 const base::Time& install_time, | |
| 38 bool is_enabled) OVERRIDE; | |
| 39 virtual void OnExtensionPrefsLoaded(const std::string& extension_id, | |
| 40 const ExtensionPrefs* prefs) OVERRIDE; | |
| 41 virtual void OnExtensionPrefsDeleted(const std::string& extension_id) | |
| 42 OVERRIDE; | |
| 43 virtual void OnExtensionStateChanged(const std::string& extension_id, | |
| 44 bool state) OVERRIDE; | |
| 45 | |
| 46 private: | |
| 47 friend class BrowserContextKeyedAPIFactory<ContentSettingsService>; | |
| 48 | |
| 49 // BrowserContextKeyedAPI implementation. | |
| 50 static const char* service_name() { return "ContentSettingsService"; } | |
| 51 static const bool kServiceHasOwnInstanceInIncognito = true; | |
|
James Cook
2014/04/01 18:45:03
Are you sure this is right? It looks like Extensio
Ken Rockot(use gerrit already)
2014/04/01 21:34:59
You're right. Fixed.
| |
| 52 static const bool kServiceIsNULLWhileTesting = false; | |
| 53 | |
| 54 scoped_refptr<ContentSettingsStore> content_settings_store_; | |
| 55 | |
| 56 DISALLOW_COPY_AND_ASSIGN(ContentSettingsService); | |
| 57 }; | |
| 58 | |
| 59 template <> | |
| 60 void BrowserContextKeyedAPIFactory< | |
| 61 ContentSettingsService>::DeclareFactoryDependencies(); | |
| 62 | |
| 63 } // namespace extensions | |
| 64 | |
| 65 #endif // CHROME_BROWSER_EXTENSIONS_API_CONTENT_SETTINGS_CONTENT_SETTINGS_SERVI CE_H_ | |
| OLD | NEW |