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

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

Issue 2940103003: login: Remove scoped keyboard disabler. (Closed)
Patch Set: Add closure. Created 3 years, 6 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/BUILD.gn ('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"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/metrics/histogram_macros.h" 12 #include "base/metrics/histogram_macros.h"
13 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
14 #include "ui/aura/client/aura_constants.h" 14 #include "ui/aura/client/aura_constants.h"
15 #include "ui/aura/window_tree_host.h" 15 #include "ui/aura/window_tree_host.h"
16 #include "ui/base/ime/input_method.h" 16 #include "ui/base/ime/input_method.h"
17 #include "ui/base/ime/input_method_base.h" 17 #include "ui/base/ime/input_method_base.h"
18 #include "ui/base/ime/text_input_client.h" 18 #include "ui/base/ime/text_input_client.h"
19 #include "ui/base/ime/text_input_flags.h" 19 #include "ui/base/ime/text_input_flags.h"
20 #include "ui/events/event_sink.h" 20 #include "ui/events/event_sink.h"
21 #include "ui/events/event_utils.h" 21 #include "ui/events/event_utils.h"
22 #include "ui/events/keycodes/dom/dom_code.h" 22 #include "ui/events/keycodes/dom/dom_code.h"
23 #include "ui/events/keycodes/dom/dom_key.h" 23 #include "ui/events/keycodes/dom/dom_key.h"
24 #include "ui/events/keycodes/dom/keycode_converter.h" 24 #include "ui/events/keycodes/dom/keycode_converter.h"
25 #include "ui/events/keycodes/keyboard_code_conversion.h" 25 #include "ui/events/keycodes/keyboard_code_conversion.h"
26 #include "ui/keyboard/keyboard_controller.h" 26 #include "ui/keyboard/keyboard_controller.h"
27 #include "ui/keyboard/keyboard_switches.h" 27 #include "ui/keyboard/keyboard_switches.h"
28 #include "ui/keyboard/keyboard_ui.h" 28 #include "ui/keyboard/keyboard_ui.h"
29 #include "ui/keyboard/scoped_keyboard_disabler.h"
30 29
31 namespace keyboard { 30 namespace keyboard {
32 31
33 namespace { 32 namespace {
34 33
35 const char kKeyDown[] ="keydown"; 34 const char kKeyDown[] ="keydown";
36 const char kKeyUp[] = "keyup"; 35 const char kKeyUp[] = "keyup";
37 36
38 void SendProcessKeyEvent(ui::EventType type, 37 void SendProcessKeyEvent(ui::EventType type,
39 aura::WindowTreeHost* host) { 38 aura::WindowTreeHost* host) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 return g_requested_keyboard_state; 105 return g_requested_keyboard_state;
107 } 106 }
108 107
109 std::string GetKeyboardLayout() { 108 std::string GetKeyboardLayout() {
110 // TODO(bshe): layout string is currently hard coded. We should use more 109 // TODO(bshe): layout string is currently hard coded. We should use more
111 // standard keyboard layouts. 110 // standard keyboard layouts.
112 return GetAccessibilityKeyboardEnabled() ? "system-qwerty" : "qwerty"; 111 return GetAccessibilityKeyboardEnabled() ? "system-qwerty" : "qwerty";
113 } 112 }
114 113
115 bool IsKeyboardEnabled() { 114 bool IsKeyboardEnabled() {
116 // Blocks keyboard from showing up regardless of other settings.
117 if (ScopedKeyboardDisabler::GetForceDisableVirtualKeyboard())
118 return false;
119 // Accessibility setting prioritized over policy setting. 115 // Accessibility setting prioritized over policy setting.
120 if (g_accessibility_keyboard_enabled) 116 if (g_accessibility_keyboard_enabled)
121 return true; 117 return true;
122 // Policy strictly disables showing a virtual keyboard. 118 // Policy strictly disables showing a virtual keyboard.
123 if (g_keyboard_show_override == KEYBOARD_SHOW_OVERRIDE_DISABLED) 119 if (g_keyboard_show_override == KEYBOARD_SHOW_OVERRIDE_DISABLED)
124 return false; 120 return false;
125 // Policy strictly enables the keyboard. 121 // Policy strictly enables the keyboard.
126 if (g_keyboard_show_override == KEYBOARD_SHOW_OVERRIDE_ENABLED) 122 if (g_keyboard_show_override == KEYBOARD_SHOW_OVERRIDE_ENABLED)
127 return true; 123 return true;
128 // Run-time flag to enable keyboard has been included. 124 // Run-time flag to enable keyboard has been included.
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 logged = true; 375 logged = true;
380 } 376 }
381 } 377 }
382 378
383 void LogKeyboardControlEvent(KeyboardControlEvent event) { 379 void LogKeyboardControlEvent(KeyboardControlEvent event) {
384 UMA_HISTOGRAM_ENUMERATION("VirtualKeyboard.KeyboardControlEvent", event, 380 UMA_HISTOGRAM_ENUMERATION("VirtualKeyboard.KeyboardControlEvent", event,
385 KEYBOARD_CONTROL_MAX); 381 KEYBOARD_CONTROL_MAX);
386 } 382 }
387 383
388 } // namespace keyboard 384 } // namespace keyboard
OLDNEW
« no previous file with comments | « ui/keyboard/BUILD.gn ('k') | ui/keyboard/scoped_keyboard_disabler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698