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

Side by Side Diff: ash/virtual_keyboard_controller.cc

Issue 2766543002: Move even more from WmShell to Shell (Closed)
Patch Set: Created 3 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
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/common/keyboard/keyboard_ui.h" 9 #include "ash/common/keyboard/keyboard_ui.h"
10 #include "ash/common/system/tray/system_tray_notifier.h" 10 #include "ash/common/system/tray/system_tray_notifier.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 has_internal_keyboard_ = true; 179 has_internal_keyboard_ = true;
180 if (type == ui::InputDeviceType::INPUT_DEVICE_EXTERNAL) 180 if (type == ui::InputDeviceType::INPUT_DEVICE_EXTERNAL)
181 has_external_keyboard_ = true; 181 has_external_keyboard_ = true;
182 } 182 }
183 // Update keyboard state. 183 // Update keyboard state.
184 UpdateKeyboardEnabled(); 184 UpdateKeyboardEnabled();
185 } 185 }
186 186
187 void VirtualKeyboardController::UpdateKeyboardEnabled() { 187 void VirtualKeyboardController::UpdateKeyboardEnabled() {
188 if (!IsSmartVirtualKeyboardEnabled()) { 188 if (!IsSmartVirtualKeyboardEnabled()) {
189 SetKeyboardEnabled(WmShell::Get() 189 SetKeyboardEnabled(Shell::Get()
190 ->maximize_mode_controller() 190 ->maximize_mode_controller()
191 ->IsMaximizeModeWindowManagerEnabled()); 191 ->IsMaximizeModeWindowManagerEnabled());
192 return; 192 return;
193 } 193 }
194 bool ignore_internal_keyboard = WmShell::Get() 194 bool ignore_internal_keyboard = Shell::Get()
195 ->maximize_mode_controller() 195 ->maximize_mode_controller()
196 ->IsMaximizeModeWindowManagerEnabled(); 196 ->IsMaximizeModeWindowManagerEnabled();
197 bool is_internal_keyboard_active = 197 bool is_internal_keyboard_active =
198 has_internal_keyboard_ && !ignore_internal_keyboard; 198 has_internal_keyboard_ && !ignore_internal_keyboard;
199 SetKeyboardEnabled(!is_internal_keyboard_active && has_touchscreen_ && 199 SetKeyboardEnabled(!is_internal_keyboard_active && has_touchscreen_ &&
200 (!has_external_keyboard_ || ignore_external_keyboard_)); 200 (!has_external_keyboard_ || ignore_external_keyboard_));
201 WmShell::Get() 201 WmShell::Get()
202 ->system_tray_notifier() 202 ->system_tray_notifier()
203 ->NotifyVirtualKeyboardSuppressionChanged(!is_internal_keyboard_active && 203 ->NotifyVirtualKeyboardSuppressionChanged(!is_internal_keyboard_active &&
204 has_touchscreen_ && 204 has_touchscreen_ &&
205 has_external_keyboard_); 205 has_external_keyboard_);
206 } 206 }
207 207
208 void VirtualKeyboardController::SetKeyboardEnabled(bool enabled) { 208 void VirtualKeyboardController::SetKeyboardEnabled(bool enabled) {
209 bool was_enabled = keyboard::IsKeyboardEnabled(); 209 bool was_enabled = keyboard::IsKeyboardEnabled();
210 keyboard::SetTouchKeyboardEnabled(enabled); 210 keyboard::SetTouchKeyboardEnabled(enabled);
211 bool is_enabled = keyboard::IsKeyboardEnabled(); 211 bool is_enabled = keyboard::IsKeyboardEnabled();
212 if (is_enabled == was_enabled) 212 if (is_enabled == was_enabled)
213 return; 213 return;
214 if (is_enabled) { 214 if (is_enabled) {
215 Shell::GetInstance()->CreateKeyboard(); 215 Shell::GetInstance()->CreateKeyboard();
216 } else { 216 } else {
217 Shell::GetInstance()->DeactivateKeyboard(); 217 Shell::GetInstance()->DeactivateKeyboard();
218 } 218 }
219 } 219 }
220 220
221 } // namespace ash 221 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/overview/overview_button_tray_unittest.cc ('k') | ash/virtual_keyboard_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698