1 // Copyright 2012 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. 4 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_INPUT_INPUT_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_INPUT_INPUT_H_ 7 8 #include "base/compiler_specific.h" 9 #include "extensions/browser/browser_context_keyed_api_factory.h" 10 #include "extensions/browser/extension_function.h" 11 12 namespace content { 13 class BrowserContext; 14 } 15 16 namespace extensions { 17 18 class VirtualKeyboardPrivateInsertTextFunction : public SyncExtensionFunction { 19 public: 20 DECLARE_EXTENSION_FUNCTION("virtualKeyboardPrivate.insertText", 21 VIRTUALKEYBOARDPRIVATE_INSERTTEXT); 22 23 protected: 24 virtual ~VirtualKeyboardPrivateInsertTextFunction() {} 25 26 // ExtensionFunction: 27 virtual bool RunSync() OVERRIDE; 28 }; 29 30 class VirtualKeyboardPrivateMoveCursorFunction : public SyncExtensionFunction { 31 public: 32 DECLARE_EXTENSION_FUNCTION("virtualKeyboardPrivate.moveCursor", 33 VIRTUALKEYBOARDPRIVATE_MOVECURSOR); 34 35 protected: 36 virtual ~VirtualKeyboardPrivateMoveCursorFunction() {} 37 38 // ExtensionFunction. 39 virtual bool RunSync() OVERRIDE; 40 }; 41 42 class VirtualKeyboardPrivateSendKeyEventFunction 43 : public SyncExtensionFunction { 44 public: 45 DECLARE_EXTENSION_FUNCTION( 46 "virtualKeyboardPrivate.sendKeyEvent", 47 VIRTUALKEYBOARDPRIVATE_SENDKEYEVENT); 48 49 protected: 50 virtual ~VirtualKeyboardPrivateSendKeyEventFunction() {} 51 52 // ExtensionFunction: 53 virtual bool RunSync() OVERRIDE; 54 }; 55 56 class VirtualKeyboardPrivateHideKeyboardFunction 57 : public SyncExtensionFunction { 58 public: 59 DECLARE_EXTENSION_FUNCTION( 60 "virtualKeyboardPrivate.hideKeyboard", 61 VIRTUALKEYBOARDPRIVATE_HIDEKEYBOARD); 62 63 protected: 64 virtual ~VirtualKeyboardPrivateHideKeyboardFunction() {} 65 66 // ExtensionFunction: 67 virtual bool RunSync() OVERRIDE; 68 }; 69 70 class VirtualKeyboardPrivateLockKeyboardFunction 71 : public SyncExtensionFunction { 72 public: 73 DECLARE_EXTENSION_FUNCTION( 74 "virtualKeyboardPrivate.lockKeyboard", 75 VIRTUALKEYBOARDPRIVATE_LOCKKEYBOARD); 76 77 protected: 78 virtual ~VirtualKeyboardPrivateLockKeyboardFunction() {} 79 80 // ExtensionFunction: 81 virtual bool RunSync() OVERRIDE; 82 }; 83 84 class VirtualKeyboardPrivateKeyboardLoadedFunction 85 : public SyncExtensionFunction { 86 public: 87 DECLARE_EXTENSION_FUNCTION( 88 "virtualKeyboardPrivate.keyboardLoaded", 89 VIRTUALKEYBOARDPRIVATE_KEYBOARDLOADED); 90 91 protected: 92 virtual ~VirtualKeyboardPrivateKeyboardLoadedFunction() {} 93 94 // ExtensionFunction: 95 virtual bool RunSync() OVERRIDE; 96 }; 97 98 class VirtualKeyboardPrivateGetKeyboardConfigFunction 99 : public SyncExtensionFunction { 100 public: 101 DECLARE_EXTENSION_FUNCTION( 102 "virtualKeyboardPrivate.getKeyboardConfig", 103 VIRTUALKEYBOARDPRIVATE_GETKEYBOARDCONFIG); 104 105 protected: 106 virtual ~VirtualKeyboardPrivateGetKeyboardConfigFunction() {} 107 108 // ExtensionFunction: 109 virtual bool RunSync() OVERRIDE; 110 }; 111 112 class VirtualKeyboardPrivateOpenSettingsFunction 113 : public SyncExtensionFunction { 114 public: 115 DECLARE_EXTENSION_FUNCTION("virtualKeyboardPrivate.openSettings", 116 VIRTUALKEYBOARDPRIVATE_OPENSETTINGS); 117 118 protected: 119 virtual ~VirtualKeyboardPrivateOpenSettingsFunction() {} 120 121 // ExtensionFunction: 122 virtual bool RunSync() OVERRIDE; 123 }; 124 125 126 class InputAPI : public BrowserContextKeyedAPI { 127 public: 128 explicit InputAPI(content::BrowserContext* context); 129 virtual ~InputAPI(); 130 131 // BrowserContextKeyedAPI implementation. 132 static BrowserContextKeyedAPIFactory<InputAPI>* GetFactoryInstance(); 133 134 private: 135 friend class BrowserContextKeyedAPIFactory<InputAPI>; 136 137 // BrowserContextKeyedAPI implementation. 138 static const char* service_name() { 139 return "InputAPI"; 140 } 141 static const bool kServiceIsNULLWhileTesting = true; 142 }; 143 144 } // namespace extensions 145 146 #endif // CHROME_BROWSER_EXTENSIONS_API_INPUT_INPUT_H_ 147