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>* | |
| 33 GetFactoryInstance(); | |
| 34 | |
| 35 // ExtensionPrefs::Observer implementation | |
|
James Cook
2014/04/01 22:09:37
nit: either end this one with "." or remove it fro
Ken Rockot(use gerrit already)
2014/04/01 22:41:37
Done.
| |
| 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"; } | |
|
James Cook
2014/04/01 22:09:37
optional style nit: I might just stick this next t
Ken Rockot(use gerrit already)
2014/04/01 22:41:37
I don't see any fundamental reason for service_nam
| |
| 51 | |
| 52 scoped_refptr<ContentSettingsStore> content_settings_store_; | |
| 53 | |
| 54 DISALLOW_COPY_AND_ASSIGN(ContentSettingsService); | |
| 55 }; | |
| 56 | |
| 57 } // namespace extensions | |
| 58 | |
| 59 #endif // CHROME_BROWSER_EXTENSIONS_API_CONTENT_SETTINGS_CONTENT_SETTINGS_SERVI CE_H_ | |
| OLD | NEW |