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 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 network_error_model_->SetErrorState(NetworkError::ERROR_STATE_OFFLINE, | 824 network_error_model_->SetErrorState(NetworkError::ERROR_STATE_OFFLINE, |
825 std::string()); | 825 std::string()); |
826 } | 826 } |
827 | 827 |
828 const bool guest_signin_allowed = | 828 const bool guest_signin_allowed = |
829 IsGuestSigninAllowed() && | 829 IsGuestSigninAllowed() && |
830 IsSigninScreenError(network_error_model_->GetErrorState()); | 830 IsSigninScreenError(network_error_model_->GetErrorState()); |
831 network_error_model_->AllowGuestSignin(guest_signin_allowed); | 831 network_error_model_->AllowGuestSignin(guest_signin_allowed); |
832 | 832 |
833 const bool offline_login_allowed = | 833 const bool offline_login_allowed = |
834 IsOfflineLoginAllowed() && | |
835 IsSigninScreenError(network_error_model_->GetErrorState()) && | 834 IsSigninScreenError(network_error_model_->GetErrorState()) && |
836 network_error_model_->GetErrorState() != | 835 network_error_model_->GetErrorState() != |
837 NetworkError::ERROR_STATE_AUTH_EXT_TIMEOUT; | 836 NetworkError::ERROR_STATE_AUTH_EXT_TIMEOUT; |
838 network_error_model_->AllowOfflineLogin(offline_login_allowed); | 837 network_error_model_->AllowOfflineLogin(offline_login_allowed); |
839 | 838 |
840 if (GetCurrentScreen() != OobeScreen::SCREEN_ERROR_MESSAGE) { | 839 if (GetCurrentScreen() != OobeScreen::SCREEN_ERROR_MESSAGE) { |
841 network_error_model_->SetUIState(NetworkError::UI_STATE_SIGNIN); | 840 network_error_model_->SetUIState(NetworkError::UI_STATE_SIGNIN); |
842 network_error_model_->SetParentScreen(OobeScreen::SCREEN_GAIA_SIGNIN); | 841 network_error_model_->SetParentScreen(OobeScreen::SCREEN_GAIA_SIGNIN); |
843 network_error_model_->Show(); | 842 network_error_model_->Show(); |
844 histogram_helper_->OnErrorShow(network_error_model_->GetErrorState()); | 843 histogram_helper_->OnErrorShow(network_error_model_->GetErrorState()); |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1101 if (!delegate_) | 1100 if (!delegate_) |
1102 return; | 1101 return; |
1103 | 1102 |
1104 UserContext context(user_manager::USER_TYPE_PUBLIC_ACCOUNT, account_id); | 1103 UserContext context(user_manager::USER_TYPE_PUBLIC_ACCOUNT, account_id); |
1105 context.SetPublicSessionLocale(locale), | 1104 context.SetPublicSessionLocale(locale), |
1106 context.SetPublicSessionInputMethod(input_method); | 1105 context.SetPublicSessionInputMethod(input_method); |
1107 delegate_->Login(context, SigninSpecifics()); | 1106 delegate_->Login(context, SigninSpecifics()); |
1108 } | 1107 } |
1109 | 1108 |
1110 void SigninScreenHandler::HandleOfflineLogin(const base::ListValue* args) { | 1109 void SigninScreenHandler::HandleOfflineLogin(const base::ListValue* args) { |
1111 if (!delegate_ || delegate_->IsShowUsers()) { | 1110 if (!delegate_) { |
1112 NOTREACHED(); | 1111 NOTREACHED(); |
1113 return; | 1112 return; |
1114 } | 1113 } |
1115 std::string email; | 1114 std::string email; |
1116 args->GetString(0, &email); | 1115 args->GetString(0, &email); |
1117 | 1116 |
1118 gaia_screen_handler_->set_populated_email(email); | 1117 gaia_screen_handler_->set_populated_email(email); |
1119 gaia_screen_handler_->LoadAuthExtension(true /* force */, true /* offline */); | 1118 gaia_screen_handler_->LoadAuthExtension(true /* force */, true /* offline */); |
1120 UpdateUIState(UI_STATE_GAIA_SIGNIN, nullptr); | 1119 UpdateUIState(UI_STATE_GAIA_SIGNIN, nullptr); |
1121 } | 1120 } |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1467 | 1466 |
1468 bool SigninScreenHandler::IsGuestSigninAllowed() const { | 1467 bool SigninScreenHandler::IsGuestSigninAllowed() const { |
1469 CrosSettings* cros_settings = CrosSettings::Get(); | 1468 CrosSettings* cros_settings = CrosSettings::Get(); |
1470 if (!cros_settings) | 1469 if (!cros_settings) |
1471 return false; | 1470 return false; |
1472 bool allow_guest; | 1471 bool allow_guest; |
1473 cros_settings->GetBoolean(kAccountsPrefAllowGuest, &allow_guest); | 1472 cros_settings->GetBoolean(kAccountsPrefAllowGuest, &allow_guest); |
1474 return allow_guest; | 1473 return allow_guest; |
1475 } | 1474 } |
1476 | 1475 |
1477 bool SigninScreenHandler::IsOfflineLoginAllowed() const { | |
1478 CrosSettings* cros_settings = CrosSettings::Get(); | |
1479 if (!cros_settings) | |
1480 return false; | |
1481 | |
1482 // Offline login is allowed only when user pods are hidden. | |
1483 bool show_pods; | |
1484 cros_settings->GetBoolean(kAccountsPrefShowUserNamesOnSignIn, &show_pods); | |
1485 return !show_pods; | |
1486 } | |
1487 | |
1488 void SigninScreenHandler::OnShowAddUser() { | 1476 void SigninScreenHandler::OnShowAddUser() { |
1489 is_account_picker_showing_first_time_ = false; | 1477 is_account_picker_showing_first_time_ = false; |
1490 gaia_screen_handler_->ShowGaiaAsync(); | 1478 gaia_screen_handler_->ShowGaiaAsync(); |
1491 } | 1479 } |
1492 | 1480 |
1493 net::Error SigninScreenHandler::FrameError() const { | 1481 net::Error SigninScreenHandler::FrameError() const { |
1494 return gaia_screen_handler_->frame_error(); | 1482 return gaia_screen_handler_->frame_error(); |
1495 } | 1483 } |
1496 | 1484 |
1497 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { | 1485 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { |
1498 caps_lock_enabled_ = enabled; | 1486 caps_lock_enabled_ = enabled; |
1499 if (page_is_ready()) | 1487 if (page_is_ready()) |
1500 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); | 1488 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); |
1501 } | 1489 } |
1502 | 1490 |
1503 void SigninScreenHandler::OnFeedbackFinished() { | 1491 void SigninScreenHandler::OnFeedbackFinished() { |
1504 CallJS("login.UnrecoverableCryptohomeErrorScreen.resumeAfterFeedbackUI"); | 1492 CallJS("login.UnrecoverableCryptohomeErrorScreen.resumeAfterFeedbackUI"); |
1505 | 1493 |
1506 // Recreate user's cryptohome after the feedback is attempted. | 1494 // Recreate user's cryptohome after the feedback is attempted. |
1507 HandleResyncUserData(); | 1495 HandleResyncUserData(); |
1508 } | 1496 } |
1509 | 1497 |
1510 } // namespace chromeos | 1498 } // namespace chromeos |
OLD | NEW |