Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1615)

Unified Diff: chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.cc

Issue 2964823002: Remove confusing keyboard test & focus on input device (Closed)
Patch Set: Remove unnecessary check & include. Rename vector Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/webui/chromeos/login/oobe_display_chooser_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..7118b9f5ec4b410f04a938531f3bed478c73c192 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,17 @@
#include "chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.h"
+#include <stdint.h>
+
#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 +27,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,18 +58,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)
- 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))
+ continue;
+
+ int64_t display_id =
+ device_manager->GetTargetDisplayForTouchDevice(device.id);
+ if (display_id == display::kInvalidDisplayId)
+ continue;
+
+ ash::Shell::Get()->window_tree_host_manager()->SetPrimaryDisplayId(
+ display_id);
+ break;
}
}
« no previous file with comments | « no previous file | chrome/browser/ui/webui/chromeos/login/oobe_display_chooser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698