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 |
| index c15ebeaea036c60b6d6e1325240edd6758194913..627dd44809b3a50608d9c2d78230dcd011042f56 100644 |
| --- a/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.cc |
| +++ b/chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.cc |
| @@ -4,13 +4,19 @@ |
| #include "chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.h" |
| +#include <stdint.h> |
| + |
|
jdufault
2017/07/06 19:58:49
nit: merge these two include blocks
|
| +#include <algorithm> |
| + |
| #include "ash/display/window_tree_host_manager.h" |
| #include "ash/shell.h" |
| +#include "base/stl_util.h" |
| #include "content/public/browser/browser_thread.h" |
| #include "ui/display/display.h" |
| -#include "ui/display/display_layout.h" |
| #include "ui/display/manager/display_manager.h" |
| #include "ui/display/screen.h" |
| +#include "ui/events/devices/device_data_manager.h" |
| +#include "ui/events/devices/touchscreen_device.h" |
| using content::BrowserThread; |
| @@ -23,6 +29,9 @@ bool TouchSupportAvailable(const display::Display& display) { |
| display::Display::TouchSupport::TOUCH_SUPPORT_AVAILABLE; |
| } |
| +// TODO(felixe): More context at crbug.com/738885 |
| +const uint16_t kDeviceIds[] = {0x0457, 0x266e}; |
| + |
| } // namespace |
| OobeDisplayChooser::OobeDisplayChooser() : weak_ptr_factory_(this) {} |
| @@ -51,17 +60,21 @@ void OobeDisplayChooser::TryToPlaceUiOnTouchDisplay() { |
| void OobeDisplayChooser::MoveToTouchDisplay() { |
| DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| - const display::Displays& displays = |
| - ash::Shell::Get()->display_manager()->active_only_display_list(); |
| - |
| - if (displays.size() <= 1) |
| + if (!ui::DeviceDataManager::HasInstance()) |
| return; |
| - for (const display::Display& display : displays) { |
| - if (TouchSupportAvailable(display)) { |
| - ash::Shell::Get()->window_tree_host_manager()->SetPrimaryDisplayId( |
| - display.id()); |
| - break; |
| + const ui::DeviceDataManager* device_manager = |
| + ui::DeviceDataManager::GetInstance(); |
| + for (const ui::TouchscreenDevice& device : |
| + device_manager->GetTouchscreenDevices()) { |
| + if (base::ContainsValue(kDeviceIds, device.vendor_id)) { |
|
jdufault
2017/07/06 19:58:49
This code may be simpler with inverted ifs, ie,
f
|
| + int64_t display_id = |
| + device_manager->GetTargetDisplayForTouchDevice(device.id); |
| + if (display_id != display::kInvalidDisplayId) { |
| + ash::Shell::Get()->window_tree_host_manager()->SetPrimaryDisplayId( |
| + display_id); |
| + return; |
| + } |
| } |
| } |
| } |