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

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

Issue 2865003003: Put OOBE UI on touch display if no keyboard detected (Closed)
Patch Set: Add TODO and link to bug 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
« no previous file with comments | « chrome/browser/ui/webui/chromeos/login/oobe_ui.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" 5 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "chrome/browser/ui/webui/chromeos/login/eula_screen_handler.h" 44 #include "chrome/browser/ui/webui/chromeos/login/eula_screen_handler.h"
45 #include "chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h" 45 #include "chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h"
46 #include "chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.h" 46 #include "chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.h"
47 #include "chrome/browser/ui/webui/chromeos/login/host_pairing_screen_handler.h" 47 #include "chrome/browser/ui/webui/chromeos/login/host_pairing_screen_handler.h"
48 #include "chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.h" 48 #include "chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.h"
49 #include "chrome/browser/ui/webui/chromeos/login/kiosk_autolaunch_screen_handler .h" 49 #include "chrome/browser/ui/webui/chromeos/login/kiosk_autolaunch_screen_handler .h"
50 #include "chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.h" 50 #include "chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.h"
51 #include "chrome/browser/ui/webui/chromeos/login/network_dropdown_handler.h" 51 #include "chrome/browser/ui/webui/chromeos/login/network_dropdown_handler.h"
52 #include "chrome/browser/ui/webui/chromeos/login/network_screen_handler.h" 52 #include "chrome/browser/ui/webui/chromeos/login/network_screen_handler.h"
53 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" 53 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h"
54 #include "chrome/browser/ui/webui/chromeos/login/oobe_display_chooser.h"
54 #include "chrome/browser/ui/webui/chromeos/login/reset_screen_handler.h" 55 #include "chrome/browser/ui/webui/chromeos/login/reset_screen_handler.h"
55 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" 56 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
56 #include "chrome/browser/ui/webui/chromeos/login/supervised_user_creation_screen _handler.h" 57 #include "chrome/browser/ui/webui/chromeos/login/supervised_user_creation_screen _handler.h"
57 #include "chrome/browser/ui/webui/chromeos/login/terms_of_service_screen_handler .h" 58 #include "chrome/browser/ui/webui/chromeos/login/terms_of_service_screen_handler .h"
58 #include "chrome/browser/ui/webui/chromeos/login/update_screen_handler.h" 59 #include "chrome/browser/ui/webui/chromeos/login/update_screen_handler.h"
59 #include "chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.h" 60 #include "chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.h"
60 #include "chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.h" 61 #include "chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.h"
61 #include "chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.h" 62 #include "chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.h"
62 #include "chrome/browser/ui/webui/chromeos/network_element_localized_strings_pro vider.h" 63 #include "chrome/browser/ui/webui/chromeos/network_element_localized_strings_pro vider.h"
63 #include "chrome/browser/ui/webui/options/chromeos/user_image_source.h" 64 #include "chrome/browser/ui/webui/options/chromeos/user_image_source.h"
64 #include "chrome/browser/ui/webui/test_files_request_filter.h" 65 #include "chrome/browser/ui/webui/test_files_request_filter.h"
65 #include "chrome/browser/ui/webui/theme_source.h" 66 #include "chrome/browser/ui/webui/theme_source.h"
66 #include "chrome/common/chrome_constants.h" 67 #include "chrome/common/chrome_constants.h"
67 #include "chrome/common/chrome_switches.h" 68 #include "chrome/common/chrome_switches.h"
68 #include "chrome/common/pref_names.h" 69 #include "chrome/common/pref_names.h"
69 #include "chrome/common/url_constants.h" 70 #include "chrome/common/url_constants.h"
70 #include "chrome/grit/browser_resources.h" 71 #include "chrome/grit/browser_resources.h"
71 #include "chrome/grit/chrome_unscaled_resources.h" 72 #include "chrome/grit/chrome_unscaled_resources.h"
72 #include "chrome/grit/component_extension_resources.h" 73 #include "chrome/grit/component_extension_resources.h"
73 #include "chromeos/chromeos_switches.h" 74 #include "chromeos/chromeos_switches.h"
74 #include "components/policy/core/common/cloud/cloud_policy_constants.h" 75 #include "components/policy/core/common/cloud/cloud_policy_constants.h"
75 #include "components/prefs/pref_service.h" 76 #include "components/prefs/pref_service.h"
76 #include "content/public/browser/web_ui.h" 77 #include "content/public/browser/web_ui.h"
77 #include "content/public/browser/web_ui_data_source.h" 78 #include "content/public/browser/web_ui_data_source.h"
78 #include "content/public/common/content_switches.h" 79 #include "content/public/common/content_switches.h"
79 #include "ui/base/resource/resource_bundle.h" 80 #include "ui/base/resource/resource_bundle.h"
80 #include "ui/base/webui/web_ui_util.h" 81 #include "ui/base/webui/web_ui_util.h"
82 #include "ui/display/display.h"
83 #include "ui/events/devices/input_device.h"
84 #include "ui/events/devices/input_device_manager.h"
81 85
82 namespace chromeos { 86 namespace chromeos {
83 87
84 namespace { 88 namespace {
85 89
86 const char* kKnownDisplayTypes[] = {OobeUI::kOobeDisplay, 90 const char* kKnownDisplayTypes[] = {OobeUI::kOobeDisplay,
87 OobeUI::kLoginDisplay, 91 OobeUI::kLoginDisplay,
88 OobeUI::kLockDisplay, 92 OobeUI::kLockDisplay,
89 OobeUI::kUserAddingDisplay, 93 OobeUI::kUserAddingDisplay,
90 OobeUI::kAppLaunchSplashDisplay, 94 OobeUI::kAppLaunchSplashDisplay,
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 std::string path = url.path().size() ? url.path().substr(1) : ""; 204 std::string path = url.path().size() ? url.path().substr(1) : "";
201 if (std::find(kKnownDisplayTypes, 205 if (std::find(kKnownDisplayTypes,
202 kKnownDisplayTypes + arraysize(kKnownDisplayTypes), 206 kKnownDisplayTypes + arraysize(kKnownDisplayTypes),
203 path) == kKnownDisplayTypes + arraysize(kKnownDisplayTypes)) { 207 path) == kKnownDisplayTypes + arraysize(kKnownDisplayTypes)) {
204 LOG(ERROR) << "Unknown display type '" << path << "'. Setting default."; 208 LOG(ERROR) << "Unknown display type '" << path << "'. Setting default.";
205 return OobeUI::kLoginDisplay; 209 return OobeUI::kLoginDisplay;
206 } 210 }
207 return path; 211 return path;
208 } 212 }
209 213
214 bool IsKeyboardConnected() {
215 const std::vector<ui::InputDevice>& keyboards =
216 ui::InputDeviceManager::GetInstance()->GetKeyboardDevices();
217 for (const ui::InputDevice& keyboard : keyboards) {
218 if (keyboard.type == ui::INPUT_DEVICE_INTERNAL ||
219 keyboard.type == ui::INPUT_DEVICE_EXTERNAL) {
220 return true;
221 }
222 }
223
224 return false;
225 }
226
210 } // namespace 227 } // namespace
211 228
212 // static 229 // static
213 const char OobeUI::kOobeDisplay[] = "oobe"; 230 const char OobeUI::kOobeDisplay[] = "oobe";
214 const char OobeUI::kLoginDisplay[] = "login"; 231 const char OobeUI::kLoginDisplay[] = "login";
215 const char OobeUI::kLockDisplay[] = "lock"; 232 const char OobeUI::kLockDisplay[] = "lock";
216 const char OobeUI::kUserAddingDisplay[] = "user-adding"; 233 const char OobeUI::kUserAddingDisplay[] = "user-adding";
217 const char OobeUI::kAppLaunchSplashDisplay[] = "app-launch-splash"; 234 const char OobeUI::kAppLaunchSplashDisplay[] = "app-launch-splash";
218 const char OobeUI::kArcKioskSplashDisplay[] = "arc-kiosk-splash"; 235 const char OobeUI::kArcKioskSplashDisplay[] = "arc-kiosk-splash";
219 236
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 network_element::AddLocalizedStrings(html_source); 347 network_element::AddLocalizedStrings(html_source);
331 348
332 // Set up the chrome://userimage/ source. 349 // Set up the chrome://userimage/ source.
333 options::UserImageSource* user_image_source = 350 options::UserImageSource* user_image_source =
334 new options::UserImageSource(); 351 new options::UserImageSource();
335 content::URLDataSource::Add(profile, user_image_source); 352 content::URLDataSource::Add(profile, user_image_source);
336 353
337 // TabHelper is required for OOBE webui to make webview working on it. 354 // TabHelper is required for OOBE webui to make webview working on it.
338 content::WebContents* contents = web_ui->GetWebContents(); 355 content::WebContents* contents = web_ui->GetWebContents();
339 extensions::TabHelper::CreateForWebContents(contents); 356 extensions::TabHelper::CreateForWebContents(contents);
357
358 // TODO(felixe): Display iteration and primary display selection not supported
359 // in Mash. See http://crbug.com/720917.
360 if (!ash_util::IsRunningInMash() && !IsKeyboardConnected())
361 oobe_display_chooser_ = base::MakeUnique<OobeDisplayChooser>();
340 } 362 }
341 363
342 OobeUI::~OobeUI() { 364 OobeUI::~OobeUI() {
343 network_dropdown_handler_->RemoveObserver(GetView<ErrorScreenHandler>()); 365 network_dropdown_handler_->RemoveObserver(GetView<ErrorScreenHandler>());
344 if (ash_util::IsRunningInMash()) { 366 if (ash_util::IsRunningInMash()) {
345 // TODO: Ash needs to expose screen dimming api. See 367 // TODO: Ash needs to expose screen dimming api. See
346 // http://crbug.com/646034. 368 // http://crbug.com/646034.
347 NOTIMPLEMENTED(); 369 NOTIMPLEMENTED();
348 } 370 }
349 } 371 }
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 } 575 }
554 576
555 bool OobeUI::IsJSReady(const base::Closure& display_is_ready_callback) { 577 bool OobeUI::IsJSReady(const base::Closure& display_is_ready_callback) {
556 if (!ready_) 578 if (!ready_)
557 ready_callbacks_.push_back(display_is_ready_callback); 579 ready_callbacks_.push_back(display_is_ready_callback);
558 return ready_; 580 return ready_;
559 } 581 }
560 582
561 void OobeUI::ShowOobeUI(bool show) { 583 void OobeUI::ShowOobeUI(bool show) {
562 core_handler_->ShowOobeUI(show); 584 core_handler_->ShowOobeUI(show);
585
586 if (show && oobe_display_chooser_)
587 oobe_display_chooser_->TryToPlaceUiOnTouchDisplay();
563 } 588 }
564 589
565 void OobeUI::ShowSigninScreen(const LoginScreenContext& context, 590 void OobeUI::ShowSigninScreen(const LoginScreenContext& context,
566 SigninScreenHandlerDelegate* delegate, 591 SigninScreenHandlerDelegate* delegate,
567 NativeWindowDelegate* native_window_delegate) { 592 NativeWindowDelegate* native_window_delegate) {
568 // Check our device mode. 593 // Check our device mode.
569 policy::BrowserPolicyConnectorChromeOS* connector = 594 policy::BrowserPolicyConnectorChromeOS* connector =
570 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 595 g_browser_process->platform_part()->browser_policy_connector_chromeos();
571 if (connector->GetDeviceMode() == policy::DEVICE_MODE_LEGACY_RETAIL_MODE) { 596 if (connector->GetDeviceMode() == policy::DEVICE_MODE_LEGACY_RETAIL_MODE) {
572 // If we're in legacy retail mode, the best thing we can do is launch the 597 // If we're in legacy retail mode, the best thing we can do is launch the
(...skipping 28 matching lines...) Expand all
601 if (oobe_ui_md_mode_ == 626 if (oobe_ui_md_mode_ ==
602 g_browser_process->local_state()->GetBoolean(prefs::kOobeMdMode)) { 627 g_browser_process->local_state()->GetBoolean(prefs::kOobeMdMode)) {
603 return; 628 return;
604 } 629 }
605 630
606 base::DictionaryValue localized_strings; 631 base::DictionaryValue localized_strings;
607 GetLocalizedStrings(&localized_strings); 632 GetLocalizedStrings(&localized_strings);
608 static_cast<CoreOobeView*>(core_handler_)->ReloadContent(localized_strings); 633 static_cast<CoreOobeView*>(core_handler_)->ReloadContent(localized_strings);
609 } 634 }
610 635
636 void OobeUI::OnDisplayConfigurationChanged() {
637 if (oobe_display_chooser_)
638 oobe_display_chooser_->TryToPlaceUiOnTouchDisplay();
639 }
640
611 } // namespace chromeos 641 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chromeos/login/oobe_ui.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698