| 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 20 matching lines...) Expand all Loading... |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 // An enumeration of different keyboard control events that should be logged. | 33 // An enumeration of different keyboard control events that should be logged. |
| 34 enum KeyboardControlEvent { | 34 enum KeyboardControlEvent { |
| 35 KEYBOARD_CONTROL_SHOW = 0, | 35 KEYBOARD_CONTROL_SHOW = 0, |
| 36 KEYBOARD_CONTROL_HIDE_AUTO, | 36 KEYBOARD_CONTROL_HIDE_AUTO, |
| 37 KEYBOARD_CONTROL_HIDE_USER, | 37 KEYBOARD_CONTROL_HIDE_USER, |
| 38 KEYBOARD_CONTROL_MAX, | 38 KEYBOARD_CONTROL_MAX, |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 // An enumeration of keyboard overscroll override value. |
| 42 enum KeyboardOverscrolOverride { |
| 43 KEYBOARD_OVERSCROLL_OVERRIDE_DISABLED = 0, |
| 44 KEYBOARD_OVERSCROLL_OVERRIDE_ENABLED, |
| 45 KEYBOARD_OVERSCROLL_OVERRIDE_NONE, |
| 46 }; |
| 47 |
| 41 // Gets the default keyboard bounds from |window_bounds|. | 48 // Gets the default keyboard bounds from |window_bounds|. |
| 42 KEYBOARD_EXPORT gfx::Rect DefaultKeyboardBoundsFromWindowBounds( | 49 KEYBOARD_EXPORT gfx::Rect DefaultKeyboardBoundsFromWindowBounds( |
| 43 const gfx::Rect& window_bounds); | 50 const gfx::Rect& window_bounds); |
| 44 | 51 |
| 45 // Gets the caculated keyboard bounds from |window_bounds|. The keyboard height | 52 // Gets the caculated keyboard bounds from |window_bounds|. The keyboard height |
| 46 // is specified by |keyboard_height|. | 53 // is specified by |keyboard_height|. |
| 47 KEYBOARD_EXPORT gfx::Rect KeyboardBoundsFromWindowBounds( | 54 KEYBOARD_EXPORT gfx::Rect KeyboardBoundsFromWindowBounds( |
| 48 const gfx::Rect& window_bounds, int keyboard_height); | 55 const gfx::Rect& window_bounds, int keyboard_height); |
| 49 | 56 |
| 50 // Sets the state of the a11y onscreen keyboard. | 57 // Sets the state of the a11y onscreen keyboard. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 64 | 71 |
| 65 // Returns true if the virtual keyboard is enabled. | 72 // Returns true if the virtual keyboard is enabled. |
| 66 KEYBOARD_EXPORT bool IsKeyboardEnabled(); | 73 KEYBOARD_EXPORT bool IsKeyboardEnabled(); |
| 67 | 74 |
| 68 // Returns true if the keyboard usability test is enabled. | 75 // Returns true if the keyboard usability test is enabled. |
| 69 KEYBOARD_EXPORT bool IsKeyboardUsabilityExperimentEnabled(); | 76 KEYBOARD_EXPORT bool IsKeyboardUsabilityExperimentEnabled(); |
| 70 | 77 |
| 71 // Returns true if keyboard overscroll mode is enabled. | 78 // Returns true if keyboard overscroll mode is enabled. |
| 72 KEYBOARD_EXPORT bool IsKeyboardOverscrollEnabled(); | 79 KEYBOARD_EXPORT bool IsKeyboardOverscrollEnabled(); |
| 73 | 80 |
| 81 // Sets temporary keyboard overscroll override. |
| 82 KEYBOARD_EXPORT void SetKeyboardOverscrollOverride( |
| 83 KeyboardOverscrolOverride override); |
| 84 |
| 74 // Returns true if an IME extension can specify a custom input view for the | 85 // Returns true if an IME extension can specify a custom input view for the |
| 75 // virtual keyboard window. | 86 // virtual keyboard window. |
| 76 KEYBOARD_EXPORT bool IsInputViewEnabled(); | 87 KEYBOARD_EXPORT bool IsInputViewEnabled(); |
| 77 | 88 |
| 78 // Insert |text| into the active TextInputClient associated with |root_window|, | 89 // Insert |text| into the active TextInputClient associated with |root_window|, |
| 79 // if there is one. Returns true if |text| was successfully inserted. Note | 90 // if there is one. Returns true if |text| was successfully inserted. Note |
| 80 // that this may convert |text| into ui::KeyEvents for injection in some | 91 // that this may convert |text| into ui::KeyEvents for injection in some |
| 81 // special circumstances (i.e. VKEY_RETURN, VKEY_BACK). | 92 // special circumstances (i.e. VKEY_RETURN, VKEY_BACK). |
| 82 KEYBOARD_EXPORT bool InsertText(const base::string16& text, | 93 KEYBOARD_EXPORT bool InsertText(const base::string16& text, |
| 83 aura::Window* root_window); | 94 aura::Window* root_window); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 132 |
| 122 // Gets the override content url. | 133 // Gets the override content url. |
| 123 KEYBOARD_EXPORT const GURL& GetOverrideContentUrl(); | 134 KEYBOARD_EXPORT const GURL& GetOverrideContentUrl(); |
| 124 | 135 |
| 125 // Logs the keyboard control event as a UMA stat. | 136 // Logs the keyboard control event as a UMA stat. |
| 126 void LogKeyboardControlEvent(KeyboardControlEvent event); | 137 void LogKeyboardControlEvent(KeyboardControlEvent event); |
| 127 | 138 |
| 128 } // namespace keyboard | 139 } // namespace keyboard |
| 129 | 140 |
| 130 #endif // UI_KEYBOARD_KEYBOARD_UTIL_H_ | 141 #endif // UI_KEYBOARD_KEYBOARD_UTIL_H_ |
| OLD | NEW |