Chromium Code Reviews| 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/manager/display_manager.h" | |
| 11 #include "ui/display/screen.h" | |
| 12 | |
| 13 namespace chromeos { | |
| 14 | |
| 15 namespace { | |
| 16 | |
| 17 bool TouchSupportAvailable(const display::Display& display) { | |
| 18 return display.touch_support() == | |
| 19 display::Display::TouchSupport::TOUCH_SUPPORT_AVAILABLE; | |
| 20 } | |
| 21 | |
| 22 } // namespace | |
| 23 | |
| 24 OobeDisplayChooser::OobeDisplayChooser() {} | |
| 25 | |
| 26 OobeDisplayChooser::~OobeDisplayChooser() {} | |
| 27 | |
| 28 void OobeDisplayChooser::TryToPlaceUiOnTouchDisplay() { | |
| 29 display::Display primary_display = | |
| 30 display::Screen::GetScreen()->GetPrimaryDisplay(); | |
| 31 | |
| 32 if (primary_display.is_valid() && !TouchSupportAvailable(primary_display)) | |
| 33 MoveToTouchDisplay(); | |
| 34 } | |
| 35 | |
| 36 void OobeDisplayChooser::MoveToTouchDisplay() { | |
| 37 auto& displays = | |
|
jdufault
2017/05/09 18:59:38
nit: auto& type is not obvious
| |
| 38 ash::Shell::Get()->display_manager()->active_only_display_list(); | |
| 39 | |
| 40 if (displays.size() <= 1) | |
| 41 return; | |
| 42 | |
| 43 for (auto& display : displays) { | |
| 44 if (TouchSupportAvailable(display)) { | |
| 45 ash::Shell::Get() | |
| 46 ->display_configuration_controller() | |
| 47 ->SetPrimaryDisplayId(display.id()); | |
|
oshima
2017/05/10 00:14:31
IIRC that this change will be saved locally, so
th
Felix Ekblom
2017/05/10 10:59:13
Thanks for pointing it out. I believe this to be O
| |
| 48 break; | |
| 49 } | |
| 50 } | |
| 51 } | |
| 52 | |
| 53 } // namespace chromeos | |
| OLD | NEW |