Finish refactoring of DomCodeToUsLayoutKeyboardCode().
[chromium-blink-merge.git] / extensions / browser / api / virtual_keyboard_private / virtual_keyboard_private_api.h
blob7aeeac7ea76f2feb96608170923781c617bcd966
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 VirtualKeyboardPrivateSendKeyEventFunction
31 : public SyncExtensionFunction {
32 public:
33 DECLARE_EXTENSION_FUNCTION("virtualKeyboardPrivate.sendKeyEvent",
34 VIRTUALKEYBOARDPRIVATE_SENDKEYEVENT);
36 protected:
37 ~VirtualKeyboardPrivateSendKeyEventFunction() override {}
39 // ExtensionFunction:
40 bool RunSync() override;
43 class VirtualKeyboardPrivateHideKeyboardFunction
44 : public SyncExtensionFunction {
45 public:
46 DECLARE_EXTENSION_FUNCTION("virtualKeyboardPrivate.hideKeyboard",
47 VIRTUALKEYBOARDPRIVATE_HIDEKEYBOARD);
49 protected:
50 ~VirtualKeyboardPrivateHideKeyboardFunction() override {}
52 // ExtensionFunction:
53 bool RunSync() override;
56 class VirtualKeyboardPrivateLockKeyboardFunction
57 : public SyncExtensionFunction {
58 public:
59 DECLARE_EXTENSION_FUNCTION("virtualKeyboardPrivate.lockKeyboard",
60 VIRTUALKEYBOARDPRIVATE_LOCKKEYBOARD);
62 protected:
63 ~VirtualKeyboardPrivateLockKeyboardFunction() override {}
65 // ExtensionFunction:
66 bool RunSync() override;
69 class VirtualKeyboardPrivateKeyboardLoadedFunction
70 : public SyncExtensionFunction {
71 public:
72 DECLARE_EXTENSION_FUNCTION("virtualKeyboardPrivate.keyboardLoaded",
73 VIRTUALKEYBOARDPRIVATE_KEYBOARDLOADED);
75 protected:
76 ~VirtualKeyboardPrivateKeyboardLoadedFunction() override {}
78 // ExtensionFunction:
79 bool RunSync() override;
82 class VirtualKeyboardPrivateGetKeyboardConfigFunction
83 : public SyncExtensionFunction {
84 public:
85 DECLARE_EXTENSION_FUNCTION("virtualKeyboardPrivate.getKeyboardConfig",
86 VIRTUALKEYBOARDPRIVATE_GETKEYBOARDCONFIG);
88 protected:
89 ~VirtualKeyboardPrivateGetKeyboardConfigFunction() override {}
91 // ExtensionFunction:
92 bool RunSync() override;
95 class VirtualKeyboardPrivateOpenSettingsFunction
96 : public SyncExtensionFunction {
97 public:
98 DECLARE_EXTENSION_FUNCTION("virtualKeyboardPrivate.openSettings",
99 VIRTUALKEYBOARDPRIVATE_OPENSETTINGS);
101 protected:
102 ~VirtualKeyboardPrivateOpenSettingsFunction() override {}
104 // ExtensionFunction:
105 bool RunSync() override;
108 class VirtualKeyboardPrivateSetModeFunction : public SyncExtensionFunction {
109 public:
110 DECLARE_EXTENSION_FUNCTION("virtualKeyboardPrivate.setMode",
111 VIRTUALKEYBOARDPRIVATE_SETMODE);
113 protected:
114 ~VirtualKeyboardPrivateSetModeFunction() 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_