Home | History | Annotate | Download | only in keyboard
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef UI_KEYBOARD_KEYBOARD_UTIL_H_
      6 #define UI_KEYBOARD_KEYBOARD_UTIL_H_
      7 
      8 #include <string>
      9 
     10 #include "base/strings/string16.h"
     11 #include "ui/keyboard/keyboard_export.h"
     12 
     13 namespace aura {
     14 class RootWindow;
     15 }
     16 struct GritResourceMap;
     17 
     18 namespace keyboard {
     19 
     20 // Enumeration of swipe directions.
     21 enum CursorMoveDirection {
     22   kCursorMoveRight = 0x01,
     23   kCursorMoveLeft = 0x02,
     24   kCursorMoveUp = 0x04,
     25   kCursorMoveDown = 0x08
     26 };
     27 
     28 // Returns true if the virtual keyboard is enabled.
     29 KEYBOARD_EXPORT bool IsKeyboardEnabled();
     30 
     31 // Insert |text| into the active TextInputClient associated with |root_window|,
     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
     34 // special circumstances (i.e. VKEY_RETURN, VKEY_BACK).
     35 KEYBOARD_EXPORT bool InsertText(const base::string16& text,
     36                                 aura::RootWindow* root_window);
     37 
     38 // Move cursor when swipe on the virtualkeyboard. Returns true if cursor was
     39 // successfully moved according to |swipe_direction|.
     40 KEYBOARD_EXPORT bool MoveCursor(int swipe_direction,
     41                                 int modifier_flags,
     42                                 aura::RootWindow* root_window);
     43 
     44 // Get the list of keyboard resources.  |size| is populated with the number of
     45 // resources in the returned array.
     46 KEYBOARD_EXPORT const GritResourceMap* GetKeyboardExtensionResources(
     47     size_t* size);
     48 
     49 }  // namespace keyboard
     50 
     51 #endif  // UI_KEYBOARD_KEYBOARD_UTIL_H_
     52