Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(410)

Unified Diff: chrome/browser/chromeos/login/google_authenticator.cc

Issue 4980005: Allow sync with 2-factor StrongAuth accounts in ChromeOS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/google_authenticator.cc
diff --git a/chrome/browser/chromeos/login/google_authenticator.cc b/chrome/browser/chromeos/login/google_authenticator.cc
index 81a1851288a487ce011c4598afe3e3fc2117c505..5d246ddda459db232cccdc2fcebf6e82e3716e2f 100644
--- a/chrome/browser/chromeos/login/google_authenticator.cc
+++ b/chrome/browser/chromeos/login/google_authenticator.cc
@@ -61,7 +61,8 @@ GoogleAuthenticator::GoogleAuthenticator(LoginStatusConsumer* consumer)
hosted_policy_(GaiaAuthFetcher::HostedAccountsAllowed),
unlock_(false),
try_again_(true),
- checked_for_localaccount_(false) {
+ checked_for_localaccount_(false),
+ last_error_(GoogleServiceAuthError::None()) {
CHECK(chromeos::CrosLibrary::Get()->EnsureLoaded());
// If not already owned, this is a no-op. If it is, this loads the owner's
// public key off of disk.
@@ -205,7 +206,9 @@ void GoogleAuthenticator::OnClientLoginSuccess(
}
void GoogleAuthenticator::OnClientLoginFailure(
- const GoogleServiceAuthError& error) {
+ const GoogleServiceAuthError& error) {
+ // Save off the last error.
+ last_error_ = error;
if (error.state() == GoogleServiceAuthError::REQUEST_CANCELED) {
if (try_again_) {
@@ -280,6 +283,13 @@ void GoogleAuthenticator::OnLoginSuccess(
NotificationService::AllSources(),
Details<AuthenticationNotificationDetails>(&details));
+ // If there was an error during the login attempt, notify the consumer.
+ if (last_error_.state() != GoogleServiceAuthError::NONE) {
+ consumer_->SetLoginFailure(
+ LoginFailure::FromNetworkAuthFailure(last_error_));
+ last_error_ = GoogleServiceAuthError::None();
+ }
+
int mount_error = chromeos::kCryptohomeMountErrorNone;
BootTimesLoader::Get()->AddLoginTimeMarker("CryptohomeMounting", false);
if (unlock_ ||

Powered by Google App Engine
This is Rietveld 408576698