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 switch (login_performer_->error().state()) { | 948 if (login_performer_) { |
949 case GoogleServiceAuthError::ACCOUNT_DISABLED: | 949 switch (login_performer_->error().state()) { |
950 help_topic_id = HelpAppLauncher::HELP_ACCOUNT_DISABLED; | 950 case GoogleServiceAuthError::ACCOUNT_DISABLED: |
951 break; | 951 help_topic_id = HelpAppLauncher::HELP_ACCOUNT_DISABLED; |
952 case GoogleServiceAuthError::HOSTED_NOT_ALLOWED: | 952 break; |
953 help_topic_id = HelpAppLauncher::HELP_HOSTED_ACCOUNT; | 953 case GoogleServiceAuthError::HOSTED_NOT_ALLOWED: |
954 break; | 954 help_topic_id = HelpAppLauncher::HELP_HOSTED_ACCOUNT; |
955 default: | 955 break; |
956 help_topic_id = HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT; | 956 default: |
957 break; | 957 help_topic_id = HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT; |
958 break; | |
959 } | |
960 } else { | |
961 // login_performer_ might be null if error happened during OAuth2 token | |
Nikita (slow)
2015/04/27 13:05:49
nit: update comment
login_performer_ most likely w
Dmitry Polukhin
2015/04/27 14:51:58
Done.
| |
962 // fetch, in this case show generic error. | |
963 help_topic_id = HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT; | |
958 } | 964 } |
959 | 965 |
960 if (error_id == IDS_LOGIN_ERROR_AUTHENTICATING) { | 966 if (error_id == IDS_LOGIN_ERROR_AUTHENTICATING) { |
961 if (num_login_attempts_ > 1) { | 967 if (num_login_attempts_ > 1) { |
962 const user_manager::User* user = | 968 const user_manager::User* user = |
963 user_manager::UserManager::Get()->FindUser( | 969 user_manager::UserManager::Get()->FindUser( |
964 last_login_attempt_username_); | 970 last_login_attempt_username_); |
965 if (user && (user->GetType() == user_manager::USER_TYPE_SUPERVISED)) | 971 if (user && (user->GetType() == user_manager::USER_TYPE_SUPERVISED)) |
966 error_id = IDS_LOGIN_ERROR_AUTHENTICATING_2ND_TIME_SUPERVISED; | 972 error_id = IDS_LOGIN_ERROR_AUTHENTICATING_2ND_TIME_SUPERVISED; |
967 } | 973 } |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1210 bootstrap_user_context_initializer_->random_key_used())); | 1216 bootstrap_user_context_initializer_->random_key_used())); |
1211 | 1217 |
1212 PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION); | 1218 PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION); |
1213 } | 1219 } |
1214 | 1220 |
1215 void ExistingUserController::OnOAuth2TokensFetched( | 1221 void ExistingUserController::OnOAuth2TokensFetched( |
1216 bool success, | 1222 bool success, |
1217 const UserContext& user_context) { | 1223 const UserContext& user_context) { |
1218 if (!success) { | 1224 if (!success) { |
1219 LOG(ERROR) << "OAuth2 token fetch failed."; | 1225 LOG(ERROR) << "OAuth2 token fetch failed."; |
1220 OnAuthFailure(AuthFailure(AuthFailure::NETWORK_AUTH_FAILED)); | 1226 OnAuthFailure(AuthFailure(AuthFailure::FAILED_TO_INITIALIZE_TOKEN)); |
1221 return; | 1227 return; |
1222 } | 1228 } |
1223 PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION); | 1229 PerformLogin(user_context, LoginPerformer::AUTH_MODE_EXTENSION); |
1224 } | 1230 } |
1225 | 1231 |
1226 } // namespace chromeos | 1232 } // namespace chromeos |
OLD | NEW |