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 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
938 } | 938 } |
939 | 939 |
940 gfx::NativeWindow ExistingUserController::GetNativeWindow() const { | 940 gfx::NativeWindow ExistingUserController::GetNativeWindow() const { |
941 return host_->GetNativeWindow(); | 941 return host_->GetNativeWindow(); |
942 } | 942 } |
943 | 943 |
944 void ExistingUserController::ShowError(int error_id, | 944 void ExistingUserController::ShowError(int error_id, |
945 const std::string& details) { | 945 const std::string& details) { |
946 VLOG(1) << details; | 946 VLOG(1) << details; |
947 HelpAppLauncher::HelpTopic help_topic_id; | 947 HelpAppLauncher::HelpTopic help_topic_id; |
948 if (login_performer_) { | 948 switch (login_performer_->error().state()) { |
949 switch (login_performer_->error().state()) { | 949 case GoogleServiceAuthError::ACCOUNT_DISABLED: |
950 case GoogleServiceAuthError::ACCOUNT_DISABLED: | 950 help_topic_id = HelpAppLauncher::HELP_ACCOUNT_DISABLED; |
951 help_topic_id = HelpAppLauncher::HELP_ACCOUNT_DISABLED; | 951 break; |
952 break; | 952 case GoogleServiceAuthError::HOSTED_NOT_ALLOWED: |
953 case GoogleServiceAuthError::HOSTED_NOT_ALLOWED: | 953 help_topic_id = HelpAppLauncher::HELP_HOSTED_ACCOUNT; |
954 help_topic_id = HelpAppLauncher::HELP_HOSTED_ACCOUNT; | 954 break; |
955 break; | 955 default: |
956 default: | 956 help_topic_id = HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT; |
957 help_topic_id = HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT; | 957 break; |
958 break; | |
959 } | |
960 } else { | |
961 // login_performer_ will be null if an error occurred during OAuth2 token | |
962 // fetch. In this case, show a generic error. | |
963 help_topic_id = HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT; | |
964 } | 958 } |
965 | 959 |
966 if (error_id == IDS_LOGIN_ERROR_AUTHENTICATING) { | 960 if (error_id == IDS_LOGIN_ERROR_AUTHENTICATING) { |
967 if (num_login_attempts_ > 1) { | 961 if (num_login_attempts_ > 1) { |
968 const user_manager::User* user = | 962 const user_manager::User* user = |
969 user_manager::UserManager::Get()->FindUser( | 963 user_manager::UserManager::Get()->FindUser( |
970 last_login_attempt_username_); | 964 last_login_attempt_username_); |
971 if (user && (user->GetType() == user_manager::USER_TYPE_SUPERVISED)) | 965 if (user && (user->GetType() == user_manager::USER_TYPE_SUPERVISED)) |
972 error_id = IDS_LOGIN_ERROR_AUTHENTICATING_2ND_TIME_SUPERVISED; | 966 error_id = IDS_LOGIN_ERROR_AUTHENTICATING_2ND_TIME_SUPERVISED; |
973 } | 967 } |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1216 bootstrap_user_context_initializer_->random_key_used())); | 1210 bootstrap_user_context_initializer_->random_key_used())); |
1217 | 1211 |
1218 PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION); | 1212 PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION); |
1219 } | 1213 } |
1220 | 1214 |
1221 void ExistingUserController::OnOAuth2TokensFetched( | 1215 void ExistingUserController::OnOAuth2TokensFetched( |
1222 bool success, | 1216 bool success, |
1223 const UserContext& user_context) { | 1217 const UserContext& user_context) { |
1224 if (!success) { | 1218 if (!success) { |
1225 LOG(ERROR) << "OAuth2 token fetch failed."; | 1219 LOG(ERROR) << "OAuth2 token fetch failed."; |
1226 OnAuthFailure(AuthFailure(AuthFailure::FAILED_TO_INITIALIZE_TOKEN)); | 1220 OnAuthFailure(AuthFailure(AuthFailure::NETWORK_AUTH_FAILED)); |
1227 return; | 1221 return; |
1228 } | 1222 } |
1229 PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION); | 1223 PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION); |
1230 } | 1224 } |
1231 | 1225 |
1232 } // namespace chromeos | 1226 } // namespace chromeos |
OLD | NEW |