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

Side by Side Diff: ash/virtual_keyboard_controller.cc

Issue 970983003: Fix Virtual Keyboard not being deployed in TouchView mode on Ozone. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added suppression test. Created 5 years, 9 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 | « no previous file | 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/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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 ui::DeviceDataManager::GetInstance()->AddObserver(this); 43 ui::DeviceDataManager::GetInstance()->AddObserver(this);
44 UpdateDevices(); 44 UpdateDevices();
45 } 45 }
46 46
47 VirtualKeyboardController::~VirtualKeyboardController() { 47 VirtualKeyboardController::~VirtualKeyboardController() {
48 Shell::GetInstance()->RemoveShellObserver(this); 48 Shell::GetInstance()->RemoveShellObserver(this);
49 ui::DeviceDataManager::GetInstance()->RemoveObserver(this); 49 ui::DeviceDataManager::GetInstance()->RemoveObserver(this);
50 } 50 }
51 51
52 void VirtualKeyboardController::OnMaximizeModeStarted() { 52 void VirtualKeyboardController::OnMaximizeModeStarted() {
53 if (!IsSmartVirtualKeyboardEnabled()) 53 if (!IsSmartVirtualKeyboardEnabled()) {
54 SetKeyboardEnabled(true); 54 SetKeyboardEnabled(true);
55 } else {
56 UpdateKeyboardEnabled();
57 }
55 } 58 }
56 59
57 void VirtualKeyboardController::OnMaximizeModeEnded() { 60 void VirtualKeyboardController::OnMaximizeModeEnded() {
58 if (!IsSmartVirtualKeyboardEnabled()) 61 if (!IsSmartVirtualKeyboardEnabled()) {
59 SetKeyboardEnabled(false); 62 SetKeyboardEnabled(false);
63 } else {
64 UpdateKeyboardEnabled();
65 }
60 } 66 }
61 67
62 void VirtualKeyboardController::OnTouchscreenDeviceConfigurationChanged() { 68 void VirtualKeyboardController::OnTouchscreenDeviceConfigurationChanged() {
63 UpdateDevices(); 69 UpdateDevices();
64 } 70 }
65 71
66 void VirtualKeyboardController::OnKeyboardDeviceConfigurationChanged() { 72 void VirtualKeyboardController::OnKeyboardDeviceConfigurationChanged() {
67 UpdateDevices(); 73 UpdateDevices();
68 } 74 }
69 75
(...skipping 26 matching lines...) Expand all
96 UpdateKeyboardEnabled(); 102 UpdateKeyboardEnabled();
97 } 103 }
98 104
99 void VirtualKeyboardController::UpdateKeyboardEnabled() { 105 void VirtualKeyboardController::UpdateKeyboardEnabled() {
100 if (!IsSmartVirtualKeyboardEnabled()) { 106 if (!IsSmartVirtualKeyboardEnabled()) {
101 SetKeyboardEnabled(Shell::GetInstance() 107 SetKeyboardEnabled(Shell::GetInstance()
102 ->maximize_mode_controller() 108 ->maximize_mode_controller()
103 ->IsMaximizeModeWindowManagerEnabled()); 109 ->IsMaximizeModeWindowManagerEnabled());
104 return; 110 return;
105 } 111 }
106 SetKeyboardEnabled(!has_internal_keyboard_ && has_touchscreen_ && 112 bool ignore_internal_keyboard = Shell::GetInstance()
113 ->maximize_mode_controller()
114 ->IsMaximizeModeWindowManagerEnabled();
115 bool is_internal_keyboard_active =
116 has_internal_keyboard_ && !ignore_internal_keyboard;
117 SetKeyboardEnabled(!is_internal_keyboard_active && has_touchscreen_ &&
107 (!has_external_keyboard_ || ignore_external_keyboard_)); 118 (!has_external_keyboard_ || ignore_external_keyboard_));
108 ash::Shell::GetInstance() 119 ash::Shell::GetInstance()
109 ->system_tray_notifier() 120 ->system_tray_notifier()
110 ->NotifyVirtualKeyboardSuppressionChanged(!has_internal_keyboard_ && 121 ->NotifyVirtualKeyboardSuppressionChanged(!is_internal_keyboard_active &&
111 has_touchscreen_ && 122 has_touchscreen_ &&
112 has_external_keyboard_); 123 has_external_keyboard_);
113 } 124 }
114 125
115 void VirtualKeyboardController::SetKeyboardEnabled(bool enabled) { 126 void VirtualKeyboardController::SetKeyboardEnabled(bool enabled) {
116 keyboard::SetTouchKeyboardEnabled(enabled); 127 keyboard::SetTouchKeyboardEnabled(enabled);
117 if (enabled) { 128 if (enabled) {
118 Shell::GetInstance()->CreateKeyboard(); 129 Shell::GetInstance()->CreateKeyboard();
119 } else { 130 } else {
120 if (!keyboard::IsKeyboardEnabled()) 131 if (!keyboard::IsKeyboardEnabled())
121 Shell::GetInstance()->DeactivateKeyboard(); 132 Shell::GetInstance()->DeactivateKeyboard();
122 } 133 }
123 } 134 }
124 135
125 } // namespace ash 136 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/virtual_keyboard_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698