| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |