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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 CommandLine::ForCurrentProcess()->HasSwitch( | 96 CommandLine::ForCurrentProcess()->HasSwitch( |
97 switches::kEnableVirtualKeyboard) || | 97 switches::kEnableVirtualKeyboard) || |
98 IsKeyboardUsabilityExperimentEnabled(); | 98 IsKeyboardUsabilityExperimentEnabled(); |
99 } | 99 } |
100 | 100 |
101 bool IsKeyboardUsabilityExperimentEnabled() { | 101 bool IsKeyboardUsabilityExperimentEnabled() { |
102 return CommandLine::ForCurrentProcess()->HasSwitch( | 102 return CommandLine::ForCurrentProcess()->HasSwitch( |
103 switches::kKeyboardUsabilityExperiment); | 103 switches::kKeyboardUsabilityExperiment); |
104 } | 104 } |
105 | 105 |
| 106 bool IsKeyboardOverscrollEnabled() { |
| 107 if (!IsKeyboardEnabled()) |
| 108 return false; |
| 109 if (g_accessibility_keyboard_enabled) |
| 110 return false; |
| 111 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 112 switches::kDisableVirtualKeyboardOverscroll)) { |
| 113 return false; |
| 114 } |
| 115 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 116 switches::kEnableVirtualKeyboardOverscroll)) { |
| 117 return true; |
| 118 } |
| 119 return false; |
| 120 } |
| 121 |
106 bool InsertText(const base::string16& text, aura::Window* root_window) { | 122 bool InsertText(const base::string16& text, aura::Window* root_window) { |
107 if (!root_window) | 123 if (!root_window) |
108 return false; | 124 return false; |
109 | 125 |
110 ui::InputMethod* input_method = root_window->GetProperty( | 126 ui::InputMethod* input_method = root_window->GetProperty( |
111 aura::client::kRootWindowInputMethodKey); | 127 aura::client::kRootWindowInputMethodKey); |
112 if (!input_method) | 128 if (!input_method) |
113 return false; | 129 return false; |
114 | 130 |
115 ui::TextInputClient* tic = input_method->GetTextInputClient(); | 131 ui::TextInputClient* tic = input_method->GetTextInputClient(); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 } | 330 } |
315 | 331 |
316 void LogKeyboardControlEvent(KeyboardControlEvent event) { | 332 void LogKeyboardControlEvent(KeyboardControlEvent event) { |
317 UMA_HISTOGRAM_ENUMERATION( | 333 UMA_HISTOGRAM_ENUMERATION( |
318 "VirtualKeyboard.KeyboardControlEvent", | 334 "VirtualKeyboard.KeyboardControlEvent", |
319 event, | 335 event, |
320 keyboard::KEYBOARD_CONTROL_MAX); | 336 keyboard::KEYBOARD_CONTROL_MAX); |
321 } | 337 } |
322 | 338 |
323 } // namespace keyboard | 339 } // namespace keyboard |
OLD | NEW |