Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: ui/keyboard/keyboard_util.cc

Issue 574033003: Remove keyboard usability mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compile error and unneccessary headers Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/keyboard/keyboard_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 } // namespace 53 } // namespace
54 54
55 namespace keyboard { 55 namespace keyboard {
56 56
57 gfx::Rect DefaultKeyboardBoundsFromWindowBounds( 57 gfx::Rect DefaultKeyboardBoundsFromWindowBounds(
58 const gfx::Rect& window_bounds) { 58 const gfx::Rect& window_bounds) {
59 // Initialize default keyboard height to 0. The keyboard window height should 59 // Initialize default keyboard height to 0. The keyboard window height should
60 // only be set by window.resizeTo in virtual keyboard web contents. Otherwise, 60 // only be set by window.resizeTo in virtual keyboard web contents. Otherwise,
61 // the default height may conflict with the new height and causing some 61 // the default height may conflict with the new height and causing some
62 // strange animation issues. For keyboard usability experiments, a full screen 62 // strange animation issues.
63 // virtual keyboard window is always preferred. 63 return KeyboardBoundsFromWindowBounds(window_bounds, 0);
64 int keyboard_height =
65 keyboard::IsKeyboardUsabilityExperimentEnabled() ?
66 window_bounds.height() : 0;
67
68 return KeyboardBoundsFromWindowBounds(window_bounds, keyboard_height);
69 } 64 }
70 65
71 gfx::Rect KeyboardBoundsFromWindowBounds(const gfx::Rect& window_bounds, 66 gfx::Rect KeyboardBoundsFromWindowBounds(const gfx::Rect& window_bounds,
72 int keyboard_height) { 67 int keyboard_height) {
73 return gfx::Rect( 68 return gfx::Rect(
74 window_bounds.x(), 69 window_bounds.x(),
75 window_bounds.bottom() - keyboard_height, 70 window_bounds.bottom() - keyboard_height,
76 window_bounds.width(), 71 window_bounds.width(),
77 keyboard_height); 72 keyboard_height);
78 } 73 }
(...skipping 23 matching lines...) Expand all
102 bool IsKeyboardEnabled() { 97 bool IsKeyboardEnabled() {
103 // Accessibility setting prioritized over policy setting. 98 // Accessibility setting prioritized over policy setting.
104 if (g_accessibility_keyboard_enabled) 99 if (g_accessibility_keyboard_enabled)
105 return true; 100 return true;
106 // Policy strictly disables showing a virtual keyboard. 101 // Policy strictly disables showing a virtual keyboard.
107 if (g_keyboard_show_override == keyboard::KEYBOARD_SHOW_OVERRIDE_DISABLED) 102 if (g_keyboard_show_override == keyboard::KEYBOARD_SHOW_OVERRIDE_DISABLED)
108 return false; 103 return false;
109 // Check if any of the flags are enabled. 104 // Check if any of the flags are enabled.
110 return CommandLine::ForCurrentProcess()->HasSwitch( 105 return CommandLine::ForCurrentProcess()->HasSwitch(
111 switches::kEnableVirtualKeyboard) || 106 switches::kEnableVirtualKeyboard) ||
112 IsKeyboardUsabilityExperimentEnabled() ||
113 g_touch_keyboard_enabled || 107 g_touch_keyboard_enabled ||
114 (g_keyboard_show_override == keyboard::KEYBOARD_SHOW_OVERRIDE_ENABLED); 108 (g_keyboard_show_override == keyboard::KEYBOARD_SHOW_OVERRIDE_ENABLED);
115 } 109 }
116 110
117 bool IsKeyboardUsabilityExperimentEnabled() {
118 return CommandLine::ForCurrentProcess()->HasSwitch(
119 switches::kKeyboardUsabilityExperiment);
120 }
121
122 bool IsKeyboardOverscrollEnabled() { 111 bool IsKeyboardOverscrollEnabled() {
123 if (!IsKeyboardEnabled()) 112 if (!IsKeyboardEnabled())
124 return false; 113 return false;
125 114
126 // Users of the accessibility on-screen keyboard are likely to be using mouse 115 // Users of the accessibility on-screen keyboard are likely to be using mouse
127 // input, which may interfere with overscrolling. 116 // input, which may interfere with overscrolling.
128 if (g_accessibility_keyboard_enabled) 117 if (g_accessibility_keyboard_enabled)
129 return false; 118 return false;
130 119
131 // If overscroll enabled override is set, use it instead. Currently 120 // If overscroll enabled override is set, use it instead. Currently
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 } 366 }
378 367
379 void LogKeyboardControlEvent(KeyboardControlEvent event) { 368 void LogKeyboardControlEvent(KeyboardControlEvent event) {
380 UMA_HISTOGRAM_ENUMERATION( 369 UMA_HISTOGRAM_ENUMERATION(
381 "VirtualKeyboard.KeyboardControlEvent", 370 "VirtualKeyboard.KeyboardControlEvent",
382 event, 371 event,
383 keyboard::KEYBOARD_CONTROL_MAX); 372 keyboard::KEYBOARD_CONTROL_MAX);
384 } 373 }
385 374
386 } // namespace keyboard 375 } // namespace keyboard
OLDNEW
« no previous file with comments | « ui/keyboard/keyboard_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698