Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / extensions / api / content_settings / content_settings_service.h
blob2b7b3e39aed5cd9a903cc377a2deb996fa0f3740
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.
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_CONTENT_SETTINGS_CONTENT_SETTINGS_SERVICE_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_CONTENT_SETTINGS_CONTENT_SETTINGS_SERVICE_H_
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"
12 namespace extensions {
14 class ContentSettingsStore;
15 class ExtensionPrefs;
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 ~ContentSettingsService() override;
25 scoped_refptr<ContentSettingsStore> content_settings_store() const {
26 return content_settings_store_;
29 // Convenience function to get the service for some browser context.
30 static ContentSettingsService* Get(content::BrowserContext* context);
32 // BrowserContextKeyedAPI implementation.
33 static BrowserContextKeyedAPIFactory<ContentSettingsService>*
34 GetFactoryInstance();
36 // ExtensionPrefsObserver implementation.
37 void OnExtensionRegistered(const std::string& extension_id,
38 const base::Time& install_time,
39 bool is_enabled) override;
40 void OnExtensionPrefsLoaded(const std::string& extension_id,
41 const ExtensionPrefs* prefs) override;
42 void OnExtensionPrefsDeleted(const std::string& extension_id) override;
43 void OnExtensionStateChanged(const std::string& extension_id,
44 bool state) override;
46 private:
47 friend class BrowserContextKeyedAPIFactory<ContentSettingsService>;
49 // BrowserContextKeyedAPI implementation.
50 static const char* service_name() { return "ContentSettingsService"; }
52 scoped_refptr<ContentSettingsStore> content_settings_store_;
54 DISALLOW_COPY_AND_ASSIGN(ContentSettingsService);
57 } // namespace extensions
59 #endif // CHROME_BROWSER_EXTENSIONS_API_CONTENT_SETTINGS_CONTENT_SETTINGS_SERVICE_H_