Chromium Code Reviews| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 456 builder->Add("unrecoverableCryptohomeErrorMessage", | 456 builder->Add("unrecoverableCryptohomeErrorMessage", |
| 457 IDS_LOGIN_UNRECOVERABLE_CRYPTOHOME_ERROR_MESSAGE); | 457 IDS_LOGIN_UNRECOVERABLE_CRYPTOHOME_ERROR_MESSAGE); |
| 458 builder->Add("unrecoverableCryptohomeErrorContinue", | 458 builder->Add("unrecoverableCryptohomeErrorContinue", |
| 459 IDS_LOGIN_UNRECOVERABLE_CRYPTOHOME_ERROR_CONTINUE); | 459 IDS_LOGIN_UNRECOVERABLE_CRYPTOHOME_ERROR_CONTINUE); |
| 460 builder->Add("unrecoverableCryptohomeErrorRecreatingProfile", | 460 builder->Add("unrecoverableCryptohomeErrorRecreatingProfile", |
| 461 IDS_LOGIN_UNRECOVERABLE_CRYPTOHOME_ERROR_WAIT_MESSAGE); | 461 IDS_LOGIN_UNRECOVERABLE_CRYPTOHOME_ERROR_WAIT_MESSAGE); |
| 462 } | 462 } |
| 463 | 463 |
| 464 void SigninScreenHandler::RegisterMessages() { | 464 void SigninScreenHandler::RegisterMessages() { |
| 465 AddCallback("authenticateUser", &SigninScreenHandler::HandleAuthenticateUser); | 465 AddCallback("authenticateUser", &SigninScreenHandler::HandleAuthenticateUser); |
| 466 AddCallback("authenticateUserWithPin", | |
| 467 &SigninScreenHandler::HandleAuthenticateUserWithPin); | |
| 466 AddCallback("launchIncognito", &SigninScreenHandler::HandleLaunchIncognito); | 468 AddCallback("launchIncognito", &SigninScreenHandler::HandleLaunchIncognito); |
| 467 AddCallback("showSupervisedUserCreationScreen", | 469 AddCallback("showSupervisedUserCreationScreen", |
| 468 &SigninScreenHandler::HandleShowSupervisedUserCreationScreen); | 470 &SigninScreenHandler::HandleShowSupervisedUserCreationScreen); |
| 469 AddCallback("launchPublicSession", | 471 AddCallback("launchPublicSession", |
| 470 &SigninScreenHandler::HandleLaunchPublicSession); | 472 &SigninScreenHandler::HandleLaunchPublicSession); |
| 471 AddRawCallback("offlineLogin", &SigninScreenHandler::HandleOfflineLogin); | 473 AddRawCallback("offlineLogin", &SigninScreenHandler::HandleOfflineLogin); |
| 472 AddCallback("rebootSystem", &SigninScreenHandler::HandleRebootSystem); | 474 AddCallback("rebootSystem", &SigninScreenHandler::HandleRebootSystem); |
| 473 AddRawCallback("showAddUser", &SigninScreenHandler::HandleShowAddUser); | 475 AddRawCallback("showAddUser", &SigninScreenHandler::HandleShowAddUser); |
| 474 AddCallback("shutdownSystem", &SigninScreenHandler::HandleShutdownSystem); | 476 AddCallback("shutdownSystem", &SigninScreenHandler::HandleShutdownSystem); |
| 475 AddCallback("loadWallpaper", &SigninScreenHandler::HandleLoadWallpaper); | 477 AddCallback("loadWallpaper", &SigninScreenHandler::HandleLoadWallpaper); |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 996 if (!delegate_) | 998 if (!delegate_) |
| 997 return; | 999 return; |
| 998 DCHECK_EQ(account_id.GetUserEmail(), | 1000 DCHECK_EQ(account_id.GetUserEmail(), |
| 999 gaia::SanitizeEmail(account_id.GetUserEmail())); | 1001 gaia::SanitizeEmail(account_id.GetUserEmail())); |
| 1000 | 1002 |
| 1001 UserContext user_context(account_id); | 1003 UserContext user_context(account_id); |
| 1002 user_context.SetKey(Key(password)); | 1004 user_context.SetKey(Key(password)); |
| 1003 delegate_->Login(user_context, SigninSpecifics()); | 1005 delegate_->Login(user_context, SigninSpecifics()); |
| 1004 } | 1006 } |
| 1005 | 1007 |
| 1008 void SigninScreenHandler::HandleAuthenticateUserWithPin( | |
| 1009 const AccountId& account_id, const std::string& password) { | |
| 1010 if (!delegate_) | |
| 1011 return; | |
| 1012 DCHECK_EQ(account_id.GetUserEmail(), | |
| 1013 gaia::SanitizeEmail(account_id.GetUserEmail())); | |
| 1014 | |
| 1015 // TODO(jdufault): Implement this once the PIN authentication backend is in | |
| 1016 // place. | |
| 1017 LOG(ERROR) << "Implement SigninScreenHandler::HandleAuthenticateUserWithPin"; | |
|
xiyuan
2016/05/02 20:03:33
nit: We have NOTIMPLEMENTED() for this purpose.
jdufault
2016/05/03 19:21:58
Done.
| |
| 1018 } | |
| 1019 | |
| 1006 void SigninScreenHandler::HandleLaunchIncognito() { | 1020 void SigninScreenHandler::HandleLaunchIncognito() { |
| 1007 UserContext context(user_manager::USER_TYPE_GUEST, EmptyAccountId()); | 1021 UserContext context(user_manager::USER_TYPE_GUEST, EmptyAccountId()); |
| 1008 if (delegate_) | 1022 if (delegate_) |
| 1009 delegate_->Login(context, SigninSpecifics()); | 1023 delegate_->Login(context, SigninSpecifics()); |
| 1010 } | 1024 } |
| 1011 | 1025 |
| 1012 void SigninScreenHandler::HandleShowSupervisedUserCreationScreen() { | 1026 void SigninScreenHandler::HandleShowSupervisedUserCreationScreen() { |
| 1013 if (!user_manager::UserManager::Get()->AreSupervisedUsersAllowed()) { | 1027 if (!user_manager::UserManager::Get()->AreSupervisedUsersAllowed()) { |
| 1014 LOG(ERROR) << "Managed users not allowed."; | 1028 LOG(ERROR) << "Managed users not allowed."; |
| 1015 return; | 1029 return; |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1416 } | 1430 } |
| 1417 | 1431 |
| 1418 void SigninScreenHandler::OnFeedbackFinished() { | 1432 void SigninScreenHandler::OnFeedbackFinished() { |
| 1419 CallJS("login.UnrecoverableCryptohomeErrorScreen.resumeAfterFeedbackUI"); | 1433 CallJS("login.UnrecoverableCryptohomeErrorScreen.resumeAfterFeedbackUI"); |
| 1420 | 1434 |
| 1421 // Recreate user's cryptohome after the feedkback is attempted. | 1435 // Recreate user's cryptohome after the feedkback is attempted. |
| 1422 HandleResyncUserData(); | 1436 HandleResyncUserData(); |
| 1423 } | 1437 } |
| 1424 | 1438 |
| 1425 } // namespace chromeos | 1439 } // namespace chromeos |
| OLD | NEW |