| 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/chromeos/login/existing_user_controller.h" | 5 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 if (auth_status_consumer_) | 684 if (auth_status_consumer_) |
| 685 auth_status_consumer_->OnPasswordChangeDetected(); | 685 auth_status_consumer_->OnPasswordChangeDetected(); |
| 686 | 686 |
| 687 display_email_.clear(); | 687 display_email_.clear(); |
| 688 } | 688 } |
| 689 | 689 |
| 690 void ExistingUserController::WhiteListCheckFailed(const std::string& email) { | 690 void ExistingUserController::WhiteListCheckFailed(const std::string& email) { |
| 691 PerformLoginFinishedActions(true /* start public session timer */); | 691 PerformLoginFinishedActions(true /* start public session timer */); |
| 692 offline_failed_ = false; | 692 offline_failed_ = false; |
| 693 | 693 |
| 694 if (g_browser_process->platform_part() | 694 if (StartupUtils::IsWebviewSigninEnabled()) { |
| 695 ->browser_policy_connector_chromeos() | 695 login_display_->ShowWhitelistCheckFailedError(); |
| 696 ->IsEnterpriseManaged()) { | |
| 697 ShowError(IDS_ENTERPRISE_LOGIN_ERROR_WHITELIST, email); | |
| 698 } else { | 696 } else { |
| 699 ShowError(IDS_LOGIN_ERROR_WHITELIST, email); | 697 if (g_browser_process->platform_part() |
| 698 ->browser_policy_connector_chromeos() |
| 699 ->IsEnterpriseManaged()) { |
| 700 ShowError(IDS_ENTERPRISE_LOGIN_ERROR_WHITELIST, email); |
| 701 } else { |
| 702 ShowError(IDS_LOGIN_ERROR_WHITELIST, email); |
| 703 } |
| 704 login_display_->ShowSigninUI(email); |
| 700 } | 705 } |
| 701 | 706 |
| 702 if (StartupUtils::IsWebviewSigninEnabled()) | |
| 703 login_display_->ShowSigninUI(""); | |
| 704 else | |
| 705 login_display_->ShowSigninUI(email); | |
| 706 | |
| 707 if (auth_status_consumer_) { | 707 if (auth_status_consumer_) { |
| 708 auth_status_consumer_->OnAuthFailure( | 708 auth_status_consumer_->OnAuthFailure( |
| 709 AuthFailure(AuthFailure::WHITELIST_CHECK_FAILED)); | 709 AuthFailure(AuthFailure::WHITELIST_CHECK_FAILED)); |
| 710 } | 710 } |
| 711 | 711 |
| 712 display_email_.clear(); | 712 display_email_.clear(); |
| 713 } | 713 } |
| 714 | 714 |
| 715 void ExistingUserController::PolicyLoadFailed() { | 715 void ExistingUserController::PolicyLoadFailed() { |
| 716 ShowError(IDS_LOGIN_ERROR_OWNER_KEY_LOST, ""); | 716 ShowError(IDS_LOGIN_ERROR_OWNER_KEY_LOST, ""); |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 &ExistingUserController::OnPublicSessionAutoLoginTimerFire, | 934 &ExistingUserController::OnPublicSessionAutoLoginTimerFire, |
| 935 weak_factory_.GetWeakPtr())); | 935 weak_factory_.GetWeakPtr())); |
| 936 } | 936 } |
| 937 | 937 |
| 938 gfx::NativeWindow ExistingUserController::GetNativeWindow() const { | 938 gfx::NativeWindow ExistingUserController::GetNativeWindow() const { |
| 939 return host_->GetNativeWindow(); | 939 return host_->GetNativeWindow(); |
| 940 } | 940 } |
| 941 | 941 |
| 942 void ExistingUserController::ShowError(int error_id, | 942 void ExistingUserController::ShowError(int error_id, |
| 943 const std::string& details) { | 943 const std::string& details) { |
| 944 // TODO(dpolukhin): show detailed error info. |details| string contains | |
| 945 // low level error info that is not localized and even is not user friendly. | |
| 946 // For now just ignore it because error_text contains all required information | |
| 947 // for end users, developers can see details string in Chrome logs. | |
| 948 VLOG(1) << details; | 944 VLOG(1) << details; |
| 949 HelpAppLauncher::HelpTopic help_topic_id; | 945 HelpAppLauncher::HelpTopic help_topic_id; |
| 950 bool is_offline = !network_state_helper_->IsConnected(); | |
| 951 switch (login_performer_->error().state()) { | 946 switch (login_performer_->error().state()) { |
| 952 case GoogleServiceAuthError::CONNECTION_FAILED: | |
| 953 help_topic_id = HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT_OFFLINE; | |
| 954 break; | |
| 955 case GoogleServiceAuthError::ACCOUNT_DISABLED: | 947 case GoogleServiceAuthError::ACCOUNT_DISABLED: |
| 956 help_topic_id = HelpAppLauncher::HELP_ACCOUNT_DISABLED; | 948 help_topic_id = HelpAppLauncher::HELP_ACCOUNT_DISABLED; |
| 957 break; | 949 break; |
| 958 case GoogleServiceAuthError::HOSTED_NOT_ALLOWED: | 950 case GoogleServiceAuthError::HOSTED_NOT_ALLOWED: |
| 959 help_topic_id = HelpAppLauncher::HELP_HOSTED_ACCOUNT; | 951 help_topic_id = HelpAppLauncher::HELP_HOSTED_ACCOUNT; |
| 960 break; | 952 break; |
| 961 default: | 953 default: |
| 962 help_topic_id = is_offline ? | 954 help_topic_id = HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT; |
| 963 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT_OFFLINE : | |
| 964 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT; | |
| 965 break; | 955 break; |
| 966 } | 956 } |
| 967 | 957 |
| 968 if (error_id == IDS_LOGIN_ERROR_AUTHENTICATING) { | 958 if (error_id == IDS_LOGIN_ERROR_AUTHENTICATING) { |
| 969 if (num_login_attempts_ > 1) { | 959 if (num_login_attempts_ > 1) { |
| 970 const user_manager::User* user = | 960 const user_manager::User* user = |
| 971 user_manager::UserManager::Get()->FindUser( | 961 user_manager::UserManager::Get()->FindUser( |
| 972 last_login_attempt_username_); | 962 last_login_attempt_username_); |
| 973 if (user && (user->GetType() == user_manager::USER_TYPE_SUPERVISED)) | 963 if (user && (user->GetType() == user_manager::USER_TYPE_SUPERVISED)) |
| 974 error_id = IDS_LOGIN_ERROR_AUTHENTICATING_2ND_TIME_SUPERVISED; | 964 error_id = IDS_LOGIN_ERROR_AUTHENTICATING_2ND_TIME_SUPERVISED; |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1203 ChromeUserManager::Get()->SetUserFlow( | 1193 ChromeUserManager::Get()->SetUserFlow( |
| 1204 user_context.GetUserID(), | 1194 user_context.GetUserID(), |
| 1205 new BootstrapUserFlow( | 1195 new BootstrapUserFlow( |
| 1206 user_context, | 1196 user_context, |
| 1207 bootstrap_user_context_initializer_->random_key_used())); | 1197 bootstrap_user_context_initializer_->random_key_used())); |
| 1208 | 1198 |
| 1209 PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION); | 1199 PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION); |
| 1210 } | 1200 } |
| 1211 | 1201 |
| 1212 } // namespace chromeos | 1202 } // namespace chromeos |
| OLD | NEW |