Move virtualKeyboardPrivate API to src/extensions.
[chromium-blink-merge.git] / extensions / browser / api / virtual_keyboard_private / virtual_keyboard_private_api.h
blob26c4563c5664cfba4edffcc65115d36c0e6684f4
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 EXTENSIONS_BROWSER_API_VIRTUAL_KEYBOARD_PRIVATE_VIRTUAL_KEYBOARD_PRIVATE_API_H_
6 #define EXTENSIONS_BROWSER_API_VIRTUAL_KEYBOARD_PRIVATE_VIRTUAL_KEYBOARD_PRIVATE_API_H_
8 #include "base/compiler_specific.h"
9 #include "extensions/browser/browser_context_keyed_api_factory.h"
10 #include "extensions/browser/extension_function.h"
12 namespace content {
13 class BrowserContext;
16 namespace extensions {
18 class VirtualKeyboardPrivateInsertTextFunction : public SyncExtensionFunction {
19 public:
20 DECLARE_EXTENSION_FUNCTION("virtualKeyboardPrivate.insertText",
21 VIRTUALKEYBOARDPRIVATE_INSERTTEXT);
23 protected:
24 ~VirtualKeyboardPrivateInsertTextFunction() override {}
26 // ExtensionFunction:
27 bool RunSync() override;
30 class VirtualKeyboardPrivateMoveCursorFunction : public SyncExtensionFunction {
31 public:
32 DECLARE_EXTENSION_FUNCTION("virtualKeyboardPrivate.moveCursor",
33 VIRTUALKEYBOARDPRIVATE_MOVECURSOR);
35 protected:
36 ~VirtualKeyboardPrivateMoveCursorFunction() override {}
38 // ExtensionFunction.
39 bool RunSync() override;
42 class VirtualKeyboardPrivateSendKeyEventFunction
43 : public SyncExtensionFunction {
44 public:
45 DECLARE_EXTENSION_FUNCTION("virtualKeyboardPrivate.sendKeyEvent",
46 VIRTUALKEYBOARDPRIVATE_SENDKEYEVENT);
48 protected:
49 ~VirtualKeyboardPrivateSendKeyEventFunction() override {}
51 // ExtensionFunction:
52 bool RunSync() override;
55 class VirtualKeyboardPrivateHideKeyboardFunction
56 : public SyncExtensionFunction {
57 public:
58 DECLARE_EXTENSION_FUNCTION("virtualKeyboardPrivate.hideKeyboard",
59 VIRTUALKEYBOARDPRIVATE_HIDEKEYBOARD);
61 protected:
62 ~VirtualKeyboardPrivateHideKeyboardFunction() override {}
64 // ExtensionFunction:
65 bool RunSync() override;
68 class VirtualKeyboardPrivateLockKeyboardFunction
69 : public SyncExtensionFunction {
70 public:
71 DECLARE_EXTENSION_FUNCTION("virtualKeyboardPrivate.lockKeyboard",
72 VIRTUALKEYBOARDPRIVATE_LOCKKEYBOARD);
74 protected:
75 ~VirtualKeyboardPrivateLockKeyboardFunction() override {}
77 // ExtensionFunction:
78 bool RunSync() override;
81 class VirtualKeyboardPrivateKeyboardLoadedFunction
82 : public SyncExtensionFunction {
83 public:
84 DECLARE_EXTENSION_FUNCTION("virtualKeyboardPrivate.keyboardLoaded",
85 VIRTUALKEYBOARDPRIVATE_KEYBOARDLOADED);
87 protected:
88 ~VirtualKeyboardPrivateKeyboardLoadedFunction() override {}
90 // ExtensionFunction:
91 bool RunSync() override;
94 class VirtualKeyboardPrivateGetKeyboardConfigFunction
95 : public SyncExtensionFunction {
96 public:
97 DECLARE_EXTENSION_FUNCTION("virtualKeyboardPrivate.getKeyboardConfig",
98 VIRTUALKEYBOARDPRIVATE_GETKEYBOARDCONFIG);
100 protected:
101 ~VirtualKeyboardPrivateGetKeyboardConfigFunction() override {}
103 // ExtensionFunction:
104 bool RunSync() override;
107 class VirtualKeyboardPrivateOpenSettingsFunction
108 : public SyncExtensionFunction {
109 public:
110 DECLARE_EXTENSION_FUNCTION("virtualKeyboardPrivate.openSettings",
111 VIRTUALKEYBOARDPRIVATE_OPENSETTINGS);
113 protected:
114 ~VirtualKeyboardPrivateOpenSettingsFunction() override {}
116 // ExtensionFunction:
117 bool RunSync() override;
120 class VirtualKeyboardDelegate;
122 class VirtualKeyboardAPI : public BrowserContextKeyedAPI {
123 public:
124 explicit VirtualKeyboardAPI(content::BrowserContext* context);
125 ~VirtualKeyboardAPI() override;
127 // BrowserContextKeyedAPI implementation.
128 static BrowserContextKeyedAPIFactory<VirtualKeyboardAPI>*
129 GetFactoryInstance();
131 VirtualKeyboardDelegate* delegate() { return delegate_.get(); }
133 private:
134 friend class BrowserContextKeyedAPIFactory<VirtualKeyboardAPI>;
136 // BrowserContextKeyedAPI implementation.
137 static const char* service_name() { return "VirtualKeyboardAPI"; }
139 // Require accces to delegate while incognito or during login.
140 static const bool kServiceHasOwnInstanceInIncognito = true;
142 scoped_ptr<VirtualKeyboardDelegate> delegate_;
145 } // namespace extensions
147 #endif // EXTENSIONS_BROWSER_API_VIRTUAL_KEYBOARD_PRIVATE_VIRTUAL_KEYBOARD_PRIVATE_API_H_