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

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: Moved blocking variable to scoped class. 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/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.h" 12 #include "base/metrics/histogram.h"
13 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
14 #include "media/audio/audio_manager.h" 14 #include "media/audio/audio_manager.h"
15 #include "ui/aura/client/aura_constants.h" 15 #include "ui/aura/client/aura_constants.h"
16 #include "ui/aura/window_tree_host.h" 16 #include "ui/aura/window_tree_host.h"
17 #include "ui/base/ime/input_method.h" 17 #include "ui/base/ime/input_method.h"
18 #include "ui/base/ime/text_input_client.h" 18 #include "ui/base/ime/text_input_client.h"
19 #include "ui/events/event_processor.h" 19 #include "ui/events/event_processor.h"
20 #include "ui/events/event_utils.h" 20 #include "ui/events/event_utils.h"
21 #include "ui/events/keycodes/dom/dom_code.h" 21 #include "ui/events/keycodes/dom/dom_code.h"
22 #include "ui/events/keycodes/dom/dom_key.h" 22 #include "ui/events/keycodes/dom/dom_key.h"
23 #include "ui/events/keycodes/dom/keycode_converter.h" 23 #include "ui/events/keycodes/dom/keycode_converter.h"
24 #include "ui/events/keycodes/keyboard_code_conversion.h" 24 #include "ui/events/keycodes/keyboard_code_conversion.h"
25 #include "ui/keyboard/keyboard_controller.h" 25 #include "ui/keyboard/keyboard_controller.h"
26 #include "ui/keyboard/keyboard_switches.h" 26 #include "ui/keyboard/keyboard_switches.h"
27 #include "ui/keyboard/keyboard_ui.h" 27 #include "ui/keyboard/keyboard_ui.h"
28 #include "ui/keyboard/scoped_keyboard_disabler.h"
28 29
29 namespace { 30 namespace {
30 31
31 const char kKeyDown[] ="keydown"; 32 const char kKeyDown[] ="keydown";
32 const char kKeyUp[] = "keyup"; 33 const char kKeyUp[] = "keyup";
33 34
34 void SendProcessKeyEvent(ui::EventType type, 35 void SendProcessKeyEvent(ui::EventType type,
35 aura::WindowTreeHost* host) { 36 aura::WindowTreeHost* host) {
36 ui::KeyEvent event(type, ui::VKEY_PROCESSKEY, ui::DomCode::NONE, 37 ui::KeyEvent event(type, ui::VKEY_PROCESSKEY, ui::DomCode::NONE,
37 ui::EF_IS_SYNTHESIZED, ui::DomKey::PROCESS, 38 ui::EF_IS_SYNTHESIZED, ui::DomKey::PROCESS,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 return g_requested_keyboard_state; 105 return g_requested_keyboard_state;
105 } 106 }
106 107
107 std::string GetKeyboardLayout() { 108 std::string GetKeyboardLayout() {
108 // 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
109 // standard keyboard layouts. 110 // standard keyboard layouts.
110 return GetAccessibilityKeyboardEnabled() ? "system-qwerty" : "qwerty"; 111 return GetAccessibilityKeyboardEnabled() ? "system-qwerty" : "qwerty";
111 } 112 }
112 113
113 bool IsKeyboardEnabled() { 114 bool IsKeyboardEnabled() {
115 // Blocks keyboard from showing up regardless of other settings.
116 if (ScopedKeyboardDisabler::GetForceDisableVirtualKeyboard())
117 return false;
114 // Accessibility setting prioritized over policy setting. 118 // Accessibility setting prioritized over policy setting.
115 if (g_accessibility_keyboard_enabled) 119 if (g_accessibility_keyboard_enabled)
116 return true; 120 return true;
117 // Policy strictly disables showing a virtual keyboard. 121 // Policy strictly disables showing a virtual keyboard.
118 if (g_keyboard_show_override == keyboard::KEYBOARD_SHOW_OVERRIDE_DISABLED) 122 if (g_keyboard_show_override == keyboard::KEYBOARD_SHOW_OVERRIDE_DISABLED)
119 return false; 123 return false;
120 // Policy strictly enables the keyboard. 124 // Policy strictly enables the keyboard.
121 if (g_keyboard_show_override == keyboard::KEYBOARD_SHOW_OVERRIDE_ENABLED) 125 if (g_keyboard_show_override == keyboard::KEYBOARD_SHOW_OVERRIDE_ENABLED)
122 return true; 126 return true;
123 // Run-time flag to enable keyboard has been included. 127 // Run-time flag to enable keyboard has been included.
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 } 376 }
373 377
374 void LogKeyboardControlEvent(KeyboardControlEvent event) { 378 void LogKeyboardControlEvent(KeyboardControlEvent event) {
375 UMA_HISTOGRAM_ENUMERATION( 379 UMA_HISTOGRAM_ENUMERATION(
376 "VirtualKeyboard.KeyboardControlEvent", 380 "VirtualKeyboard.KeyboardControlEvent",
377 event, 381 event,
378 keyboard::KEYBOARD_CONTROL_MAX); 382 keyboard::KEYBOARD_CONTROL_MAX);
379 } 383 }
380 384
381 } // namespace keyboard 385 } // 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