Chromium Code Reviews| Index: chrome/browser/extensions/api/identity/identity_api.cc |
| diff --git a/chrome/browser/extensions/api/identity/identity_api.cc b/chrome/browser/extensions/api/identity/identity_api.cc |
| index 72658a33fcf26119ac4088fe958bfa6e838e4acc..1a013ff0ecafd1818202122efe6d118ba2b8bd0d 100644 |
| --- a/chrome/browser/extensions/api/identity/identity_api.cc |
| +++ b/chrome/browser/extensions/api/identity/identity_api.cc |
| @@ -45,7 +45,8 @@ namespace LaunchWebAuthFlow = api::experimental_identity::LaunchWebAuthFlow; |
| namespace identity = api::experimental_identity; |
| IdentityGetAuthTokenFunction::IdentityGetAuthTokenFunction() |
| - : interactive_(false) {} |
| + : interactive_(false), |
| + should_retry_with_signin_(false) {} |
| IdentityGetAuthTokenFunction::~IdentityGetAuthTokenFunction() {} |
| bool IdentityGetAuthTokenFunction::RunImpl() { |
| @@ -53,6 +54,7 @@ bool IdentityGetAuthTokenFunction::RunImpl() { |
| EXTENSION_FUNCTION_VALIDATE(params.get()); |
| if (params->details.get() && params->details->interactive.get()) |
| interactive_ = *params->details->interactive; |
| + should_retry_with_signin_ = interactive_; |
| const OAuth2Info& oauth2_info = OAuth2Info::GetOAuth2Info(GetExtension()); |
| @@ -97,6 +99,19 @@ void IdentityGetAuthTokenFunction::OnMintTokenSuccess( |
| void IdentityGetAuthTokenFunction::OnMintTokenFailure( |
| const GoogleServiceAuthError& error) { |
| + if (should_retry_with_signin_) { |
| + switch (error.state()) { |
| + case GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS: |
| + case GoogleServiceAuthError::ACCOUNT_DELETED: |
| + case GoogleServiceAuthError::ACCOUNT_DISABLED: |
| + ShowLoginPopup(); |
| + return; |
| + default: |
| + // Return error to caller. |
| + break; |
| + } |
| + } |
| + |
|
Pete Williamson
2013/03/22 16:42:34
How will the user know *why* they are being asked
Michael Courage
2013/03/25 21:28:04
There is nothing on the sign in screen that explai
|
| error_ = std::string(identity_constants::kAuthFailure) + error.ToString(); |
| SendResponse(false); |
| Release(); // Balanced in RunImpl. |
| @@ -173,6 +188,7 @@ void IdentityGetAuthTokenFunction::StopObservingLoginService() { |
| } |
| void IdentityGetAuthTokenFunction::ShowLoginPopup() { |
| + should_retry_with_signin_ = false; |
| StartObservingLoginService(); |
| LoginUIService* login_ui_service = |