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 "base/strings/string16.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 kCursorMoveRight = 0x01, | 22 kCursorMoveRight = 0x01, |
23 kCursorMoveLeft = 0x02, | 23 kCursorMoveLeft = 0x02, |
24 kCursorMoveUp = 0x04, | 24 kCursorMoveUp = 0x04, |
25 kCursorMoveDown = 0x08 | 25 kCursorMoveDown = 0x08 |
26 }; | 26 }; |
27 | 27 |
28 // Returns true if the virtual keyboard is enabled. | 28 // Returns true if the virtual keyboard is enabled. |
29 KEYBOARD_EXPORT bool IsKeyboardEnabled(); | 29 KEYBOARD_EXPORT bool IsKeyboardEnabled(); |
30 | 30 |
31 // Insert |text| into the active TextInputClient associated with |root_window|, | 31 // Insert |text| into the active TextInputClient associated with |root_window|, |
32 // if there is one. Returns true if |text| was successfully inserted. Note | 32 // if there is one. Returns true if |text| was successfully inserted. Note |
33 // that this may convert |text| into ui::KeyEvents for injection in some | 33 // that this may convert |text| into ui::KeyEvents for injection in some |
34 // special circumstances (i.e. VKEY_RETURN, VKEY_BACK). | 34 // special circumstances (i.e. VKEY_RETURN, VKEY_BACK). |
35 KEYBOARD_EXPORT bool InsertText(const base::string16& text, | 35 KEYBOARD_EXPORT bool InsertText(const base::string16& text, |
36 aura::RootWindow* root_window); | 36 aura::RootWindow* root_window); |
37 | 37 |
38 // Move cursor when swipe on the virtualkeyboard. Returns true if cursor was | 38 // Move cursor when swipe on the virtualkeyboard. Returns true if cursor was |
39 // successfully moved according to |swipe_direction|. | 39 // successfully moved according to |swipe_direction|. |
40 KEYBOARD_EXPORT bool MoveCursor(int swipe_direction, | 40 KEYBOARD_EXPORT bool MoveCursor(int swipe_direction, |
41 int modifier_flags, | 41 int modifier_flags, |
42 aura::RootWindow* root_window); | 42 aura::RootWindow* root_window); |
43 | 43 |
44 // Get the list of keyboard resources. |size| is populated with the number of | 44 // Sends a fabricated key event, where |type| is the event type, |key_value| |
| 45 // is the unicode value of the character, |key_code| is the legacy key code |
| 46 // value, and |shift_modifier| indicates if the shift key is being virtually |
| 47 // pressed. The event is dispatched to the active TextInputClient associated |
| 48 // with |root_window|. The type may be "keydown" or "keyup". |
| 49 KEYBOARD_EXPORT bool SendKeyEvent(std::string type, |
| 50 int key_value, |
| 51 int key_code, |
| 52 bool shift_modifier, |
| 53 aura::RootWindow* root_window); |
| 54 |
| 55 // Get the list of keyboard resources. |size| is populated with the number of |
45 // resources in the returned array. | 56 // resources in the returned array. |
46 KEYBOARD_EXPORT const GritResourceMap* GetKeyboardExtensionResources( | 57 KEYBOARD_EXPORT const GritResourceMap* GetKeyboardExtensionResources( |
47 size_t* size); | 58 size_t* size); |
48 | 59 |
49 } // namespace keyboard | 60 } // namespace keyboard |
50 | 61 |
51 #endif // UI_KEYBOARD_KEYBOARD_UTIL_H_ | 62 #endif // UI_KEYBOARD_KEYBOARD_UTIL_H_ |
OLD | NEW |