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"
16 namespace extensions
{
18 class VirtualKeyboardPrivateInsertTextFunction
: public SyncExtensionFunction
{
20 DECLARE_EXTENSION_FUNCTION("virtualKeyboardPrivate.insertText",
21 VIRTUALKEYBOARDPRIVATE_INSERTTEXT
);
24 ~VirtualKeyboardPrivateInsertTextFunction() override
{}
27 bool RunSync() override
;
30 class VirtualKeyboardPrivateSendKeyEventFunction
31 : public SyncExtensionFunction
{
33 DECLARE_EXTENSION_FUNCTION("virtualKeyboardPrivate.sendKeyEvent",
34 VIRTUALKEYBOARDPRIVATE_SENDKEYEVENT
);
37 ~VirtualKeyboardPrivateSendKeyEventFunction() override
{}
40 bool RunSync() override
;
43 class VirtualKeyboardPrivateHideKeyboardFunction
44 : public SyncExtensionFunction
{
46 DECLARE_EXTENSION_FUNCTION("virtualKeyboardPrivate.hideKeyboard",
47 VIRTUALKEYBOARDPRIVATE_HIDEKEYBOARD
);
50 ~VirtualKeyboardPrivateHideKeyboardFunction() override
{}
53 bool RunSync() override
;
56 class VirtualKeyboardPrivateLockKeyboardFunction
57 : public SyncExtensionFunction
{
59 DECLARE_EXTENSION_FUNCTION("virtualKeyboardPrivate.lockKeyboard",
60 VIRTUALKEYBOARDPRIVATE_LOCKKEYBOARD
);
63 ~VirtualKeyboardPrivateLockKeyboardFunction() override
{}
66 bool RunSync() override
;
69 class VirtualKeyboardPrivateKeyboardLoadedFunction
70 : public SyncExtensionFunction
{
72 DECLARE_EXTENSION_FUNCTION("virtualKeyboardPrivate.keyboardLoaded",
73 VIRTUALKEYBOARDPRIVATE_KEYBOARDLOADED
);
76 ~VirtualKeyboardPrivateKeyboardLoadedFunction() override
{}
79 bool RunSync() override
;
82 class VirtualKeyboardPrivateGetKeyboardConfigFunction
83 : public SyncExtensionFunction
{
85 DECLARE_EXTENSION_FUNCTION("virtualKeyboardPrivate.getKeyboardConfig",
86 VIRTUALKEYBOARDPRIVATE_GETKEYBOARDCONFIG
);
89 ~VirtualKeyboardPrivateGetKeyboardConfigFunction() override
{}
92 bool RunSync() override
;
95 class VirtualKeyboardPrivateOpenSettingsFunction
96 : public SyncExtensionFunction
{
98 DECLARE_EXTENSION_FUNCTION("virtualKeyboardPrivate.openSettings",
99 VIRTUALKEYBOARDPRIVATE_OPENSETTINGS
);
102 ~VirtualKeyboardPrivateOpenSettingsFunction() override
{}
104 // ExtensionFunction:
105 bool RunSync() override
;
108 class VirtualKeyboardPrivateSetModeFunction
: public SyncExtensionFunction
{
110 DECLARE_EXTENSION_FUNCTION("virtualKeyboardPrivate.setMode",
111 VIRTUALKEYBOARDPRIVATE_SETMODE
);
114 ~VirtualKeyboardPrivateSetModeFunction() override
{}
116 // ExtensionFunction:
117 bool RunSync() override
;
120 class VirtualKeyboardDelegate
;
122 class VirtualKeyboardAPI
: public BrowserContextKeyedAPI
{
124 explicit VirtualKeyboardAPI(content::BrowserContext
* context
);
125 ~VirtualKeyboardAPI() override
;
127 // BrowserContextKeyedAPI implementation.
128 static BrowserContextKeyedAPIFactory
<VirtualKeyboardAPI
>*
129 GetFactoryInstance();
131 VirtualKeyboardDelegate
* delegate() { return delegate_
.get(); }
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_