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

Side by Side Diff: ash/virtual_keyboard_controller.cc

Issue 2775973002: Promotes more accessors from WmShell to Shell (Closed)
Patch Set: feedback 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 ->IsMaximizeModeWindowManagerEnabled()); 191 ->IsMaximizeModeWindowManagerEnabled());
192 return; 192 return;
193 } 193 }
194 bool ignore_internal_keyboard = Shell::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 Shell::Get()->system_tray_notifier()->NotifyVirtualKeyboardSuppressionChanged(
202 ->system_tray_notifier() 202 !is_internal_keyboard_active && has_touchscreen_ &&
203 ->NotifyVirtualKeyboardSuppressionChanged(!is_internal_keyboard_active && 203 has_external_keyboard_);
204 has_touchscreen_ &&
205 has_external_keyboard_);
206 } 204 }
207 205
208 void VirtualKeyboardController::SetKeyboardEnabled(bool enabled) { 206 void VirtualKeyboardController::SetKeyboardEnabled(bool enabled) {
209 bool was_enabled = keyboard::IsKeyboardEnabled(); 207 bool was_enabled = keyboard::IsKeyboardEnabled();
210 keyboard::SetTouchKeyboardEnabled(enabled); 208 keyboard::SetTouchKeyboardEnabled(enabled);
211 bool is_enabled = keyboard::IsKeyboardEnabled(); 209 bool is_enabled = keyboard::IsKeyboardEnabled();
212 if (is_enabled == was_enabled) 210 if (is_enabled == was_enabled)
213 return; 211 return;
214 if (is_enabled) { 212 if (is_enabled) {
215 Shell::GetInstance()->CreateKeyboard(); 213 Shell::GetInstance()->CreateKeyboard();
216 } else { 214 } else {
217 Shell::GetInstance()->DeactivateKeyboard(); 215 Shell::GetInstance()->DeactivateKeyboard();
218 } 216 }
219 } 217 }
220 218
221 } // namespace ash 219 } // 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