Chromium Code Reviews| Index: chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.cc |
| diff --git a/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.cc b/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0384637bcd156a48670cd3b554918ba8c510e426 |
| --- /dev/null |
| +++ b/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.cc |
| @@ -0,0 +1,53 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.h" |
| + |
| +#include "ash/display/display_configuration_controller.h" |
| +#include "ash/shell.h" |
| +#include "ui/display/display.h" |
| +#include "ui/display/manager/display_manager.h" |
| +#include "ui/display/screen.h" |
| + |
| +namespace chromeos { |
| + |
| +namespace { |
| + |
| +bool TouchSupportAvailable(const display::Display& display) { |
| + return display.touch_support() == |
| + display::Display::TouchSupport::TOUCH_SUPPORT_AVAILABLE; |
| +} |
| + |
| +} // namespace |
| + |
| +OobeDisplayChooser::OobeDisplayChooser() {} |
| + |
| +OobeDisplayChooser::~OobeDisplayChooser() {} |
| + |
| +void OobeDisplayChooser::TryToPlaceUiOnTouchDisplay() { |
| + display::Display primary_display = |
| + display::Screen::GetScreen()->GetPrimaryDisplay(); |
| + |
| + if (primary_display.is_valid() && !TouchSupportAvailable(primary_display)) |
| + MoveToTouchDisplay(); |
| +} |
| + |
| +void OobeDisplayChooser::MoveToTouchDisplay() { |
| + auto& displays = |
|
jdufault
2017/05/09 18:59:38
nit: auto& type is not obvious
|
| + ash::Shell::Get()->display_manager()->active_only_display_list(); |
| + |
| + if (displays.size() <= 1) |
| + return; |
| + |
| + for (auto& display : displays) { |
| + if (TouchSupportAvailable(display)) { |
| + ash::Shell::Get() |
| + ->display_configuration_controller() |
| + ->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
|
| + break; |
| + } |
| + } |
| +} |
| + |
| +} // namespace chromeos |