| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.h" |
| 6 |
| 7 #include "ash/display/display_configuration_controller.h" |
| 8 #include "ash/shell.h" |
| 9 #include "ui/display/display.h" |
| 10 #include "ui/display/display_layout.h" |
| 11 #include "ui/display/manager/display_manager.h" |
| 12 #include "ui/display/screen.h" |
| 13 |
| 14 namespace chromeos { |
| 15 |
| 16 namespace { |
| 17 |
| 18 bool TouchSupportAvailable(const display::Display& display) { |
| 19 return display.touch_support() == |
| 20 display::Display::TouchSupport::TOUCH_SUPPORT_AVAILABLE; |
| 21 } |
| 22 |
| 23 } // namespace |
| 24 |
| 25 OobeDisplayChooser::OobeDisplayChooser() {} |
| 26 |
| 27 OobeDisplayChooser::~OobeDisplayChooser() {} |
| 28 |
| 29 void OobeDisplayChooser::TryToPlaceUiOnTouchDisplay() { |
| 30 display::Display primary_display = |
| 31 display::Screen::GetScreen()->GetPrimaryDisplay(); |
| 32 |
| 33 if (primary_display.is_valid() && !TouchSupportAvailable(primary_display)) |
| 34 MoveToTouchDisplay(); |
| 35 } |
| 36 |
| 37 void OobeDisplayChooser::MoveToTouchDisplay() { |
| 38 const display::Displays& displays = |
| 39 ash::Shell::Get()->display_manager()->active_only_display_list(); |
| 40 |
| 41 if (displays.size() <= 1) |
| 42 return; |
| 43 |
| 44 for (const display::Display& display : displays) { |
| 45 if (TouchSupportAvailable(display)) { |
| 46 ash::Shell::Get() |
| 47 ->display_configuration_controller() |
| 48 ->SetPrimaryDisplayId(display.id()); |
| 49 break; |
| 50 } |
| 51 } |
| 52 } |
| 53 |
| 54 } // namespace chromeos |
| OLD | NEW |