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" | 13 #include "chrome/browser/chromeos/legacy_retail_mode_detector.h" |
| 14 #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen_ actor.h" | 14 #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen_ actor.h" |
| 15 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen_actor.h" | 15 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen_actor.h" |
| 16 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | |
| 17 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | |
| 16 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 18 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 17 #include "chrome/browser/chromeos/policy/consumer_management_service.h" | 19 #include "chrome/browser/chromeos/policy/consumer_management_service.h" |
| 18 #include "chrome/browser/chromeos/system/input_device_settings.h" | 20 #include "chrome/browser/chromeos/system/input_device_settings.h" |
| 19 #include "chrome/browser/extensions/signin/gaia_auth_extension_loader.h" | 21 #include "chrome/browser/extensions/signin/gaia_auth_extension_loader.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/ui/webui/about_ui.h" | 23 #include "chrome/browser/ui/webui/about_ui.h" |
| 22 #include "chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handle r.h" | 24 #include "chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handle r.h" |
| 23 #include "chrome/browser/ui/webui/chromeos/login/auto_enrollment_check_screen_ha ndler.h" | 25 #include "chrome/browser/ui/webui/chromeos/login/auto_enrollment_check_screen_ha ndler.h" |
| 24 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" | 26 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" |
| 25 #include "chrome/browser/ui/webui/chromeos/login/controller_pairing_screen_handl er.h" | 27 #include "chrome/browser/ui/webui/chromeos/login/controller_pairing_screen_handl er.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 OobeUI::kLoginDisplay, | 68 OobeUI::kLoginDisplay, |
| 67 OobeUI::kLockDisplay, | 69 OobeUI::kLockDisplay, |
| 68 OobeUI::kUserAddingDisplay, | 70 OobeUI::kUserAddingDisplay, |
| 69 OobeUI::kAppLaunchSplashDisplay | 71 OobeUI::kAppLaunchSplashDisplay |
| 70 }; | 72 }; |
| 71 | 73 |
| 72 const char kStringsJSPath[] = "strings.js"; | 74 const char kStringsJSPath[] = "strings.js"; |
| 73 const char kLoginJSPath[] = "login.js"; | 75 const char kLoginJSPath[] = "login.js"; |
| 74 const char kOobeJSPath[] = "oobe.js"; | 76 const char kOobeJSPath[] = "oobe.js"; |
| 75 const char kKeyboardUtilsJSPath[] = "keyboard_utils.js"; | 77 const char kKeyboardUtilsJSPath[] = "keyboard_utils.js"; |
| 76 const char kDemoUserLoginJSPath[] = "demo_user_login.js"; | |
| 77 const char kCustomElementsHTMLPath[] = "custom_elements.html"; | 78 const char kCustomElementsHTMLPath[] = "custom_elements.html"; |
| 78 const char kCustomElementsJSPath[] = "custom_elements.js"; | 79 const char kCustomElementsJSPath[] = "custom_elements.js"; |
| 79 | 80 |
| 80 // Paths for deferred resource loading. | 81 // Paths for deferred resource loading. |
| 81 const char kEnrollmentHTMLPath[] = "enrollment.html"; | 82 const char kEnrollmentHTMLPath[] = "enrollment.html"; |
| 82 const char kEnrollmentCSSPath[] = "enrollment.css"; | 83 const char kEnrollmentCSSPath[] = "enrollment.css"; |
| 83 const char kEnrollmentJSPath[] = "enrollment.js"; | 84 const char kEnrollmentJSPath[] = "enrollment.js"; |
| 84 | 85 |
| 85 void AddPolymerResourcesPaths(content::WebUIDataSource* source) { | 86 void AddPolymerResourcesPaths(content::WebUIDataSource* source) { |
| 86 for (const auto& mapping: GetPolymerResourcesMap()) | 87 for (const auto& mapping: GetPolymerResourcesMap()) |
| 87 source->AddResourcePath(mapping.first, mapping.second); | 88 source->AddResourcePath(mapping.first, mapping.second); |
| 88 } | 89 } |
| 89 | 90 |
| 90 // Creates a WebUIDataSource for chrome://oobe | 91 // Creates a WebUIDataSource for chrome://oobe |
| 91 content::WebUIDataSource* CreateOobeUIDataSource( | 92 content::WebUIDataSource* CreateOobeUIDataSource( |
| 92 const base::DictionaryValue& localized_strings, | 93 const base::DictionaryValue& localized_strings, |
| 93 const std::string& display_type) { | 94 const std::string& display_type) { |
| 94 content::WebUIDataSource* source = | 95 content::WebUIDataSource* source = |
| 95 content::WebUIDataSource::Create(chrome::kChromeUIOobeHost); | 96 content::WebUIDataSource::Create(chrome::kChromeUIOobeHost); |
| 96 source->AddLocalizedStrings(localized_strings); | 97 source->AddLocalizedStrings(localized_strings); |
| 97 source->SetJsonPath(kStringsJSPath); | 98 source->SetJsonPath(kStringsJSPath); |
| 98 | 99 |
| 99 if (chromeos::KioskModeSettings::Get()->IsKioskModeEnabled()) { | |
| 100 source->SetDefaultResource(IDR_DEMO_USER_LOGIN_HTML); | |
| 101 source->AddResourcePath(kDemoUserLoginJSPath, IDR_DEMO_USER_LOGIN_JS); | |
| 102 return source; | |
| 103 } | |
| 104 if (display_type == OobeUI::kOobeDisplay) { | 100 if (display_type == OobeUI::kOobeDisplay) { |
| 105 source->SetDefaultResource(IDR_OOBE_HTML); | 101 source->SetDefaultResource(IDR_OOBE_HTML); |
| 106 source->AddResourcePath(kOobeJSPath, IDR_OOBE_JS); | 102 source->AddResourcePath(kOobeJSPath, IDR_OOBE_JS); |
| 107 } else { | 103 } else { |
| 108 source->SetDefaultResource(IDR_LOGIN_HTML); | 104 source->SetDefaultResource(IDR_LOGIN_HTML); |
| 109 source->AddResourcePath(kLoginJSPath, IDR_LOGIN_JS); | 105 source->AddResourcePath(kLoginJSPath, IDR_LOGIN_JS); |
| 110 } | 106 } |
| 111 source->AddResourcePath(kKeyboardUtilsJSPath, IDR_KEYBOARD_UTILS_JS); | 107 source->AddResourcePath(kKeyboardUtilsJSPath, IDR_KEYBOARD_UTILS_JS); |
| 112 source->OverrideContentSecurityPolicyFrameSrc( | 108 source->OverrideContentSecurityPolicyFrameSrc( |
| 113 base::StringPrintf( | 109 base::StringPrintf( |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 545 bool OobeUI::IsJSReady(const base::Closure& display_is_ready_callback) { | 541 bool OobeUI::IsJSReady(const base::Closure& display_is_ready_callback) { |
| 546 if (!ready_) | 542 if (!ready_) |
| 547 ready_callbacks_.push_back(display_is_ready_callback); | 543 ready_callbacks_.push_back(display_is_ready_callback); |
| 548 return ready_; | 544 return ready_; |
| 549 } | 545 } |
| 550 | 546 |
| 551 void OobeUI::ShowOobeUI(bool show) { | 547 void OobeUI::ShowOobeUI(bool show) { |
| 552 core_handler_->ShowOobeUI(show); | 548 core_handler_->ShowOobeUI(show); |
| 553 } | 549 } |
| 554 | 550 |
| 555 void OobeUI::ShowRetailModeLoginSpinner() { | |
| 556 signin_screen_handler_->ShowRetailModeLoginSpinner(); | |
| 557 } | |
| 558 | |
| 559 void OobeUI::ShowSigninScreen(const LoginScreenContext& context, | 551 void OobeUI::ShowSigninScreen(const LoginScreenContext& context, |
| 560 SigninScreenHandlerDelegate* delegate, | 552 SigninScreenHandlerDelegate* delegate, |
| 561 NativeWindowDelegate* native_window_delegate) { | 553 NativeWindowDelegate* native_window_delegate) { |
| 554 if (chromeos::LegacyRetailModeDetector::Get()->IsKioskModeEnabled()) { | |
|
bartfab (slow)
2014/11/27 16:25:48
There is no need to introduce a singleton here. Ju
rkc
2014/12/01 19:15:05
Done.
| |
| 555 LoginDisplayHost* host = LoginDisplayHostImpl::default_host(); | |
| 556 host->StartDemoAppLaunch(); | |
| 557 } | |
| 558 | |
| 562 signin_screen_handler_->SetDelegate(delegate); | 559 signin_screen_handler_->SetDelegate(delegate); |
| 563 signin_screen_handler_->SetNativeWindowDelegate(native_window_delegate); | 560 signin_screen_handler_->SetNativeWindowDelegate(native_window_delegate); |
| 564 | 561 |
| 565 LoginScreenContext actual_context(context); | 562 LoginScreenContext actual_context(context); |
| 566 actual_context.set_oobe_ui(core_handler_->show_oobe_ui()); | 563 actual_context.set_oobe_ui(core_handler_->show_oobe_ui()); |
| 567 signin_screen_handler_->Show(actual_context); | 564 signin_screen_handler_->Show(actual_context); |
| 568 } | 565 } |
| 569 | 566 |
| 570 void OobeUI::ResetSigninScreenHandlerDelegate() { | 567 void OobeUI::ResetSigninScreenHandlerDelegate() { |
| 571 signin_screen_handler_->SetDelegate(NULL); | 568 signin_screen_handler_->SetDelegate(NULL); |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 591 DCHECK(screen_ids_.count(screen)) | 588 DCHECK(screen_ids_.count(screen)) |
| 592 << "Screen should be registered in InitializeScreenMaps()"; | 589 << "Screen should be registered in InitializeScreenMaps()"; |
| 593 Screen new_screen = screen_ids_[screen]; | 590 Screen new_screen = screen_ids_[screen]; |
| 594 FOR_EACH_OBSERVER(Observer, | 591 FOR_EACH_OBSERVER(Observer, |
| 595 observer_list_, | 592 observer_list_, |
| 596 OnCurrentScreenChanged(current_screen_, new_screen)); | 593 OnCurrentScreenChanged(current_screen_, new_screen)); |
| 597 current_screen_ = new_screen; | 594 current_screen_ = new_screen; |
| 598 } | 595 } |
| 599 | 596 |
| 600 } // namespace chromeos | 597 } // namespace chromeos |
| OLD | NEW |