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

Side by Side Diff: ash/virtual_keyboard_controller.cc

Issue 2019413002: Remove KeyboardDevice class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes for comments. Created 4 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 | « ash/test/virtual_keyboard_test_helper.cc ('k') | ash/virtual_keyboard_controller_unittest.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ash/virtual_keyboard_controller.h" 5 #include "ash/virtual_keyboard_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
11 #include "ash/wm/maximize_mode/maximize_mode_controller.h" 11 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "ui/events/devices/device_data_manager.h" 14 #include "ui/events/devices/device_data_manager.h"
15 #include "ui/events/devices/input_device.h" 15 #include "ui/events/devices/input_device.h"
16 #include "ui/events/devices/keyboard_device.h"
17 #include "ui/events/devices/touchscreen_device.h" 16 #include "ui/events/devices/touchscreen_device.h"
18 #include "ui/keyboard/keyboard_switches.h" 17 #include "ui/keyboard/keyboard_switches.h"
19 #include "ui/keyboard/keyboard_util.h" 18 #include "ui/keyboard/keyboard_util.h"
20 19
21 namespace ash { 20 namespace ash {
22 namespace { 21 namespace {
23 22
24 // Checks whether smart deployment is enabled. 23 // Checks whether smart deployment is enabled.
25 bool IsSmartVirtualKeyboardEnabled() { 24 bool IsSmartVirtualKeyboardEnabled() {
26 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 25 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 void VirtualKeyboardController::UpdateDevices() { 78 void VirtualKeyboardController::UpdateDevices() {
80 ui::DeviceDataManager* device_data_manager = 79 ui::DeviceDataManager* device_data_manager =
81 ui::DeviceDataManager::GetInstance(); 80 ui::DeviceDataManager::GetInstance();
82 81
83 // Checks for touchscreens. 82 // Checks for touchscreens.
84 has_touchscreen_ = device_data_manager->touchscreen_devices().size() > 0; 83 has_touchscreen_ = device_data_manager->touchscreen_devices().size() > 0;
85 84
86 // Checks for keyboards. 85 // Checks for keyboards.
87 has_external_keyboard_ = false; 86 has_external_keyboard_ = false;
88 has_internal_keyboard_ = false; 87 has_internal_keyboard_ = false;
89 for (const ui::KeyboardDevice& device : 88 for (const ui::InputDevice& device :
90 device_data_manager->keyboard_devices()) { 89 device_data_manager->keyboard_devices()) {
91 if (has_internal_keyboard_ && has_external_keyboard_) 90 if (has_internal_keyboard_ && has_external_keyboard_)
92 break; 91 break;
93 ui::InputDeviceType type = device.type; 92 ui::InputDeviceType type = device.type;
94 if (type == ui::InputDeviceType::INPUT_DEVICE_INTERNAL) 93 if (type == ui::InputDeviceType::INPUT_DEVICE_INTERNAL)
95 has_internal_keyboard_ = true; 94 has_internal_keyboard_ = true;
96 if (type == ui::InputDeviceType::INPUT_DEVICE_EXTERNAL) 95 if (type == ui::InputDeviceType::INPUT_DEVICE_EXTERNAL)
97 has_external_keyboard_ = true; 96 has_external_keyboard_ = true;
98 } 97 }
99 // Update keyboard state. 98 // Update keyboard state.
(...skipping 28 matching lines...) Expand all
128 if (is_enabled == was_enabled) 127 if (is_enabled == was_enabled)
129 return; 128 return;
130 if (is_enabled) { 129 if (is_enabled) {
131 Shell::GetInstance()->CreateKeyboard(); 130 Shell::GetInstance()->CreateKeyboard();
132 } else { 131 } else {
133 Shell::GetInstance()->DeactivateKeyboard(); 132 Shell::GetInstance()->DeactivateKeyboard();
134 } 133 }
135 } 134 }
136 135
137 } // namespace ash 136 } // namespace ash
OLDNEW
« no previous file with comments | « ash/test/virtual_keyboard_test_helper.cc ('k') | ash/virtual_keyboard_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698