Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / extensions / api / preference / chrome_direct_setting.h
blobf1ae69131453441c31317bab8f8a5e0657d828d1
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_H__
6 #define CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_CHROME_DIRECT_SETTING_H__
8 #include "base/lazy_instance.h"
9 #include "chrome/browser/extensions/chrome_extension_function.h"
11 class PrefService;
13 namespace extensions {
14 namespace chromedirectsetting {
16 // Base class to host instance method helpers.
17 class DirectSettingFunctionBase : public ChromeSyncExtensionFunction {
18 protected:
19 DirectSettingFunctionBase();
20 ~DirectSettingFunctionBase() override;
22 // Returns the user pref service.
23 PrefService* GetPrefService();
25 // Returns true if the caller is a component extension.
26 bool IsCalledFromComponentExtension();
28 private:
29 DISALLOW_COPY_AND_ASSIGN(DirectSettingFunctionBase);
32 class GetDirectSettingFunction : public DirectSettingFunctionBase {
33 public:
34 DECLARE_EXTENSION_FUNCTION("types.private.ChromeDirectSetting.get",
35 TYPES_PRIVATE_CHROMEDIRECTSETTING_GET)
37 GetDirectSettingFunction();
39 protected:
40 // ExtensionFunction:
41 bool RunSync() override;
43 private:
44 ~GetDirectSettingFunction() override;
45 DISALLOW_COPY_AND_ASSIGN(GetDirectSettingFunction);
48 class SetDirectSettingFunction : public DirectSettingFunctionBase {
49 public:
50 DECLARE_EXTENSION_FUNCTION("types.private.ChromeDirectSetting.set",
51 TYPES_PRIVATE_CHROMEDIRECTSETTING_SET)
53 SetDirectSettingFunction();
55 protected:
56 // ExtensionFunction:
57 bool RunSync() override;
59 private:
60 ~SetDirectSettingFunction() override;
61 DISALLOW_COPY_AND_ASSIGN(SetDirectSettingFunction);
64 class ClearDirectSettingFunction : public DirectSettingFunctionBase {
65 public:
66 DECLARE_EXTENSION_FUNCTION("types.private.ChromeDirectSetting.clear",
67 TYPES_PRIVATE_CHROMEDIRECTSETTING_CLEAR)
69 ClearDirectSettingFunction();
71 protected:
72 // ExtensionFunction:
73 bool RunSync() override;
75 private:
76 ~ClearDirectSettingFunction() override;
77 DISALLOW_COPY_AND_ASSIGN(ClearDirectSettingFunction);
80 } // namespace chromedirectsetting
81 } // namespace extensions
83 #endif // CHROME_BROWSER_EXTENSIONS_API_PREFERENCE_CHROME_DIRECT_SETTING_H__