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

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

Issue 2444443002: cros: Allow pin keyboard to keep focus without popping up the pin keyboard. (Closed)
Patch Set: Closure compiler. Created 4 years, 1 month 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') | ui/keyboard/scoped_keyboard_disabler.h » ('j') | 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 26 matching lines...) Expand all
37 ui::EF_IS_SYNTHESIZED, ui::DomKey::PROCESS, 37 ui::EF_IS_SYNTHESIZED, ui::DomKey::PROCESS,
38 ui::EventTimeForNow()); 38 ui::EventTimeForNow());
39 ui::EventDispatchDetails details = 39 ui::EventDispatchDetails details =
40 host->event_processor()->OnEventFromSource(&event); 40 host->event_processor()->OnEventFromSource(&event);
41 CHECK(!details.dispatcher_destroyed); 41 CHECK(!details.dispatcher_destroyed);
42 } 42 }
43 43
44 base::LazyInstance<base::Time> g_keyboard_load_time_start = 44 base::LazyInstance<base::Time> g_keyboard_load_time_start =
45 LAZY_INSTANCE_INITIALIZER; 45 LAZY_INSTANCE_INITIALIZER;
46 46
47 bool g_force_disable_keyboard = false;
bshe 2016/11/11 17:33:36 Is this only suppose to be changed by ScopedKeyboa
sammiequon 2016/11/11 21:20:58 I'm not sure how to go about implementing this. If
bshe 2016/11/11 21:44:16 I mean move g_force_disable_keyboard into scoped_k
sammiequon 2016/11/11 23:14:27 Thanks. Done.
48
47 bool g_accessibility_keyboard_enabled = false; 49 bool g_accessibility_keyboard_enabled = false;
48 50
49 bool g_hotrod_keyboard_enabled = false; 51 bool g_hotrod_keyboard_enabled = false;
50 52
51 bool g_touch_keyboard_enabled = false; 53 bool g_touch_keyboard_enabled = false;
52 54
53 keyboard::KeyboardState g_requested_keyboard_state = 55 keyboard::KeyboardState g_requested_keyboard_state =
54 keyboard::KEYBOARD_STATE_AUTO; 56 keyboard::KEYBOARD_STATE_AUTO;
55 57
56 keyboard::KeyboardOverscrolOverride g_keyboard_overscroll_override = 58 keyboard::KeyboardOverscrolOverride g_keyboard_overscroll_override =
57 keyboard::KEYBOARD_OVERSCROLL_OVERRIDE_NONE; 59 keyboard::KEYBOARD_OVERSCROLL_OVERRIDE_NONE;
58 60
59 keyboard::KeyboardShowOverride g_keyboard_show_override = 61 keyboard::KeyboardShowOverride g_keyboard_show_override =
60 keyboard::KEYBOARD_SHOW_OVERRIDE_NONE; 62 keyboard::KEYBOARD_SHOW_OVERRIDE_NONE;
61 63
62 } // namespace 64 } // namespace
63 65
64 namespace keyboard { 66 namespace keyboard {
65 67
66 gfx::Rect FullWidthKeyboardBoundsFromRootBounds(const gfx::Rect& root_bounds, 68 gfx::Rect FullWidthKeyboardBoundsFromRootBounds(const gfx::Rect& root_bounds,
67 int keyboard_height) { 69 int keyboard_height) {
68 return gfx::Rect( 70 return gfx::Rect(
69 root_bounds.x(), 71 root_bounds.x(),
70 root_bounds.bottom() - keyboard_height, 72 root_bounds.bottom() - keyboard_height,
71 root_bounds.width(), 73 root_bounds.width(),
72 keyboard_height); 74 keyboard_height);
73 } 75 }
74 76
77 void SetForceDisableVirtualKeyboard(bool disable) {
78 g_force_disable_keyboard = disable;
79 }
80
81 bool GetForceDisableVirtualKeyboard() {
82 return g_force_disable_keyboard;
83 }
84
75 void SetAccessibilityKeyboardEnabled(bool enabled) { 85 void SetAccessibilityKeyboardEnabled(bool enabled) {
76 g_accessibility_keyboard_enabled = enabled; 86 g_accessibility_keyboard_enabled = enabled;
77 } 87 }
78 88
79 bool GetAccessibilityKeyboardEnabled() { 89 bool GetAccessibilityKeyboardEnabled() {
80 return g_accessibility_keyboard_enabled; 90 return g_accessibility_keyboard_enabled;
81 } 91 }
82 92
83 void SetHotrodKeyboardEnabled(bool enabled) { 93 void SetHotrodKeyboardEnabled(bool enabled) {
84 g_hotrod_keyboard_enabled = enabled; 94 g_hotrod_keyboard_enabled = enabled;
(...skipping 19 matching lines...) Expand all
104 return g_requested_keyboard_state; 114 return g_requested_keyboard_state;
105 } 115 }
106 116
107 std::string GetKeyboardLayout() { 117 std::string GetKeyboardLayout() {
108 // TODO(bshe): layout string is currently hard coded. We should use more 118 // TODO(bshe): layout string is currently hard coded. We should use more
109 // standard keyboard layouts. 119 // standard keyboard layouts.
110 return GetAccessibilityKeyboardEnabled() ? "system-qwerty" : "qwerty"; 120 return GetAccessibilityKeyboardEnabled() ? "system-qwerty" : "qwerty";
111 } 121 }
112 122
113 bool IsKeyboardEnabled() { 123 bool IsKeyboardEnabled() {
124 // Blocks keyboard from showing up regardless of other settings.
125 if (g_force_disable_keyboard)
126 return false;
114 // Accessibility setting prioritized over policy setting. 127 // Accessibility setting prioritized over policy setting.
115 if (g_accessibility_keyboard_enabled) 128 if (g_accessibility_keyboard_enabled)
116 return true; 129 return true;
117 // Policy strictly disables showing a virtual keyboard. 130 // Policy strictly disables showing a virtual keyboard.
118 if (g_keyboard_show_override == keyboard::KEYBOARD_SHOW_OVERRIDE_DISABLED) 131 if (g_keyboard_show_override == keyboard::KEYBOARD_SHOW_OVERRIDE_DISABLED)
119 return false; 132 return false;
120 // Policy strictly enables the keyboard. 133 // Policy strictly enables the keyboard.
121 if (g_keyboard_show_override == keyboard::KEYBOARD_SHOW_OVERRIDE_ENABLED) 134 if (g_keyboard_show_override == keyboard::KEYBOARD_SHOW_OVERRIDE_ENABLED)
122 return true; 135 return true;
123 // Run-time flag to enable keyboard has been included. 136 // Run-time flag to enable keyboard has been included.
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 } 385 }
373 386
374 void LogKeyboardControlEvent(KeyboardControlEvent event) { 387 void LogKeyboardControlEvent(KeyboardControlEvent event) {
375 UMA_HISTOGRAM_ENUMERATION( 388 UMA_HISTOGRAM_ENUMERATION(
376 "VirtualKeyboard.KeyboardControlEvent", 389 "VirtualKeyboard.KeyboardControlEvent",
377 event, 390 event,
378 keyboard::KEYBOARD_CONTROL_MAX); 391 keyboard::KEYBOARD_CONTROL_MAX);
379 } 392 }
380 393
381 } // namespace keyboard 394 } // namespace keyboard
OLDNEW
« no previous file with comments | « ui/keyboard/keyboard_util.h ('k') | ui/keyboard/scoped_keyboard_disabler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698