Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/browser_process_platform_part.h" | 12 #include "chrome/browser/browser_process_platform_part.h" |
| 13 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" | |
| 14 #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen_ actor.h" | 13 #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen_ actor.h" |
| 15 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen_actor.h" | 14 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen_actor.h" |
| 16 #include "chrome/browser/chromeos/login/screens/error_screen.h" | 15 #include "chrome/browser/chromeos/login/screens/error_screen.h" |
| 16 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | |
| 17 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | |
| 17 #include "chrome/browser/chromeos/login/wizard_controller.h" | 18 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 18 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 19 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 19 #include "chrome/browser/chromeos/policy/consumer_management_service.h" | 20 #include "chrome/browser/chromeos/policy/consumer_management_service.h" |
| 20 #include "chrome/browser/chromeos/system/input_device_settings.h" | 21 #include "chrome/browser/chromeos/system/input_device_settings.h" |
| 21 #include "chrome/browser/extensions/signin/gaia_auth_extension_loader.h" | 22 #include "chrome/browser/extensions/signin/gaia_auth_extension_loader.h" |
| 22 #include "chrome/browser/extensions/tab_helper.h" | 23 #include "chrome/browser/extensions/tab_helper.h" |
| 23 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
| 24 #include "chrome/browser/ui/webui/about_ui.h" | 25 #include "chrome/browser/ui/webui/about_ui.h" |
| 25 #include "chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handle r.h" | 26 #include "chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handle r.h" |
| 26 #include "chrome/browser/ui/webui/chromeos/login/auto_enrollment_check_screen_ha ndler.h" | 27 #include "chrome/browser/ui/webui/chromeos/login/auto_enrollment_check_screen_ha ndler.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 69 OobeUI::kLoginDisplay, | 70 OobeUI::kLoginDisplay, |
| 70 OobeUI::kLockDisplay, | 71 OobeUI::kLockDisplay, |
| 71 OobeUI::kUserAddingDisplay, | 72 OobeUI::kUserAddingDisplay, |
| 72 OobeUI::kAppLaunchSplashDisplay | 73 OobeUI::kAppLaunchSplashDisplay |
| 73 }; | 74 }; |
| 74 | 75 |
| 75 const char kStringsJSPath[] = "strings.js"; | 76 const char kStringsJSPath[] = "strings.js"; |
| 76 const char kLoginJSPath[] = "login.js"; | 77 const char kLoginJSPath[] = "login.js"; |
| 77 const char kOobeJSPath[] = "oobe.js"; | 78 const char kOobeJSPath[] = "oobe.js"; |
| 78 const char kKeyboardUtilsJSPath[] = "keyboard_utils.js"; | 79 const char kKeyboardUtilsJSPath[] = "keyboard_utils.js"; |
| 79 const char kDemoUserLoginJSPath[] = "demo_user_login.js"; | |
| 80 const char kCustomElementsHTMLPath[] = "custom_elements.html"; | 80 const char kCustomElementsHTMLPath[] = "custom_elements.html"; |
| 81 const char kCustomElementsJSPath[] = "custom_elements.js"; | 81 const char kCustomElementsJSPath[] = "custom_elements.js"; |
| 82 | 82 |
| 83 // Paths for deferred resource loading. | 83 // Paths for deferred resource loading. |
| 84 const char kEnrollmentHTMLPath[] = "enrollment.html"; | 84 const char kEnrollmentHTMLPath[] = "enrollment.html"; |
| 85 const char kEnrollmentCSSPath[] = "enrollment.css"; | 85 const char kEnrollmentCSSPath[] = "enrollment.css"; |
| 86 const char kEnrollmentJSPath[] = "enrollment.js"; | 86 const char kEnrollmentJSPath[] = "enrollment.js"; |
| 87 | 87 |
| 88 void AddPolymerResourcesPaths(content::WebUIDataSource* source) { | 88 void AddPolymerResourcesPaths(content::WebUIDataSource* source) { |
| 89 for (const auto& mapping: GetPolymerResourcesMap()) | 89 for (const auto& mapping: GetPolymerResourcesMap()) |
| 90 source->AddResourcePath(mapping.first, mapping.second); | 90 source->AddResourcePath(mapping.first, mapping.second); |
| 91 } | 91 } |
| 92 | 92 |
| 93 // Creates a WebUIDataSource for chrome://oobe | 93 // Creates a WebUIDataSource for chrome://oobe |
| 94 content::WebUIDataSource* CreateOobeUIDataSource( | 94 content::WebUIDataSource* CreateOobeUIDataSource( |
| 95 const base::DictionaryValue& localized_strings, | 95 const base::DictionaryValue& localized_strings, |
| 96 const std::string& display_type) { | 96 const std::string& display_type) { |
| 97 content::WebUIDataSource* source = | 97 content::WebUIDataSource* source = |
| 98 content::WebUIDataSource::Create(chrome::kChromeUIOobeHost); | 98 content::WebUIDataSource::Create(chrome::kChromeUIOobeHost); |
| 99 source->AddLocalizedStrings(localized_strings); | 99 source->AddLocalizedStrings(localized_strings); |
| 100 source->SetJsonPath(kStringsJSPath); | 100 source->SetJsonPath(kStringsJSPath); |
| 101 | 101 |
| 102 if (chromeos::KioskModeSettings::Get()->IsKioskModeEnabled()) { | |
| 103 source->SetDefaultResource(IDR_DEMO_USER_LOGIN_HTML); | |
| 104 source->AddResourcePath(kDemoUserLoginJSPath, IDR_DEMO_USER_LOGIN_JS); | |
| 105 return source; | |
| 106 } | |
| 107 if (display_type == OobeUI::kOobeDisplay) { | 102 if (display_type == OobeUI::kOobeDisplay) { |
| 108 source->SetDefaultResource(IDR_OOBE_HTML); | 103 source->SetDefaultResource(IDR_OOBE_HTML); |
| 109 source->AddResourcePath(kOobeJSPath, IDR_OOBE_JS); | 104 source->AddResourcePath(kOobeJSPath, IDR_OOBE_JS); |
| 110 } else { | 105 } else { |
| 111 source->SetDefaultResource(IDR_LOGIN_HTML); | 106 source->SetDefaultResource(IDR_LOGIN_HTML); |
| 112 source->AddResourcePath(kLoginJSPath, IDR_LOGIN_JS); | 107 source->AddResourcePath(kLoginJSPath, IDR_LOGIN_JS); |
| 113 } | 108 } |
| 114 source->AddResourcePath(kKeyboardUtilsJSPath, IDR_KEYBOARD_UTILS_JS); | 109 source->AddResourcePath(kKeyboardUtilsJSPath, IDR_KEYBOARD_UTILS_JS); |
| 115 source->OverrideContentSecurityPolicyFrameSrc( | 110 source->OverrideContentSecurityPolicyFrameSrc( |
| 116 base::StringPrintf( | 111 base::StringPrintf( |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 566 bool OobeUI::IsJSReady(const base::Closure& display_is_ready_callback) { | 561 bool OobeUI::IsJSReady(const base::Closure& display_is_ready_callback) { |
| 567 if (!ready_) | 562 if (!ready_) |
| 568 ready_callbacks_.push_back(display_is_ready_callback); | 563 ready_callbacks_.push_back(display_is_ready_callback); |
| 569 return ready_; | 564 return ready_; |
| 570 } | 565 } |
| 571 | 566 |
| 572 void OobeUI::ShowOobeUI(bool show) { | 567 void OobeUI::ShowOobeUI(bool show) { |
| 573 core_handler_->ShowOobeUI(show); | 568 core_handler_->ShowOobeUI(show); |
| 574 } | 569 } |
| 575 | 570 |
| 576 void OobeUI::ShowRetailModeLoginSpinner() { | |
| 577 signin_screen_handler_->ShowRetailModeLoginSpinner(); | |
| 578 } | |
| 579 | |
| 580 void OobeUI::ShowSigninScreen(const LoginScreenContext& context, | 571 void OobeUI::ShowSigninScreen(const LoginScreenContext& context, |
| 581 SigninScreenHandlerDelegate* delegate, | 572 SigninScreenHandlerDelegate* delegate, |
| 582 NativeWindowDelegate* native_window_delegate) { | 573 NativeWindowDelegate* native_window_delegate) { |
| 574 // Check our device mode. | |
| 575 if (g_browser_process) { | |
|
bartfab (slow)
2014/12/02 21:25:27
When do we run into |g_browser_process == nullptr|
rkc
2014/12/04 19:50:07
Done.
| |
| 576 policy::BrowserPolicyConnectorChromeOS* connector = | |
| 577 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | |
| 578 if (connector->GetDeviceMode() == policy::DEVICE_MODE_LEGACY_RETAIL_MODE) { | |
|
bartfab (slow)
2014/12/02 21:25:27
Nit: #include "components/policy/core/common/cloud
rkc
2014/12/04 19:50:07
Done.
| |
| 579 // If we're in legacy retail mode, the best thing we can do is launch the | |
| 580 // new offline demo mode. | |
| 581 LoginDisplayHost* host = LoginDisplayHostImpl::default_host(); | |
|
bartfab (slow)
2014/12/02 21:25:27
Nit 1: #include "chrome/browser/chromeos/login/ui/
rkc
2014/12/04 19:50:07
Already included.
| |
| 582 host->StartDemoAppLaunch(); | |
| 583 } | |
|
bartfab (slow)
2014/12/02 21:25:27
Return.
rkc
2014/12/04 19:50:07
Done.
| |
| 584 } | |
| 585 | |
| 583 signin_screen_handler_->SetDelegate(delegate); | 586 signin_screen_handler_->SetDelegate(delegate); |
| 584 signin_screen_handler_->SetNativeWindowDelegate(native_window_delegate); | 587 signin_screen_handler_->SetNativeWindowDelegate(native_window_delegate); |
| 585 | 588 |
| 586 LoginScreenContext actual_context(context); | 589 LoginScreenContext actual_context(context); |
| 587 actual_context.set_oobe_ui(core_handler_->show_oobe_ui()); | 590 actual_context.set_oobe_ui(core_handler_->show_oobe_ui()); |
| 588 signin_screen_handler_->Show(actual_context); | 591 signin_screen_handler_->Show(actual_context); |
| 589 } | 592 } |
| 590 | 593 |
| 591 void OobeUI::ResetSigninScreenHandlerDelegate() { | 594 void OobeUI::ResetSigninScreenHandlerDelegate() { |
| 592 signin_screen_handler_->SetDelegate(NULL); | 595 signin_screen_handler_->SetDelegate(NULL); |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 612 DCHECK(screen_ids_.count(screen)) | 615 DCHECK(screen_ids_.count(screen)) |
| 613 << "Screen should be registered in InitializeScreenMaps()"; | 616 << "Screen should be registered in InitializeScreenMaps()"; |
| 614 Screen new_screen = screen_ids_[screen]; | 617 Screen new_screen = screen_ids_[screen]; |
| 615 FOR_EACH_OBSERVER(Observer, | 618 FOR_EACH_OBSERVER(Observer, |
| 616 observer_list_, | 619 observer_list_, |
| 617 OnCurrentScreenChanged(current_screen_, new_screen)); | 620 OnCurrentScreenChanged(current_screen_, new_screen)); |
| 618 current_screen_ = new_screen; | 621 current_screen_ = new_screen; |
| 619 } | 622 } |
| 620 | 623 |
| 621 } // namespace chromeos | 624 } // namespace chromeos |
| OLD | NEW |