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/ash_switches.h" | 9 #include "ash/common/ash_switches.h" |
| 10 #include "ash/common/system/tray/wm_system_tray_notifier.h" |
10 #include "ash/common/wm_shell.h" | 11 #include "ash/common/wm_shell.h" |
11 #include "ash/shell.h" | 12 #include "ash/shell.h" |
12 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | 13 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
13 #include "base/command_line.h" | 14 #include "base/command_line.h" |
14 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
15 #include "ui/events/devices/input_device.h" | 16 #include "ui/events/devices/input_device.h" |
16 #include "ui/events/devices/input_device_manager.h" | 17 #include "ui/events/devices/input_device_manager.h" |
17 #include "ui/events/devices/touchscreen_device.h" | 18 #include "ui/events/devices/touchscreen_device.h" |
18 #include "ui/keyboard/keyboard_switches.h" | 19 #include "ui/keyboard/keyboard_switches.h" |
19 #include "ui/keyboard/keyboard_util.h" | 20 #include "ui/keyboard/keyboard_util.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 ->IsMaximizeModeWindowManagerEnabled()); | 108 ->IsMaximizeModeWindowManagerEnabled()); |
108 return; | 109 return; |
109 } | 110 } |
110 bool ignore_internal_keyboard = Shell::GetInstance() | 111 bool ignore_internal_keyboard = Shell::GetInstance() |
111 ->maximize_mode_controller() | 112 ->maximize_mode_controller() |
112 ->IsMaximizeModeWindowManagerEnabled(); | 113 ->IsMaximizeModeWindowManagerEnabled(); |
113 bool is_internal_keyboard_active = | 114 bool is_internal_keyboard_active = |
114 has_internal_keyboard_ && !ignore_internal_keyboard; | 115 has_internal_keyboard_ && !ignore_internal_keyboard; |
115 SetKeyboardEnabled(!is_internal_keyboard_active && has_touchscreen_ && | 116 SetKeyboardEnabled(!is_internal_keyboard_active && has_touchscreen_ && |
116 (!has_external_keyboard_ || ignore_external_keyboard_)); | 117 (!has_external_keyboard_ || ignore_external_keyboard_)); |
117 ash::Shell::GetInstance() | 118 WmShell::Get() |
118 ->system_tray_notifier() | 119 ->system_tray_notifier() |
119 ->NotifyVirtualKeyboardSuppressionChanged(!is_internal_keyboard_active && | 120 ->NotifyVirtualKeyboardSuppressionChanged(!is_internal_keyboard_active && |
120 has_touchscreen_ && | 121 has_touchscreen_ && |
121 has_external_keyboard_); | 122 has_external_keyboard_); |
122 } | 123 } |
123 | 124 |
124 void VirtualKeyboardController::SetKeyboardEnabled(bool enabled) { | 125 void VirtualKeyboardController::SetKeyboardEnabled(bool enabled) { |
125 bool was_enabled = keyboard::IsKeyboardEnabled(); | 126 bool was_enabled = keyboard::IsKeyboardEnabled(); |
126 keyboard::SetTouchKeyboardEnabled(enabled); | 127 keyboard::SetTouchKeyboardEnabled(enabled); |
127 bool is_enabled = keyboard::IsKeyboardEnabled(); | 128 bool is_enabled = keyboard::IsKeyboardEnabled(); |
128 if (is_enabled == was_enabled) | 129 if (is_enabled == was_enabled) |
129 return; | 130 return; |
130 if (is_enabled) { | 131 if (is_enabled) { |
131 Shell::GetInstance()->CreateKeyboard(); | 132 Shell::GetInstance()->CreateKeyboard(); |
132 } else { | 133 } else { |
133 Shell::GetInstance()->DeactivateKeyboard(); | 134 Shell::GetInstance()->DeactivateKeyboard(); |
134 } | 135 } |
135 } | 136 } |
136 | 137 |
137 } // namespace ash | 138 } // namespace ash |
OLD | NEW |