| 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" |
| 11 #include "ui/keyboard/keyboard_export.h" | 11 #include "ui/keyboard/keyboard_export.h" |
| 12 | 12 |
| 13 namespace aura { | 13 namespace aura { |
| 14 class RootWindow; | 14 class RootWindow; |
| 15 } | 15 } |
| 16 struct GritResourceMap; | 16 struct GritResourceMap; |
| 17 | 17 |
| 18 namespace keyboard { | 18 namespace keyboard { |
| 19 | 19 |
| 20 // Returns true if the virtual keyboard is enabled. | 20 // Returns true if the virtual keyboard is enabled. |
| 21 KEYBOARD_EXPORT bool IsKeyboardEnabled(); | 21 KEYBOARD_EXPORT bool IsKeyboardEnabled(); |
| 22 | 22 |
| 23 // Insert |text| into the active TextInputClient associated with |root_window|, | 23 // Insert |text| into the active TextInputClient associated with |root_window|, |
| 24 // if there is one. Returns true if |text| was successfully inserted. Note | 24 // if there is one. Returns true if |text| was successfully inserted. Note |
| 25 // that this may convert |text| into ui::KeyEvents for injection in some | 25 // that this may convert |text| into ui::KeyEvents for injection in some |
| 26 // special circumstances (i.e. VKEY_RETURN, VKEY_BACK). | 26 // special circumstances (i.e. VKEY_RETURN, VKEY_BACK). |
| 27 KEYBOARD_EXPORT bool InsertText(const base::string16& text, | 27 KEYBOARD_EXPORT bool InsertText(const base::string16& text, |
| 28 aura::RootWindow* root_window); | 28 aura::RootWindow* root_window); |
| 29 | 29 |
| 30 // Get the list of keyboard resources. |size| is populated with the number of | 30 // Dispatches a fabricated key event, where |type| is the event type, and |
| 31 // |char_code| is the unicode value of the character. The event is dispatched |
| 32 // to the active TextInputClient associated with |root_window|. The type may be |
| 33 // "keyPressed" or "keyReleased". |
| 34 KEYBOARD_EXPORT bool DispatchKeyEvent(std::string type, |
| 35 int char_code, |
| 36 aura::RootWindow* root_window); |
| 37 |
| 38 // Get the list of keyboard resources. |size| is populated with the number of |
| 31 // resources in the returned array. | 39 // resources in the returned array. |
| 32 KEYBOARD_EXPORT const GritResourceMap* GetKeyboardExtensionResources( | 40 KEYBOARD_EXPORT const GritResourceMap* GetKeyboardExtensionResources( |
| 33 size_t* size); | 41 size_t* size); |
| 34 | 42 |
| 35 } // namespace keyboard | 43 } // namespace keyboard |
| 36 | 44 |
| 37 #endif // UI_KEYBOARD_KEYBOARD_UTIL_H_ | 45 #endif // UI_KEYBOARD_KEYBOARD_UTIL_H_ |
| OLD | NEW |