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

Unified Diff: chrome/browser/extensions/api/identity/identity_api.cc

Issue 12929014: Identity API: Pop-up a sign-in dialog if gaia credentials are bad (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Created 7 years, 9 months 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
« no previous file with comments | « chrome/browser/extensions/api/identity/identity_api.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 =
« no previous file with comments | « chrome/browser/extensions/api/identity/identity_api.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698