| 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/policy/browser_policy_connector_chromeos.h" | 15 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 17 #include "chrome/browser/chromeos/policy/consumer_management_service.h" | 16 #include "chrome/browser/chromeos/policy/consumer_management_service.h" |
| 18 #include "chrome/browser/chromeos/system/input_device_settings.h" | 17 #include "chrome/browser/chromeos/system/input_device_settings.h" |
| 19 #include "chrome/browser/extensions/signin/gaia_auth_extension_loader.h" | 18 #include "chrome/browser/extensions/signin/gaia_auth_extension_loader.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/ui/webui/about_ui.h" | 20 #include "chrome/browser/ui/webui/about_ui.h" |
| 22 #include "chrome/browser/ui/webui/chromeos/login/app_launch_splash_screen_handle
r.h" | 21 #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" | 22 #include "chrome/browser/ui/webui/chromeos/login/auto_enrollment_check_screen_ha
ndler.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 OobeUI::kLoginDisplay, | 63 OobeUI::kLoginDisplay, |
| 65 OobeUI::kLockDisplay, | 64 OobeUI::kLockDisplay, |
| 66 OobeUI::kUserAddingDisplay, | 65 OobeUI::kUserAddingDisplay, |
| 67 OobeUI::kAppLaunchSplashDisplay | 66 OobeUI::kAppLaunchSplashDisplay |
| 68 }; | 67 }; |
| 69 | 68 |
| 70 const char kStringsJSPath[] = "strings.js"; | 69 const char kStringsJSPath[] = "strings.js"; |
| 71 const char kLoginJSPath[] = "login.js"; | 70 const char kLoginJSPath[] = "login.js"; |
| 72 const char kOobeJSPath[] = "oobe.js"; | 71 const char kOobeJSPath[] = "oobe.js"; |
| 73 const char kKeyboardUtilsJSPath[] = "keyboard_utils.js"; | 72 const char kKeyboardUtilsJSPath[] = "keyboard_utils.js"; |
| 74 const char kDemoUserLoginJSPath[] = "demo_user_login.js"; | |
| 75 | 73 |
| 76 // Paths for deferred resource loading. | 74 // Paths for deferred resource loading. |
| 77 const char kEnrollmentHTMLPath[] = "enrollment.html"; | 75 const char kEnrollmentHTMLPath[] = "enrollment.html"; |
| 78 const char kEnrollmentCSSPath[] = "enrollment.css"; | 76 const char kEnrollmentCSSPath[] = "enrollment.css"; |
| 79 const char kEnrollmentJSPath[] = "enrollment.js"; | 77 const char kEnrollmentJSPath[] = "enrollment.js"; |
| 80 | 78 |
| 81 void AddPolymerResourcesPaths(content::WebUIDataSource* source) { | 79 void AddPolymerResourcesPaths(content::WebUIDataSource* source) { |
| 82 for (const auto& mapping: GetPolymerResourcesMap()) | 80 for (const auto& mapping: GetPolymerResourcesMap()) |
| 83 source->AddResourcePath(mapping.first, mapping.second); | 81 source->AddResourcePath(mapping.first, mapping.second); |
| 84 } | 82 } |
| 85 | 83 |
| 86 // Creates a WebUIDataSource for chrome://oobe | 84 // Creates a WebUIDataSource for chrome://oobe |
| 87 content::WebUIDataSource* CreateOobeUIDataSource( | 85 content::WebUIDataSource* CreateOobeUIDataSource( |
| 88 const base::DictionaryValue& localized_strings, | 86 const base::DictionaryValue& localized_strings, |
| 89 const std::string& display_type) { | 87 const std::string& display_type) { |
| 90 content::WebUIDataSource* source = | 88 content::WebUIDataSource* source = |
| 91 content::WebUIDataSource::Create(chrome::kChromeUIOobeHost); | 89 content::WebUIDataSource::Create(chrome::kChromeUIOobeHost); |
| 92 source->AddLocalizedStrings(localized_strings); | 90 source->AddLocalizedStrings(localized_strings); |
| 93 source->SetJsonPath(kStringsJSPath); | 91 source->SetJsonPath(kStringsJSPath); |
| 94 | 92 |
| 95 if (chromeos::KioskModeSettings::Get()->IsKioskModeEnabled()) { | |
| 96 source->SetDefaultResource(IDR_DEMO_USER_LOGIN_HTML); | |
| 97 source->AddResourcePath(kDemoUserLoginJSPath, IDR_DEMO_USER_LOGIN_JS); | |
| 98 return source; | |
| 99 } | |
| 100 if (display_type == OobeUI::kOobeDisplay) { | 93 if (display_type == OobeUI::kOobeDisplay) { |
| 101 source->SetDefaultResource(IDR_OOBE_HTML); | 94 source->SetDefaultResource(IDR_OOBE_HTML); |
| 102 source->AddResourcePath(kOobeJSPath, IDR_OOBE_JS); | 95 source->AddResourcePath(kOobeJSPath, IDR_OOBE_JS); |
| 103 } else { | 96 } else { |
| 104 source->SetDefaultResource(IDR_LOGIN_HTML); | 97 source->SetDefaultResource(IDR_LOGIN_HTML); |
| 105 source->AddResourcePath(kLoginJSPath, IDR_LOGIN_JS); | 98 source->AddResourcePath(kLoginJSPath, IDR_LOGIN_JS); |
| 106 } | 99 } |
| 107 source->AddResourcePath(kKeyboardUtilsJSPath, IDR_KEYBOARD_UTILS_JS); | 100 source->AddResourcePath(kKeyboardUtilsJSPath, IDR_KEYBOARD_UTILS_JS); |
| 108 source->OverrideContentSecurityPolicyFrameSrc( | 101 source->OverrideContentSecurityPolicyFrameSrc( |
| 109 base::StringPrintf( | 102 base::StringPrintf( |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 bool OobeUI::IsJSReady(const base::Closure& display_is_ready_callback) { | 502 bool OobeUI::IsJSReady(const base::Closure& display_is_ready_callback) { |
| 510 if (!ready_) | 503 if (!ready_) |
| 511 ready_callbacks_.push_back(display_is_ready_callback); | 504 ready_callbacks_.push_back(display_is_ready_callback); |
| 512 return ready_; | 505 return ready_; |
| 513 } | 506 } |
| 514 | 507 |
| 515 void OobeUI::ShowOobeUI(bool show) { | 508 void OobeUI::ShowOobeUI(bool show) { |
| 516 core_handler_->ShowOobeUI(show); | 509 core_handler_->ShowOobeUI(show); |
| 517 } | 510 } |
| 518 | 511 |
| 519 void OobeUI::ShowRetailModeLoginSpinner() { | |
| 520 signin_screen_handler_->ShowRetailModeLoginSpinner(); | |
| 521 } | |
| 522 | |
| 523 void OobeUI::ShowSigninScreen(const LoginScreenContext& context, | 512 void OobeUI::ShowSigninScreen(const LoginScreenContext& context, |
| 524 SigninScreenHandlerDelegate* delegate, | 513 SigninScreenHandlerDelegate* delegate, |
| 525 NativeWindowDelegate* native_window_delegate) { | 514 NativeWindowDelegate* native_window_delegate) { |
| 526 signin_screen_handler_->SetDelegate(delegate); | 515 signin_screen_handler_->SetDelegate(delegate); |
| 527 signin_screen_handler_->SetNativeWindowDelegate(native_window_delegate); | 516 signin_screen_handler_->SetNativeWindowDelegate(native_window_delegate); |
| 528 | 517 |
| 529 LoginScreenContext actual_context(context); | 518 LoginScreenContext actual_context(context); |
| 530 actual_context.set_oobe_ui(core_handler_->show_oobe_ui()); | 519 actual_context.set_oobe_ui(core_handler_->show_oobe_ui()); |
| 531 signin_screen_handler_->Show(actual_context); | 520 signin_screen_handler_->Show(actual_context); |
| 532 } | 521 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 555 DCHECK(screen_ids_.count(screen)) | 544 DCHECK(screen_ids_.count(screen)) |
| 556 << "Screen should be registered in InitializeScreenMaps()"; | 545 << "Screen should be registered in InitializeScreenMaps()"; |
| 557 Screen new_screen = screen_ids_[screen]; | 546 Screen new_screen = screen_ids_[screen]; |
| 558 FOR_EACH_OBSERVER(Observer, | 547 FOR_EACH_OBSERVER(Observer, |
| 559 observer_list_, | 548 observer_list_, |
| 560 OnCurrentScreenChanged(current_screen_, new_screen)); | 549 OnCurrentScreenChanged(current_screen_, new_screen)); |
| 561 current_screen_ = new_screen; | 550 current_screen_ = new_screen; |
| 562 } | 551 } |
| 563 | 552 |
| 564 } // namespace chromeos | 553 } // namespace chromeos |
| OLD | NEW |