| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/signin_screen_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "base/strings/stringprintf.h" | 22 #include "base/strings/stringprintf.h" |
| 23 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
| 24 #include "base/sys_info.h" | 24 #include "base/sys_info.h" |
| 25 #include "chrome/browser/browser_process.h" | 25 #include "chrome/browser/browser_process.h" |
| 26 #include "chrome/browser/browser_process_platform_part_chromeos.h" | 26 #include "chrome/browser/browser_process_platform_part_chromeos.h" |
| 27 #include "chrome/browser/browser_shutdown.h" | 27 #include "chrome/browser/browser_shutdown.h" |
| 28 #include "chrome/browser/chrome_notification_types.h" | 28 #include "chrome/browser/chrome_notification_types.h" |
| 29 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 29 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 30 #include "chrome/browser/chromeos/boot_times_loader.h" | 30 #include "chrome/browser/chromeos/boot_times_loader.h" |
| 31 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 31 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 32 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" | |
| 33 #include "chrome/browser/chromeos/login/error_screens_histogram_helper.h" | 32 #include "chrome/browser/chromeos/login/error_screens_histogram_helper.h" |
| 34 #include "chrome/browser/chromeos/login/hwid_checker.h" | 33 #include "chrome/browser/chromeos/login/hwid_checker.h" |
| 35 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 34 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| 36 #include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" | 35 #include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" |
| 37 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 36 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
| 38 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 37 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
| 39 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" | 38 #include "chrome/browser/chromeos/login/ui/webui_login_display.h" |
| 40 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" | 39 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" |
| 41 #include "chrome/browser/chromeos/login/wizard_controller.h" | 40 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 42 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 41 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 builder->Add("confirmPasswordConfirmButton", | 401 builder->Add("confirmPasswordConfirmButton", |
| 403 IDS_LOGIN_CONFIRM_PASSWORD_CONFIRM_BUTTON); | 402 IDS_LOGIN_CONFIRM_PASSWORD_CONFIRM_BUTTON); |
| 404 builder->Add("confirmPasswordText", IDS_LOGIN_CONFIRM_PASSWORD_TEXT); | 403 builder->Add("confirmPasswordText", IDS_LOGIN_CONFIRM_PASSWORD_TEXT); |
| 405 builder->Add("confirmPasswordErrorText", | 404 builder->Add("confirmPasswordErrorText", |
| 406 IDS_LOGIN_CONFIRM_PASSWORD_ERROR_TEXT); | 405 IDS_LOGIN_CONFIRM_PASSWORD_ERROR_TEXT); |
| 407 | 406 |
| 408 builder->Add("fatalEnrollmentError", | 407 builder->Add("fatalEnrollmentError", |
| 409 IDS_ENTERPRISE_ENROLLMENT_AUTH_FATAL_ERROR); | 408 IDS_ENTERPRISE_ENROLLMENT_AUTH_FATAL_ERROR); |
| 410 builder->Add("insecureURLEnrollmentError", | 409 builder->Add("insecureURLEnrollmentError", |
| 411 IDS_ENTERPRISE_ENROLLMENT_AUTH_INSECURE_URL_ERROR); | 410 IDS_ENTERPRISE_ENROLLMENT_AUTH_INSECURE_URL_ERROR); |
| 412 | |
| 413 if (chromeos::KioskModeSettings::Get()->IsKioskModeEnabled()) | |
| 414 builder->Add("demoLoginMessage", IDS_KIOSK_MODE_LOGIN_MESSAGE); | |
| 415 } | 411 } |
| 416 | 412 |
| 417 void SigninScreenHandler::Show(const LoginScreenContext& context) { | 413 void SigninScreenHandler::Show(const LoginScreenContext& context) { |
| 418 CHECK(delegate_); | 414 CHECK(delegate_); |
| 419 | 415 |
| 420 // Just initialize internal fields from context and call ShowImpl(). | 416 // Just initialize internal fields from context and call ShowImpl(). |
| 421 oobe_ui_ = context.oobe_ui(); | 417 oobe_ui_ = context.oobe_ui(); |
| 422 | 418 |
| 423 std::string email; | 419 std::string email; |
| 424 if (is_enrolling_consumer_management_) { | 420 if (is_enrolling_consumer_management_) { |
| 425 // We don't check if the value of the owner e-mail is trusted because it is | 421 // We don't check if the value of the owner e-mail is trusted because it is |
| 426 // only used to pre-fill the e-mail field in Gaia sign-in page and a cached | 422 // only used to pre-fill the e-mail field in Gaia sign-in page and a cached |
| 427 // value is sufficient. | 423 // value is sufficient. |
| 428 CrosSettings::Get()->GetString(kDeviceOwner, &email); | 424 CrosSettings::Get()->GetString(kDeviceOwner, &email); |
| 429 } else { | 425 } else { |
| 430 email = context.email(); | 426 email = context.email(); |
| 431 } | 427 } |
| 432 gaia_screen_handler_->PopulateEmail(email); | 428 gaia_screen_handler_->PopulateEmail(email); |
| 433 ShowImpl(); | 429 ShowImpl(); |
| 434 histogram_helper_->OnScreenShow(); | 430 histogram_helper_->OnScreenShow(); |
| 435 } | 431 } |
| 436 | 432 |
| 437 void SigninScreenHandler::ShowRetailModeLoginSpinner() { | |
| 438 CallJS("showLoginSpinner"); | |
| 439 } | |
| 440 | |
| 441 void SigninScreenHandler::SetDelegate(SigninScreenHandlerDelegate* delegate) { | 433 void SigninScreenHandler::SetDelegate(SigninScreenHandlerDelegate* delegate) { |
| 442 delegate_ = delegate; | 434 delegate_ = delegate; |
| 443 if (delegate_) | 435 if (delegate_) |
| 444 delegate_->SetWebUIHandler(this); | 436 delegate_->SetWebUIHandler(this); |
| 445 } | 437 } |
| 446 | 438 |
| 447 void SigninScreenHandler::SetNativeWindowDelegate( | 439 void SigninScreenHandler::SetNativeWindowDelegate( |
| 448 NativeWindowDelegate* native_window_delegate) { | 440 NativeWindowDelegate* native_window_delegate) { |
| 449 native_window_delegate_ = native_window_delegate; | 441 native_window_delegate_ = native_window_delegate; |
| 450 } | 442 } |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 gfx::NativeWindow SigninScreenHandler::GetNativeWindow() { | 718 gfx::NativeWindow SigninScreenHandler::GetNativeWindow() { |
| 727 if (native_window_delegate_) | 719 if (native_window_delegate_) |
| 728 return native_window_delegate_->GetNativeWindow(); | 720 return native_window_delegate_->GetNativeWindow(); |
| 729 return NULL; | 721 return NULL; |
| 730 } | 722 } |
| 731 | 723 |
| 732 void SigninScreenHandler::RegisterMessages() { | 724 void SigninScreenHandler::RegisterMessages() { |
| 733 AddCallback("authenticateUser", &SigninScreenHandler::HandleAuthenticateUser); | 725 AddCallback("authenticateUser", &SigninScreenHandler::HandleAuthenticateUser); |
| 734 AddCallback("attemptUnlock", &SigninScreenHandler::HandleAttemptUnlock); | 726 AddCallback("attemptUnlock", &SigninScreenHandler::HandleAttemptUnlock); |
| 735 AddCallback("getUsers", &SigninScreenHandler::HandleGetUsers); | 727 AddCallback("getUsers", &SigninScreenHandler::HandleGetUsers); |
| 736 AddCallback("launchDemoUser", &SigninScreenHandler::HandleLaunchDemoUser); | |
| 737 AddCallback("launchIncognito", &SigninScreenHandler::HandleLaunchIncognito); | 728 AddCallback("launchIncognito", &SigninScreenHandler::HandleLaunchIncognito); |
| 738 AddCallback("showSupervisedUserCreationScreen", | 729 AddCallback("showSupervisedUserCreationScreen", |
| 739 &SigninScreenHandler::HandleShowSupervisedUserCreationScreen); | 730 &SigninScreenHandler::HandleShowSupervisedUserCreationScreen); |
| 740 AddCallback("launchPublicSession", | 731 AddCallback("launchPublicSession", |
| 741 &SigninScreenHandler::HandleLaunchPublicSession); | 732 &SigninScreenHandler::HandleLaunchPublicSession); |
| 742 AddRawCallback("offlineLogin", &SigninScreenHandler::HandleOfflineLogin); | 733 AddRawCallback("offlineLogin", &SigninScreenHandler::HandleOfflineLogin); |
| 743 AddCallback("rebootSystem", &SigninScreenHandler::HandleRebootSystem); | 734 AddCallback("rebootSystem", &SigninScreenHandler::HandleRebootSystem); |
| 744 AddRawCallback("showAddUser", &SigninScreenHandler::HandleShowAddUser); | 735 AddRawCallback("showAddUser", &SigninScreenHandler::HandleShowAddUser); |
| 745 AddCallback("shutdownSystem", &SigninScreenHandler::HandleShutdownSystem); | 736 AddCallback("shutdownSystem", &SigninScreenHandler::HandleShutdownSystem); |
| 746 AddCallback("loadWallpaper", &SigninScreenHandler::HandleLoadWallpaper); | 737 AddCallback("loadWallpaper", &SigninScreenHandler::HandleLoadWallpaper); |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1052 delegate_->Login(user_context, SigninSpecifics()); | 1043 delegate_->Login(user_context, SigninSpecifics()); |
| 1053 } | 1044 } |
| 1054 | 1045 |
| 1055 void SigninScreenHandler::HandleAttemptUnlock(const std::string& username) { | 1046 void SigninScreenHandler::HandleAttemptUnlock(const std::string& username) { |
| 1056 EasyUnlockService* service = GetEasyUnlockServiceForUser(username); | 1047 EasyUnlockService* service = GetEasyUnlockServiceForUser(username); |
| 1057 if (!service) | 1048 if (!service) |
| 1058 return; | 1049 return; |
| 1059 service->AttemptAuth(username); | 1050 service->AttemptAuth(username); |
| 1060 } | 1051 } |
| 1061 | 1052 |
| 1062 void SigninScreenHandler::HandleLaunchDemoUser() { | |
| 1063 UserContext context(user_manager::USER_TYPE_RETAIL_MODE, std::string()); | |
| 1064 if (delegate_) | |
| 1065 delegate_->Login(context, SigninSpecifics()); | |
| 1066 } | |
| 1067 | |
| 1068 void SigninScreenHandler::HandleLaunchIncognito() { | 1053 void SigninScreenHandler::HandleLaunchIncognito() { |
| 1069 UserContext context(user_manager::USER_TYPE_GUEST, std::string()); | 1054 UserContext context(user_manager::USER_TYPE_GUEST, std::string()); |
| 1070 if (delegate_) | 1055 if (delegate_) |
| 1071 delegate_->Login(context, SigninSpecifics()); | 1056 delegate_->Login(context, SigninSpecifics()); |
| 1072 } | 1057 } |
| 1073 | 1058 |
| 1074 void SigninScreenHandler::HandleShowSupervisedUserCreationScreen() { | 1059 void SigninScreenHandler::HandleShowSupervisedUserCreationScreen() { |
| 1075 if (!user_manager::UserManager::Get()->AreSupervisedUsersAllowed()) { | 1060 if (!user_manager::UserManager::Get()->AreSupervisedUsersAllowed()) { |
| 1076 LOG(ERROR) << "Managed users not allowed."; | 1061 LOG(ERROR) << "Managed users not allowed."; |
| 1077 return; | 1062 return; |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1517 return gaia_screen_handler_->frame_error(); | 1502 return gaia_screen_handler_->frame_error(); |
| 1518 } | 1503 } |
| 1519 | 1504 |
| 1520 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { | 1505 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { |
| 1521 caps_lock_enabled_ = enabled; | 1506 caps_lock_enabled_ = enabled; |
| 1522 if (page_is_ready()) | 1507 if (page_is_ready()) |
| 1523 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); | 1508 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); |
| 1524 } | 1509 } |
| 1525 | 1510 |
| 1526 } // namespace chromeos | 1511 } // namespace chromeos |
| OLD | NEW |