Chromium Code Reviews| Index: chrome/browser/ui/webui/chromeos/login/oobe_ui.cc |
| diff --git a/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc b/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc |
| index 325a77fc67cefa01b0b06224edf289c105d93dd6..c8d1cbd68c7c5210b8ae859794ef4c4049f42508 100644 |
| --- a/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc |
| +++ b/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc |
| @@ -51,6 +51,7 @@ |
| #include "chrome/browser/ui/webui/chromeos/login/network_dropdown_handler.h" |
| #include "chrome/browser/ui/webui/chromeos/login/network_screen_handler.h" |
| #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" |
| +#include "chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.h" |
| #include "chrome/browser/ui/webui/chromeos/login/reset_screen_handler.h" |
| #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
| #include "chrome/browser/ui/webui/chromeos/login/supervised_user_creation_screen_handler.h" |
| @@ -78,6 +79,9 @@ |
| #include "content/public/common/content_switches.h" |
| #include "ui/base/resource/resource_bundle.h" |
| #include "ui/base/webui/web_ui_util.h" |
| +#include "ui/display/display.h" |
| +#include "ui/events/devices/input_device.h" |
| +#include "ui/events/devices/input_device_manager.h" |
| namespace chromeos { |
| @@ -207,6 +211,18 @@ std::string GetDisplayType(const GURL& url) { |
| return path; |
| } |
| +bool IsKeyboardConnected() { |
| + auto& keyboards = ui::InputDeviceManager::GetInstance()->GetKeyboardDevices(); |
|
jdufault
2017/05/08 17:44:58
nit: auto type is not obvious
|
| + for (auto& keyboard : keyboards) { |
| + if (keyboard.type == ui::INPUT_DEVICE_INTERNAL || |
| + keyboard.type == ui::INPUT_DEVICE_EXTERNAL) { |
| + return true; |
| + } |
| + } |
| + |
| + return false; |
| +} |
| + |
| } // namespace |
| // static |
| @@ -337,6 +353,12 @@ OobeUI::OobeUI(content::WebUI* web_ui, const GURL& url) |
| // TabHelper is required for OOBE webui to make webview working on it. |
| content::WebContents* contents = web_ui->GetWebContents(); |
| extensions::TabHelper::CreateForWebContents(contents); |
| + |
| + if (!IsKeyboardConnected() && |
| + base::CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kOobePreferTouchDisplay)) { |
| + oobe_display_chooser_ = OobeDisplayChooser::CreateDefault(); |
| + } |
| } |
| OobeUI::~OobeUI() { |
| @@ -560,6 +582,10 @@ bool OobeUI::IsJSReady(const base::Closure& display_is_ready_callback) { |
| void OobeUI::ShowOobeUI(bool show) { |
| core_handler_->ShowOobeUI(show); |
| + |
| + if (show && oobe_display_chooser_) { |
| + oobe_display_chooser_->TryToPlaceUIOnTouchDisplay(); |
|
jdufault
2017/05/08 17:44:58
nit: no {}
|
| + } |
| } |
| void OobeUI::ShowSigninScreen(const LoginScreenContext& context, |
| @@ -608,4 +634,10 @@ void OobeUI::UpdateLocalizedStringsIfNeeded() { |
| static_cast<CoreOobeView*>(core_handler_)->ReloadContent(localized_strings); |
| } |
| +void OobeUI::OnDisplayAdded(const display::Display& new_display) { |
| + if (oobe_display_chooser_) { |
| + oobe_display_chooser_->OnDisplayAdded(new_display); |
|
jdufault
2017/05/08 17:44:58
nit: no {}
|
| + } |
| +} |
| + |
| } // namespace chromeos |