| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 OobeUI::kLoginDisplay, | 61 OobeUI::kLoginDisplay, |
| 63 OobeUI::kLockDisplay, | 62 OobeUI::kLockDisplay, |
| 64 OobeUI::kUserAddingDisplay, | 63 OobeUI::kUserAddingDisplay, |
| 65 OobeUI::kAppLaunchSplashDisplay | 64 OobeUI::kAppLaunchSplashDisplay |
| 66 }; | 65 }; |
| 67 | 66 |
| 68 const char kStringsJSPath[] = "strings.js"; | 67 const char kStringsJSPath[] = "strings.js"; |
| 69 const char kLoginJSPath[] = "login.js"; | 68 const char kLoginJSPath[] = "login.js"; |
| 70 const char kOobeJSPath[] = "oobe.js"; | 69 const char kOobeJSPath[] = "oobe.js"; |
| 71 const char kKeyboardUtilsJSPath[] = "keyboard_utils.js"; | 70 const char kKeyboardUtilsJSPath[] = "keyboard_utils.js"; |
| 72 const char kDemoUserLoginJSPath[] = "demo_user_login.js"; | |
| 73 | 71 |
| 74 // Paths for deferred resource loading. | 72 // Paths for deferred resource loading. |
| 75 const char kEnrollmentHTMLPath[] = "enrollment.html"; | 73 const char kEnrollmentHTMLPath[] = "enrollment.html"; |
| 76 const char kEnrollmentCSSPath[] = "enrollment.css"; | 74 const char kEnrollmentCSSPath[] = "enrollment.css"; |
| 77 const char kEnrollmentJSPath[] = "enrollment.js"; | 75 const char kEnrollmentJSPath[] = "enrollment.js"; |
| 78 | 76 |
| 79 // Creates a WebUIDataSource for chrome://oobe | 77 // Creates a WebUIDataSource for chrome://oobe |
| 80 content::WebUIDataSource* CreateOobeUIDataSource( | 78 content::WebUIDataSource* CreateOobeUIDataSource( |
| 81 const base::DictionaryValue& localized_strings, | 79 const base::DictionaryValue& localized_strings, |
| 82 const std::string& display_type) { | 80 const std::string& display_type) { |
| 83 content::WebUIDataSource* source = | 81 content::WebUIDataSource* source = |
| 84 content::WebUIDataSource::Create(chrome::kChromeUIOobeHost); | 82 content::WebUIDataSource::Create(chrome::kChromeUIOobeHost); |
| 85 source->AddLocalizedStrings(localized_strings); | 83 source->AddLocalizedStrings(localized_strings); |
| 86 source->SetJsonPath(kStringsJSPath); | 84 source->SetJsonPath(kStringsJSPath); |
| 87 | 85 |
| 88 if (chromeos::KioskModeSettings::Get()->IsKioskModeEnabled()) { | |
| 89 source->SetDefaultResource(IDR_DEMO_USER_LOGIN_HTML); | |
| 90 source->AddResourcePath(kDemoUserLoginJSPath, IDR_DEMO_USER_LOGIN_JS); | |
| 91 return source; | |
| 92 } | |
| 93 if (display_type == OobeUI::kOobeDisplay) { | 86 if (display_type == OobeUI::kOobeDisplay) { |
| 94 source->SetDefaultResource(IDR_OOBE_HTML); | 87 source->SetDefaultResource(IDR_OOBE_HTML); |
| 95 source->AddResourcePath(kOobeJSPath, IDR_OOBE_JS); | 88 source->AddResourcePath(kOobeJSPath, IDR_OOBE_JS); |
| 96 } else { | 89 } else { |
| 97 source->SetDefaultResource(IDR_LOGIN_HTML); | 90 source->SetDefaultResource(IDR_LOGIN_HTML); |
| 98 source->AddResourcePath(kLoginJSPath, IDR_LOGIN_JS); | 91 source->AddResourcePath(kLoginJSPath, IDR_LOGIN_JS); |
| 99 } | 92 } |
| 100 source->AddResourcePath(kKeyboardUtilsJSPath, IDR_KEYBOARD_UTILS_JS); | 93 source->AddResourcePath(kKeyboardUtilsJSPath, IDR_KEYBOARD_UTILS_JS); |
| 101 source->OverrideContentSecurityPolicyFrameSrc( | 94 source->OverrideContentSecurityPolicyFrameSrc( |
| 102 base::StringPrintf( | 95 base::StringPrintf( |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 bool OobeUI::IsJSReady(const base::Closure& display_is_ready_callback) { | 488 bool OobeUI::IsJSReady(const base::Closure& display_is_ready_callback) { |
| 496 if (!ready_) | 489 if (!ready_) |
| 497 ready_callbacks_.push_back(display_is_ready_callback); | 490 ready_callbacks_.push_back(display_is_ready_callback); |
| 498 return ready_; | 491 return ready_; |
| 499 } | 492 } |
| 500 | 493 |
| 501 void OobeUI::ShowOobeUI(bool show) { | 494 void OobeUI::ShowOobeUI(bool show) { |
| 502 core_handler_->ShowOobeUI(show); | 495 core_handler_->ShowOobeUI(show); |
| 503 } | 496 } |
| 504 | 497 |
| 505 void OobeUI::ShowRetailModeLoginSpinner() { | |
| 506 signin_screen_handler_->ShowRetailModeLoginSpinner(); | |
| 507 } | |
| 508 | |
| 509 void OobeUI::ShowSigninScreen(const LoginScreenContext& context, | 498 void OobeUI::ShowSigninScreen(const LoginScreenContext& context, |
| 510 SigninScreenHandlerDelegate* delegate, | 499 SigninScreenHandlerDelegate* delegate, |
| 511 NativeWindowDelegate* native_window_delegate) { | 500 NativeWindowDelegate* native_window_delegate) { |
| 512 signin_screen_handler_->SetDelegate(delegate); | 501 signin_screen_handler_->SetDelegate(delegate); |
| 513 signin_screen_handler_->SetNativeWindowDelegate(native_window_delegate); | 502 signin_screen_handler_->SetNativeWindowDelegate(native_window_delegate); |
| 514 | 503 |
| 515 LoginScreenContext actual_context(context); | 504 LoginScreenContext actual_context(context); |
| 516 actual_context.set_oobe_ui(core_handler_->show_oobe_ui()); | 505 actual_context.set_oobe_ui(core_handler_->show_oobe_ui()); |
| 517 signin_screen_handler_->Show(actual_context); | 506 signin_screen_handler_->Show(actual_context); |
| 518 } | 507 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 541 DCHECK(screen_ids_.count(screen)) | 530 DCHECK(screen_ids_.count(screen)) |
| 542 << "Screen should be registered in InitializeScreenMaps()"; | 531 << "Screen should be registered in InitializeScreenMaps()"; |
| 543 Screen new_screen = screen_ids_[screen]; | 532 Screen new_screen = screen_ids_[screen]; |
| 544 FOR_EACH_OBSERVER(Observer, | 533 FOR_EACH_OBSERVER(Observer, |
| 545 observer_list_, | 534 observer_list_, |
| 546 OnCurrentScreenChanged(current_screen_, new_screen)); | 535 OnCurrentScreenChanged(current_screen_, new_screen)); |
| 547 current_screen_ = new_screen; | 536 current_screen_ = new_screen; |
| 548 } | 537 } |
| 549 | 538 |
| 550 } // namespace chromeos | 539 } // namespace chromeos |
| OLD | NEW |