OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_KEYBOARD_KEYBOARD_UTIL_H_ | 5 #ifndef UI_KEYBOARD_KEYBOARD_UTIL_H_ |
6 #define UI_KEYBOARD_KEYBOARD_UTIL_H_ | 6 #define UI_KEYBOARD_KEYBOARD_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
| 10 #include "base/strings/string16.h" |
10 #include "ui/keyboard/keyboard_export.h" | 11 #include "ui/keyboard/keyboard_export.h" |
11 | 12 |
12 namespace base { | 13 namespace aura { |
13 class ListValue; | 14 class RootWindow; |
14 } | |
15 | |
16 namespace ui { | |
17 class KeyEvent; | |
18 } | 15 } |
19 | 16 |
20 namespace keyboard { | 17 namespace keyboard { |
21 | 18 |
22 // Returns true if the virtual keyboard is enabled. | 19 // Returns true if the virtual keyboard is enabled. |
23 KEYBOARD_EXPORT bool IsKeyboardEnabled(); | 20 KEYBOARD_EXPORT bool IsKeyboardEnabled(); |
24 | 21 |
25 // Creates a ui::KeyEvent from the argument base::ListValue that is passed to | 22 // Insert |text| into the active TextInputClient associated with |root_window|, |
26 // the synthetic input APIs (either the Extension API or the WebUI API). The | 23 // if there is one. Returns true if |text| was successfully inserted. Note |
27 // returned ui::KeyEvent is owned by the caller. If an error occurs, NULL is | 24 // that this may convert |text| into ui::KeyEvents for injection in some |
28 // returned and |error| will be populated with a description of the error. For | 25 // special circumstances (i.e. VKEY_RETURN, VKEY_BACK). |
29 // a description of the expected input, please see | 26 KEYBOARD_EXPORT bool InsertText(const base::string16& text, |
30 // chrome/common/extensions/api/experimental_input_virtual_keyboard.json | 27 aura::RootWindow* root_window); |
31 KEYBOARD_EXPORT ui::KeyEvent* KeyEventFromArgs(const base::ListValue* args, | |
32 std::string* error); | |
33 | 28 |
34 } // namespace keyboard | 29 } // namespace keyboard |
35 | 30 |
36 #endif // UI_KEYBOARD_KEYBOARD_UTIL_H_ | 31 #endif // UI_KEYBOARD_KEYBOARD_UTIL_H_ |
OLD | NEW |