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

Side by Side Diff: ash/virtual_keyboard_controller.cc

Issue 2113053003: Moves Shell::maximize_mode_controller() to WmShell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: order Created 4 years, 5 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/ash_switches.h" 9 #include "ash/common/ash_switches.h"
10 #include "ash/common/system/tray/system_tray_notifier.h" 10 #include "ash/common/system/tray/system_tray_notifier.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 has_internal_keyboard_ = true; 96 has_internal_keyboard_ = true;
97 if (type == ui::InputDeviceType::INPUT_DEVICE_EXTERNAL) 97 if (type == ui::InputDeviceType::INPUT_DEVICE_EXTERNAL)
98 has_external_keyboard_ = true; 98 has_external_keyboard_ = true;
99 } 99 }
100 // Update keyboard state. 100 // Update keyboard state.
101 UpdateKeyboardEnabled(); 101 UpdateKeyboardEnabled();
102 } 102 }
103 103
104 void VirtualKeyboardController::UpdateKeyboardEnabled() { 104 void VirtualKeyboardController::UpdateKeyboardEnabled() {
105 if (!IsSmartVirtualKeyboardEnabled()) { 105 if (!IsSmartVirtualKeyboardEnabled()) {
106 SetKeyboardEnabled(Shell::GetInstance() 106 SetKeyboardEnabled(WmShell::Get()
107 ->maximize_mode_controller() 107 ->maximize_mode_controller()
108 ->IsMaximizeModeWindowManagerEnabled()); 108 ->IsMaximizeModeWindowManagerEnabled());
109 return; 109 return;
110 } 110 }
111 bool ignore_internal_keyboard = Shell::GetInstance() 111 bool ignore_internal_keyboard = WmShell::Get()
112 ->maximize_mode_controller() 112 ->maximize_mode_controller()
113 ->IsMaximizeModeWindowManagerEnabled(); 113 ->IsMaximizeModeWindowManagerEnabled();
114 bool is_internal_keyboard_active = 114 bool is_internal_keyboard_active =
115 has_internal_keyboard_ && !ignore_internal_keyboard; 115 has_internal_keyboard_ && !ignore_internal_keyboard;
116 SetKeyboardEnabled(!is_internal_keyboard_active && has_touchscreen_ && 116 SetKeyboardEnabled(!is_internal_keyboard_active && has_touchscreen_ &&
117 (!has_external_keyboard_ || ignore_external_keyboard_)); 117 (!has_external_keyboard_ || ignore_external_keyboard_));
118 WmShell::Get() 118 WmShell::Get()
119 ->system_tray_notifier() 119 ->system_tray_notifier()
120 ->NotifyVirtualKeyboardSuppressionChanged(!is_internal_keyboard_active && 120 ->NotifyVirtualKeyboardSuppressionChanged(!is_internal_keyboard_active &&
121 has_touchscreen_ && 121 has_touchscreen_ &&
122 has_external_keyboard_); 122 has_external_keyboard_);
123 } 123 }
124 124
125 void VirtualKeyboardController::SetKeyboardEnabled(bool enabled) { 125 void VirtualKeyboardController::SetKeyboardEnabled(bool enabled) {
126 bool was_enabled = keyboard::IsKeyboardEnabled(); 126 bool was_enabled = keyboard::IsKeyboardEnabled();
127 keyboard::SetTouchKeyboardEnabled(enabled); 127 keyboard::SetTouchKeyboardEnabled(enabled);
128 bool is_enabled = keyboard::IsKeyboardEnabled(); 128 bool is_enabled = keyboard::IsKeyboardEnabled();
129 if (is_enabled == was_enabled) 129 if (is_enabled == was_enabled)
130 return; 130 return;
131 if (is_enabled) { 131 if (is_enabled) {
132 Shell::GetInstance()->CreateKeyboard(); 132 Shell::GetInstance()->CreateKeyboard();
133 } else { 133 } else {
134 Shell::GetInstance()->DeactivateKeyboard(); 134 Shell::GetInstance()->DeactivateKeyboard();
135 } 135 }
136 } 136 }
137 137
138 } // namespace ash 138 } // 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