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

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

Issue 2865003003: Put OOBE UI on touch display if no keyboard detected (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 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 // static
25 std::unique_ptr<OobeDisplayChooser> OobeDisplayChooser::CreateDefault() {
26 return base::MakeUnique<OobeDisplayChooser>(
27 ash::Shell::Get()->display_configuration_controller(),
28 ash::Shell::Get()->display_manager(), display::Screen::GetScreen());
29 }
30
31 OobeDisplayChooser::OobeDisplayChooser(
32 ash::DisplayConfigurationController* configuration_controller,
33 display::DisplayManager* display_manager,
34 display::Screen* screen)
35 : configuration_controller_(configuration_controller),
36 display_manager_(display_manager),
37 screen_(screen) {}
oshima 2017/05/09 05:58:45 Just getting these from Shell in the methods below
Felix Ekblom 2017/05/09 08:54:50 Yes, fixed now. I was hoping to mock them for the
38
39 OobeDisplayChooser::~OobeDisplayChooser() {}
40
41 void OobeDisplayChooser::TryToPlaceUIOnTouchDisplay() {
jdufault 2017/05/08 17:44:57 nit: UI -> Ui
42 auto primary_display = screen_->GetPrimaryDisplay();
jdufault 2017/05/08 17:44:58 nit: auto type is not obvious
43 if (primary_display.is_valid() && !TouchSupportAvailable(primary_display)) {
44 MoveToTouchDisplay();
jdufault 2017/05/08 17:44:58 nit: drop {}
45 }
46 }
47
48 void OobeDisplayChooser::OnDisplayAdded(const display::Display& new_display) {
jdufault 2017/05/08 17:44:57 |new_display| is never used, so remove this functi
49 TryToPlaceUIOnTouchDisplay();
50 }
51
52 void OobeDisplayChooser::MoveToTouchDisplay() {
53 auto& displays = display_manager_->active_only_display_list();
jdufault 2017/05/08 17:44:57 nit: auto type is not obvious
54
55 if (displays.size() <= 1) {
jdufault 2017/05/08 17:44:57 nit: drop {}
56 return;
57 }
58
59 for (auto& display : displays) {
60 if (TouchSupportAvailable(display)) {
61 configuration_controller_->SetPrimaryDisplayId(display.id());
62 return;
jdufault 2017/05/08 17:44:57 break?
63 }
64 }
65 }
66
67 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698