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

Unified Diff: chrome/browser/signin/mutable_profile_oauth2_token_service_delegate.cc

Issue 2672833002: [Desktop] Add diagnostics about loading the refresh tokens. (Closed)
Patch Set: Nit Created 3 years, 11 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
Index: chrome/browser/signin/mutable_profile_oauth2_token_service_delegate.cc
diff --git a/chrome/browser/signin/mutable_profile_oauth2_token_service_delegate.cc b/chrome/browser/signin/mutable_profile_oauth2_token_service_delegate.cc
index 572980d8df31c3318dc6a98bc54047def17ed0a8..7436a6cdfa074cba73c1a44c5fd5d0e0be56e6ff 100644
--- a/chrome/browser/signin/mutable_profile_oauth2_token_service_delegate.cc
+++ b/chrome/browser/signin/mutable_profile_oauth2_token_service_delegate.cc
@@ -128,7 +128,8 @@ MutableProfileOAuth2TokenServiceDelegate::
SigninClient* client,
SigninErrorController* signin_error_controller,
AccountTrackerService* account_tracker_service)
- : web_data_service_request_(0),
+ : load_credentials_state_(LOAD_CREDENTIALS_NOT_STARTED),
+ web_data_service_request_(0),
backoff_entry_(&backoff_policy_),
backoff_error_(GoogleServiceAuthError::NONE),
client_(client),
@@ -244,12 +245,22 @@ MutableProfileOAuth2TokenServiceDelegate::GetRequestContext() const {
return client_->GetURLRequestContext();
}
+OAuth2TokenServiceDelegate::LoadCredentialsState
+MutableProfileOAuth2TokenServiceDelegate::GetLoadCredentialsState() const {
+ return load_credentials_state_;
+}
+
void MutableProfileOAuth2TokenServiceDelegate::LoadCredentials(
const std::string& primary_account_id) {
+ DCHECK_EQ(LOAD_CREDENTIALS_NOT_STARTED, load_credentials_state_);
if (primary_account_id.empty()) {
+ load_credentials_state_ = LOAD_CREDENTIALS_FINISHED_WITH_SUCCESS;
FireRefreshTokensLoaded();
return;
}
+
+ load_credentials_state_ = LOAD_CREDENTIALS_IN_PROGRESS;
+
ValidateAccountId(primary_account_id);
DCHECK(loading_primary_account_id_.empty());
DCHECK_EQ(0, web_data_service_request_);
@@ -287,10 +298,26 @@ void MutableProfileOAuth2TokenServiceDelegate::OnWebDataServiceRequestDone(
if (result) {
DCHECK(result->GetType() == TOKEN_RESULT);
- const WDResult<std::map<std::string, std::string>>* token_result =
- static_cast<const WDResult<std::map<std::string, std::string>>*>(
- result.get());
- LoadAllCredentialsIntoMemory(token_result->GetValue());
+ const WDResult<TokenResult>* token_result =
+ static_cast<const WDResult<TokenResult>*>(result.get());
+ LoadAllCredentialsIntoMemory(token_result->GetValue().tokens);
+ switch (token_result->GetValue().db_result) {
+ case TokenServiceTable::TOKEN_DB_RESULT_SQL_INVALID_STATEMENT:
+ case TokenServiceTable::TOKEN_DB_RESULT_BAD_ENTRY:
+ load_credentials_state_ = LOAD_CREDENTIALS_FINISHED_WITH_DB_ERRORS;
+ break;
+ case TokenServiceTable::TOKEN_DB_RESULT_DECRYPT_ERROR:
+ load_credentials_state_ = LOAD_CREDENTIALS_FINISHED_WITH_DECRYPT_ERRORS;
+ break;
+ case TokenServiceTable::TOKEN_DB_RESULT_SUCCESS:
+ load_credentials_state_ = LOAD_CREDENTIALS_FINISHED_WITH_SUCCESS;
+ break;
+ }
+ FireRefreshTokensLoaded();
+ } else {
+ load_credentials_state_ = LOAD_CREDENTIALS_FINISHED_WITH_UNKNOWN_ERRORS;
+ // TODO(msarda): Should |FireRefreshTokensLoaded| be called on this branch
+ // as well?
Roger Tawa OOO till Jul 10th 2017/02/02 18:58:25 I'm not sure why you wouldn't fire the event here
msarda 2017/02/03 09:07:09 It did not cause any specific errors. I did not fi
}
// Make sure that we have an entry for |loading_primary_account_id_| in the
@@ -400,8 +427,6 @@ void MutableProfileOAuth2TokenServiceDelegate::LoadAllCredentialsIntoMemory(
UpdateCredentials(loading_primary_account_id_, old_login_token);
}
}
-
- FireRefreshTokensLoaded();
}
void MutableProfileOAuth2TokenServiceDelegate::UpdateCredentials(

Powered by Google App Engine
This is Rietveld 408576698