Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / extensions / api / preference / chrome_direct_setting_api.h
blob5fe14863e8bf4173c5309a2a926c2a414406183c
1 // Copyright 2013 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_PREFERENCE_CHROME_DIRECT_SETTING_API_H__
6 #define CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_CHROME_DIRECT_SETTING_API_H__
8 #include "base/prefs/pref_change_registrar.h"
9 #include "extensions/browser/browser_context_keyed_api_factory.h"
10 #include "extensions/browser/event_router.h"
12 class Profile;
14 namespace content {
15 class BrowserContext;
18 namespace extensions {
19 namespace chromedirectsetting {
21 class ChromeDirectSettingAPI : public BrowserContextKeyedAPI,
22 public EventRouter::Observer {
23 public:
24 explicit ChromeDirectSettingAPI(content::BrowserContext* context);
26 ~ChromeDirectSettingAPI() override;
28 // KeyedService implementation.
29 void Shutdown() override;
31 // BrowserContextKeyedAPI implementation.
32 static BrowserContextKeyedAPIFactory<ChromeDirectSettingAPI>*
33 GetFactoryInstance();
35 // EventRouter::Observer implementation.
36 void OnListenerAdded(const EventListenerInfo& details) override;
38 // Returns true if the preference is on the whitelist.
39 bool IsPreferenceOnWhitelist(const std::string& pref_key);
41 // Convenience method to get the ChromeDirectSettingAPI for a profile.
42 static ChromeDirectSettingAPI* Get(content::BrowserContext* context);
44 private:
45 friend class BrowserContextKeyedAPIFactory<ChromeDirectSettingAPI>;
47 // BrowserContextKeyedAPI implementation.
48 static const char* service_name();
50 void OnPrefChanged(PrefService* pref_service, const std::string& pref_key);
52 static const bool kServiceIsNULLWhileTesting = true;
53 static const bool kServiceRedirectedInIncognito = false;
55 PrefChangeRegistrar registrar_;
56 Profile* profile_;
58 DISALLOW_COPY_AND_ASSIGN(ChromeDirectSettingAPI);
61 } // namespace chromedirectsetting
62 } // namespace extensions
64 #endif // CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_CHROME_DIRECT_SETTING_API_H__