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