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 #include "ui/keyboard/keyboard_util.h" | 5 #include "ui/keyboard/keyboard_util.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 switches::kEnableVirtualKeyboard) || | 107 switches::kEnableVirtualKeyboard) || |
108 IsKeyboardUsabilityExperimentEnabled() || | 108 IsKeyboardUsabilityExperimentEnabled() || |
109 g_touch_keyboard_enabled; | 109 g_touch_keyboard_enabled; |
110 } | 110 } |
111 | 111 |
112 bool IsKeyboardUsabilityExperimentEnabled() { | 112 bool IsKeyboardUsabilityExperimentEnabled() { |
113 return CommandLine::ForCurrentProcess()->HasSwitch( | 113 return CommandLine::ForCurrentProcess()->HasSwitch( |
114 switches::kKeyboardUsabilityExperiment); | 114 switches::kKeyboardUsabilityExperiment); |
115 } | 115 } |
116 | 116 |
| 117 bool IsKeyboardOverscrollEnabled() { |
| 118 if (!IsKeyboardEnabled()) |
| 119 return false; |
| 120 // Users of the accessibility on-screen keyboard are likely to be using mouse |
| 121 // input, which may interfere with overscrolling. |
| 122 if (g_accessibility_keyboard_enabled) |
| 123 return false; |
| 124 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 125 switches::kDisableVirtualKeyboardOverscroll)) { |
| 126 return false; |
| 127 } |
| 128 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 129 switches::kEnableVirtualKeyboardOverscroll)) { |
| 130 return true; |
| 131 } |
| 132 return false; |
| 133 } |
| 134 |
117 bool IsInputViewEnabled() { | 135 bool IsInputViewEnabled() { |
118 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableInputView)) | 136 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableInputView)) |
119 return true; | 137 return true; |
120 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableInputView)) | 138 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableInputView)) |
121 return false; | 139 return false; |
122 // Default value if no command line flags specified. | 140 // Default value if no command line flags specified. |
123 return false; | 141 return false; |
124 } | 142 } |
125 | 143 |
126 bool InsertText(const base::string16& text, aura::Window* root_window) { | 144 bool InsertText(const base::string16& text, aura::Window* root_window) { |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 } | 350 } |
333 | 351 |
334 void LogKeyboardControlEvent(KeyboardControlEvent event) { | 352 void LogKeyboardControlEvent(KeyboardControlEvent event) { |
335 UMA_HISTOGRAM_ENUMERATION( | 353 UMA_HISTOGRAM_ENUMERATION( |
336 "VirtualKeyboard.KeyboardControlEvent", | 354 "VirtualKeyboard.KeyboardControlEvent", |
337 event, | 355 event, |
338 keyboard::KEYBOARD_CONTROL_MAX); | 356 keyboard::KEYBOARD_CONTROL_MAX); |
339 } | 357 } |
340 | 358 |
341 } // namespace keyboard | 359 } // namespace keyboard |
OLD | NEW |