| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 LAZY_INSTANCE_INITIALIZER; | 49 LAZY_INSTANCE_INITIALIZER; |
| 50 | 50 |
| 51 bool g_accessibility_keyboard_enabled = false; | 51 bool g_accessibility_keyboard_enabled = false; |
| 52 | 52 |
| 53 bool g_hotrod_keyboard_enabled = false; | 53 bool g_hotrod_keyboard_enabled = false; |
| 54 | 54 |
| 55 bool g_keyboard_restricted = false; | 55 bool g_keyboard_restricted = false; |
| 56 | 56 |
| 57 bool g_touch_keyboard_enabled = false; | 57 bool g_touch_keyboard_enabled = false; |
| 58 | 58 |
| 59 bool g_overscroll_enabled_with_accessibility_keyboard = false; | |
| 60 | |
| 61 KeyboardState g_requested_keyboard_state = KEYBOARD_STATE_AUTO; | 59 KeyboardState g_requested_keyboard_state = KEYBOARD_STATE_AUTO; |
| 62 | 60 |
| 63 KeyboardOverscrolOverride g_keyboard_overscroll_override = | 61 KeyboardOverscrolOverride g_keyboard_overscroll_override = |
| 64 KEYBOARD_OVERSCROLL_OVERRIDE_NONE; | 62 KEYBOARD_OVERSCROLL_OVERRIDE_NONE; |
| 65 | 63 |
| 66 KeyboardShowOverride g_keyboard_show_override = KEYBOARD_SHOW_OVERRIDE_NONE; | 64 KeyboardShowOverride g_keyboard_show_override = KEYBOARD_SHOW_OVERRIDE_NONE; |
| 67 | 65 |
| 68 } // namespace | 66 } // namespace |
| 69 | 67 |
| 70 gfx::Rect FullWidthKeyboardBoundsFromRootBounds(const gfx::Rect& root_bounds, | 68 gfx::Rect FullWidthKeyboardBoundsFromRootBounds(const gfx::Rect& root_bounds, |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 auto* keyboard_controller = keyboard::KeyboardController::GetInstance(); | 141 auto* keyboard_controller = keyboard::KeyboardController::GetInstance(); |
| 144 return keyboard_controller && keyboard_controller->keyboard_visible(); | 142 return keyboard_controller && keyboard_controller->keyboard_visible(); |
| 145 } | 143 } |
| 146 | 144 |
| 147 bool IsKeyboardOverscrollEnabled() { | 145 bool IsKeyboardOverscrollEnabled() { |
| 148 if (!IsKeyboardEnabled()) | 146 if (!IsKeyboardEnabled()) |
| 149 return false; | 147 return false; |
| 150 | 148 |
| 151 // Users of the accessibility on-screen keyboard are likely to be using mouse | 149 // Users of the accessibility on-screen keyboard are likely to be using mouse |
| 152 // input, which may interfere with overscrolling. | 150 // input, which may interfere with overscrolling. |
| 153 if (g_accessibility_keyboard_enabled && | 151 if (g_accessibility_keyboard_enabled) |
| 154 !g_overscroll_enabled_with_accessibility_keyboard) { | |
| 155 return false; | 152 return false; |
| 156 } | |
| 157 | 153 |
| 158 // If overscroll enabled override is set, use it instead. Currently | 154 // If overscroll enabled override is set, use it instead. Currently |
| 159 // login / out-of-box disable keyboard overscroll. http://crbug.com/363635 | 155 // login / out-of-box disable keyboard overscroll. http://crbug.com/363635 |
| 160 if (g_keyboard_overscroll_override != KEYBOARD_OVERSCROLL_OVERRIDE_NONE) { | 156 if (g_keyboard_overscroll_override != KEYBOARD_OVERSCROLL_OVERRIDE_NONE) { |
| 161 return g_keyboard_overscroll_override == | 157 return g_keyboard_overscroll_override == |
| 162 KEYBOARD_OVERSCROLL_OVERRIDE_ENABLED; | 158 KEYBOARD_OVERSCROLL_OVERRIDE_ENABLED; |
| 163 } | 159 } |
| 164 | 160 |
| 165 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 161 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 166 switches::kDisableVirtualKeyboardOverscroll)) { | 162 switches::kDisableVirtualKeyboardOverscroll)) { |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 base::Time::Now() - g_keyboard_load_time_start.Get()); | 378 base::Time::Now() - g_keyboard_load_time_start.Get()); |
| 383 logged = true; | 379 logged = true; |
| 384 } | 380 } |
| 385 } | 381 } |
| 386 | 382 |
| 387 void LogKeyboardControlEvent(KeyboardControlEvent event) { | 383 void LogKeyboardControlEvent(KeyboardControlEvent event) { |
| 388 UMA_HISTOGRAM_ENUMERATION("VirtualKeyboard.KeyboardControlEvent", event, | 384 UMA_HISTOGRAM_ENUMERATION("VirtualKeyboard.KeyboardControlEvent", event, |
| 389 KEYBOARD_CONTROL_MAX); | 385 KEYBOARD_CONTROL_MAX); |
| 390 } | 386 } |
| 391 | 387 |
| 392 void SetOverscrollEnabledWithAccessibilityKeyboard(bool enabled) { | |
| 393 g_overscroll_enabled_with_accessibility_keyboard = enabled; | |
| 394 } | |
| 395 | |
| 396 } // namespace keyboard | 388 } // namespace keyboard |
| OLD | NEW |