| 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" |
| 11 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 11 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
| 12 #include "ash/common/wm_shell.h" | 12 #include "ash/common/wm_shell.h" |
| 13 #include "ash/common/wm_window.h" | 13 #include "ash/common/wm_window.h" |
| 14 #include "ash/root_window_controller.h" | 14 #include "ash/root_window_controller.h" |
| 15 #include "ash/shell.h" | 15 #include "ash/shell.h" |
| 16 #include "ash/wm/window_util.h" |
| 16 #include "base/command_line.h" | 17 #include "base/command_line.h" |
| 17 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
| 18 #include "ui/display/display.h" | 19 #include "ui/display/display.h" |
| 19 #include "ui/display/screen.h" | 20 #include "ui/display/screen.h" |
| 20 #include "ui/events/devices/input_device.h" | 21 #include "ui/events/devices/input_device.h" |
| 21 #include "ui/events/devices/input_device_manager.h" | 22 #include "ui/events/devices/input_device_manager.h" |
| 22 #include "ui/events/devices/touchscreen_device.h" | 23 #include "ui/events/devices/touchscreen_device.h" |
| 23 #include "ui/keyboard/keyboard_controller.h" | 24 #include "ui/keyboard/keyboard_controller.h" |
| 24 #include "ui/keyboard/keyboard_switches.h" | 25 #include "ui/keyboard/keyboard_switches.h" |
| 25 #include "ui/keyboard/keyboard_util.h" | 26 #include "ui/keyboard/keyboard_util.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 DCHECK(keyboard::KeyboardController::GetInstance() != nullptr); | 133 DCHECK(keyboard::KeyboardController::GetInstance() != nullptr); |
| 133 | 134 |
| 134 aura::Window* container = | 135 aura::Window* container = |
| 135 keyboard::KeyboardController::GetInstance()->GetContainerWindow(); | 136 keyboard::KeyboardController::GetInstance()->GetContainerWindow(); |
| 136 DCHECK(container != nullptr); | 137 DCHECK(container != nullptr); |
| 137 | 138 |
| 138 const display::Screen* screen = display::Screen::GetScreen(); | 139 const display::Screen* screen = display::Screen::GetScreen(); |
| 139 const display::Display current_display = | 140 const display::Display current_display = |
| 140 screen->GetDisplayNearestWindow(container); | 141 screen->GetDisplayNearestWindow(container); |
| 141 | 142 |
| 142 if (WmShell::Get()->GetFocusedWindow() != nullptr) { | 143 if (wm::GetFocusedWindow() != nullptr) { |
| 143 // Move the virtual keyboard to the focused display if that display has | 144 // Move the virtual keyboard to the focused display if that display has |
| 144 // touch capability or keyboard is locked | 145 // touch capability or keyboard is locked |
| 145 const display::Display focused_display = | 146 const display::Display focused_display = |
| 146 WmShell::Get()->GetFocusedWindow()->GetDisplayNearestWindow(); | 147 WmWindow::Get(wm::GetFocusedWindow())->GetDisplayNearestWindow(); |
| 147 if (current_display.id() != focused_display.id() && | 148 if (current_display.id() != focused_display.id() && |
| 148 focused_display.id() != display::kInvalidDisplayId && | 149 focused_display.id() != display::kInvalidDisplayId && |
| 149 focused_display.touch_support() == | 150 focused_display.touch_support() == |
| 150 display::Display::TouchSupport::TOUCH_SUPPORT_AVAILABLE) { | 151 display::Display::TouchSupport::TOUCH_SUPPORT_AVAILABLE) { |
| 151 MoveKeyboardToDisplayInternal(focused_display.id()); | 152 MoveKeyboardToDisplayInternal(focused_display.id()); |
| 152 return; | 153 return; |
| 153 } | 154 } |
| 154 } | 155 } |
| 155 | 156 |
| 156 if (current_display.touch_support() != | 157 if (current_display.touch_support() != |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 if (is_enabled == was_enabled) | 211 if (is_enabled == was_enabled) |
| 211 return; | 212 return; |
| 212 if (is_enabled) { | 213 if (is_enabled) { |
| 213 Shell::GetInstance()->CreateKeyboard(); | 214 Shell::GetInstance()->CreateKeyboard(); |
| 214 } else { | 215 } else { |
| 215 Shell::GetInstance()->DeactivateKeyboard(); | 216 Shell::GetInstance()->DeactivateKeyboard(); |
| 216 } | 217 } |
| 217 } | 218 } |
| 218 | 219 |
| 219 } // namespace ash | 220 } // namespace ash |
| OLD | NEW |