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

Side by Side Diff: ash/virtual_keyboard_controller.cc

Issue 800933002: Turns on smart deployment of the virtual keyboard by default, and changes the flag to allow easy di… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
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/shell.h" 9 #include "ash/shell.h"
10 #include "ash/wm/maximize_mode/maximize_mode_controller.h" 10 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
(...skipping 18 matching lines...) Expand all
29 ui::DeviceDataManager::GetInstance()->AddObserver(this); 29 ui::DeviceDataManager::GetInstance()->AddObserver(this);
30 UpdateDevices(); 30 UpdateDevices();
31 } 31 }
32 32
33 VirtualKeyboardController::~VirtualKeyboardController() { 33 VirtualKeyboardController::~VirtualKeyboardController() {
34 Shell::GetInstance()->RemoveShellObserver(this); 34 Shell::GetInstance()->RemoveShellObserver(this);
35 ui::DeviceDataManager::GetInstance()->RemoveObserver(this); 35 ui::DeviceDataManager::GetInstance()->RemoveObserver(this);
36 } 36 }
37 37
38 void VirtualKeyboardController::OnMaximizeModeStarted() { 38 void VirtualKeyboardController::OnMaximizeModeStarted() {
39 if (!CommandLine::ForCurrentProcess()->HasSwitch( 39 if (CommandLine::ForCurrentProcess()->HasSwitch(
40 keyboard::switches::kAutoVirtualKeyboard)) { 40 keyboard::switches::kDisableSmartVirtualKeyboard)) {
sky 2014/12/13 00:12:24 Can we have this check in one place and not three?
rsadam 2014/12/13 00:35:27 Done.
41 SetKeyboardEnabled(true); 41 SetKeyboardEnabled(true);
42 } 42 }
43 } 43 }
44 44
45 void VirtualKeyboardController::OnMaximizeModeEnded() { 45 void VirtualKeyboardController::OnMaximizeModeEnded() {
46 if (!CommandLine::ForCurrentProcess()->HasSwitch( 46 if (CommandLine::ForCurrentProcess()->HasSwitch(
47 keyboard::switches::kAutoVirtualKeyboard)) { 47 keyboard::switches::kDisableSmartVirtualKeyboard)) {
48 SetKeyboardEnabled(false); 48 SetKeyboardEnabled(false);
49 } 49 }
50 } 50 }
51 51
52 void VirtualKeyboardController::OnTouchscreenDeviceConfigurationChanged() { 52 void VirtualKeyboardController::OnTouchscreenDeviceConfigurationChanged() {
53 UpdateDevices(); 53 UpdateDevices();
54 } 54 }
55 55
56 void VirtualKeyboardController::OnKeyboardDeviceConfigurationChanged() { 56 void VirtualKeyboardController::OnKeyboardDeviceConfigurationChanged() {
57 UpdateDevices(); 57 UpdateDevices();
(...skipping 22 matching lines...) Expand all
80 if (type == ui::InputDeviceType::INPUT_DEVICE_INTERNAL) 80 if (type == ui::InputDeviceType::INPUT_DEVICE_INTERNAL)
81 has_internal_keyboard_ = true; 81 has_internal_keyboard_ = true;
82 if (type == ui::InputDeviceType::INPUT_DEVICE_EXTERNAL) 82 if (type == ui::InputDeviceType::INPUT_DEVICE_EXTERNAL)
83 has_external_keyboard_ = true; 83 has_external_keyboard_ = true;
84 } 84 }
85 // Update keyboard state. 85 // Update keyboard state.
86 UpdateKeyboardEnabled(); 86 UpdateKeyboardEnabled();
87 } 87 }
88 88
89 void VirtualKeyboardController::UpdateKeyboardEnabled() { 89 void VirtualKeyboardController::UpdateKeyboardEnabled() {
90 if (!CommandLine::ForCurrentProcess()->HasSwitch( 90 if (CommandLine::ForCurrentProcess()->HasSwitch(
91 keyboard::switches::kAutoVirtualKeyboard)) { 91 keyboard::switches::kDisableSmartVirtualKeyboard)) {
92 SetKeyboardEnabled(Shell::GetInstance() 92 SetKeyboardEnabled(Shell::GetInstance()
93 ->maximize_mode_controller() 93 ->maximize_mode_controller()
94 ->IsMaximizeModeWindowManagerEnabled()); 94 ->IsMaximizeModeWindowManagerEnabled());
95 return; 95 return;
96 } 96 }
97 SetKeyboardEnabled(!has_internal_keyboard_ && has_touchscreen_ && 97 SetKeyboardEnabled(!has_internal_keyboard_ && has_touchscreen_ &&
98 (!has_external_keyboard_ || ignore_external_keyboard_)); 98 (!has_external_keyboard_ || ignore_external_keyboard_));
99 ash::Shell::GetInstance() 99 ash::Shell::GetInstance()
100 ->system_tray_notifier() 100 ->system_tray_notifier()
101 ->NotifyVirtualKeyboardSuppressionChanged(!has_internal_keyboard_ && 101 ->NotifyVirtualKeyboardSuppressionChanged(!has_internal_keyboard_ &&
102 has_touchscreen_ && 102 has_touchscreen_ &&
103 has_external_keyboard_); 103 has_external_keyboard_);
104 } 104 }
105 105
106 void VirtualKeyboardController::SetKeyboardEnabled(bool enabled) { 106 void VirtualKeyboardController::SetKeyboardEnabled(bool enabled) {
107 keyboard::SetTouchKeyboardEnabled(enabled); 107 keyboard::SetTouchKeyboardEnabled(enabled);
108 if (enabled) { 108 if (enabled) {
109 Shell::GetInstance()->CreateKeyboard(); 109 Shell::GetInstance()->CreateKeyboard();
110 } else { 110 } else {
111 if (!keyboard::IsKeyboardEnabled()) 111 if (!keyboard::IsKeyboardEnabled())
112 Shell::GetInstance()->DeactivateKeyboard(); 112 Shell::GetInstance()->DeactivateKeyboard();
113 } 113 }
114 } 114 }
115 115
116 } // namespace ash 116 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/chromeos/virtual_keyboard/tray_keyboard_lock_unittest.cc ('k') | ash/virtual_keyboard_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698