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

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

Issue 1143323005: Refactor AO2TS to make it easier to componentize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address final comments Created 5 years, 6 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/components/signin/core/browser/mutable_profile_oauth2_token_service.cc b/chrome/browser/signin/mutable_profile_oauth2_token_service_delegate.cc
similarity index 71%
rename from components/signin/core/browser/mutable_profile_oauth2_token_service.cc
rename to chrome/browser/signin/mutable_profile_oauth2_token_service_delegate.cc
index 192e86b035e27398cffc7b308e2be6857ab97553..0fd1b1ee5f405932fe4cec8798a887475cf2e8c0 100644
--- a/components/signin/core/browser/mutable_profile_oauth2_token_service.cc
+++ b/chrome/browser/signin/mutable_profile_oauth2_token_service_delegate.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "components/signin/core/browser/mutable_profile_oauth2_token_service.h"
+#include "chrome/browser/signin/mutable_profile_oauth2_token_service_delegate.h"
#include "base/profiler/scoped_tracker.h"
#include "components/signin/core/browser/signin_client.h"
@@ -42,64 +42,66 @@ std::string RemoveAccountIdPrefix(const std::string& prefixed_account_id) {
// This class sends a request to GAIA to revoke the given refresh token from
// the server. This is a best effort attempt only. This class deletes itself
// when done sucessfully or otherwise.
-class MutableProfileOAuth2TokenService::RevokeServerRefreshToken
+class MutableProfileOAuth2TokenServiceDelegate::RevokeServerRefreshToken
: public GaiaAuthConsumer {
public:
- RevokeServerRefreshToken(MutableProfileOAuth2TokenService* token_service,
- const std::string& account_id);
+ RevokeServerRefreshToken(
+ MutableProfileOAuth2TokenServiceDelegate* token_service_delegate,
+ const std::string& account_id);
~RevokeServerRefreshToken() override;
private:
// GaiaAuthConsumer overrides:
void OnOAuth2RevokeTokenCompleted() override;
- MutableProfileOAuth2TokenService* token_service_;
+ MutableProfileOAuth2TokenServiceDelegate* token_service_delegate_;
GaiaAuthFetcher fetcher_;
DISALLOW_COPY_AND_ASSIGN(RevokeServerRefreshToken);
};
-MutableProfileOAuth2TokenService::
- RevokeServerRefreshToken::RevokeServerRefreshToken(
- MutableProfileOAuth2TokenService* token_service,
- const std::string& refresh_token)
- : token_service_(token_service),
- fetcher_(this, GaiaConstants::kChromeSource,
- token_service_->GetRequestContext()) {
+MutableProfileOAuth2TokenServiceDelegate::RevokeServerRefreshToken::
+ RevokeServerRefreshToken(
+ MutableProfileOAuth2TokenServiceDelegate* token_service_delegate,
+ const std::string& refresh_token)
+ : token_service_delegate_(token_service_delegate),
+ fetcher_(this,
+ GaiaConstants::kChromeSource,
+ token_service_delegate_->GetRequestContext()) {
fetcher_.StartRevokeOAuth2Token(refresh_token);
}
-MutableProfileOAuth2TokenService::
- RevokeServerRefreshToken::~RevokeServerRefreshToken() {}
+MutableProfileOAuth2TokenServiceDelegate::RevokeServerRefreshToken::
+ ~RevokeServerRefreshToken() {
+}
-void MutableProfileOAuth2TokenService::
- RevokeServerRefreshToken::OnOAuth2RevokeTokenCompleted() {
+void MutableProfileOAuth2TokenServiceDelegate::RevokeServerRefreshToken::
+ OnOAuth2RevokeTokenCompleted() {
// |this| pointer will be deleted when removed from the vector, so don't
// access any members after call to erase().
- token_service_->server_revokes_.erase(
- std::find(token_service_->server_revokes_.begin(),
- token_service_->server_revokes_.end(),
- this));
+ token_service_delegate_->server_revokes_.erase(
+ std::find(token_service_delegate_->server_revokes_.begin(),
+ token_service_delegate_->server_revokes_.end(), this));
}
-MutableProfileOAuth2TokenService::AccountInfo::AccountInfo(
+MutableProfileOAuth2TokenServiceDelegate::AccountInfo::AccountInfo(
SigninErrorController* signin_error_controller,
const std::string& account_id,
const std::string& refresh_token)
- : signin_error_controller_(signin_error_controller),
- account_id_(account_id),
- refresh_token_(refresh_token),
- last_auth_error_(GoogleServiceAuthError::NONE) {
+ : signin_error_controller_(signin_error_controller),
+ account_id_(account_id),
+ refresh_token_(refresh_token),
+ last_auth_error_(GoogleServiceAuthError::NONE) {
DCHECK(signin_error_controller_);
DCHECK(!account_id_.empty());
signin_error_controller_->AddProvider(this);
}
-MutableProfileOAuth2TokenService::AccountInfo::~AccountInfo() {
+MutableProfileOAuth2TokenServiceDelegate::AccountInfo::~AccountInfo() {
signin_error_controller_->RemoveProvider(this);
}
-void MutableProfileOAuth2TokenService::AccountInfo::SetLastAuthError(
+void MutableProfileOAuth2TokenServiceDelegate::AccountInfo::SetLastAuthError(
const GoogleServiceAuthError& error) {
if (error.state() != last_auth_error_.state()) {
last_auth_error_ = error;
@@ -108,20 +110,27 @@ void MutableProfileOAuth2TokenService::AccountInfo::SetLastAuthError(
}
std::string
-MutableProfileOAuth2TokenService::AccountInfo::GetAccountId() const {
+MutableProfileOAuth2TokenServiceDelegate::AccountInfo::GetAccountId() const {
return account_id_;
}
GoogleServiceAuthError
-MutableProfileOAuth2TokenService::AccountInfo::GetAuthStatus() const {
+MutableProfileOAuth2TokenServiceDelegate::AccountInfo::GetAuthStatus() const {
return last_auth_error_;
}
-MutableProfileOAuth2TokenService::MutableProfileOAuth2TokenService()
+MutableProfileOAuth2TokenServiceDelegate::
+ MutableProfileOAuth2TokenServiceDelegate(
+ SigninClient* client,
+ SigninErrorController* signin_error_controller)
: web_data_service_request_(0),
backoff_entry_(&backoff_policy_),
- backoff_error_(GoogleServiceAuthError::NONE) {
+ backoff_error_(GoogleServiceAuthError::NONE),
+ client_(client),
+ signin_error_controller_(signin_error_controller) {
VLOG(1) << "MutablePO2TS::MutablePO2TS";
+ DCHECK(client);
+ DCHECK(signin_error_controller);
// It's okay to fill the backoff policy after being used in construction.
backoff_policy_.num_errors_to_ignore = 0;
backoff_policy_.initial_delay_ms = 1000;
@@ -132,46 +141,20 @@ MutableProfileOAuth2TokenService::MutableProfileOAuth2TokenService()
backoff_policy_.always_use_initial_delay = false;
}
-MutableProfileOAuth2TokenService::~MutableProfileOAuth2TokenService() {
+MutableProfileOAuth2TokenServiceDelegate::
+ ~MutableProfileOAuth2TokenServiceDelegate() {
VLOG(1) << "MutablePO2TS::~MutablePO2TS";
DCHECK(server_revokes_.empty());
}
-void MutableProfileOAuth2TokenService::Shutdown() {
- VLOG(1) << "MutablePO2TS::Shutdown";
- server_revokes_.clear();
- CancelWebTokenFetch();
- CancelAllRequests();
- refresh_tokens_.clear();
-
- ProfileOAuth2TokenService::Shutdown();
-}
-
-bool MutableProfileOAuth2TokenService::RefreshTokenIsAvailable(
- const std::string& account_id) const {
- return !GetRefreshToken(account_id).empty();
-}
-
-std::string MutableProfileOAuth2TokenService::GetRefreshToken(
- const std::string& account_id) const {
- AccountInfoMap::const_iterator iter = refresh_tokens_.find(account_id);
- if (iter != refresh_tokens_.end())
- return iter->second->refresh_token();
- return std::string();
-}
-
-bool MutableProfileOAuth2TokenService::HasPersistentError(
- const std::string& account_id) {
- return refresh_tokens_[account_id]->GetAuthStatus().IsPersistentError();
-}
-
OAuth2AccessTokenFetcher*
-MutableProfileOAuth2TokenService::CreateAccessTokenFetcher(
+MutableProfileOAuth2TokenServiceDelegate::CreateAccessTokenFetcher(
const std::string& account_id,
net::URLRequestContextGetter* getter,
OAuth2AccessTokenConsumer* consumer) {
ValidateAccountId(account_id);
- if (HasPersistentError(account_id)) {
+ // check whether the account has persistent error.
+ if (refresh_tokens_[account_id]->GetAuthStatus().IsPersistentError()) {
VLOG(1) << "Request for token has been rejected due to persistent error #"
<< refresh_tokens_[account_id]->GetAuthStatus().state();
return new OAuth2AccessTokenFetcherImmediateError(
@@ -187,20 +170,69 @@ MutableProfileOAuth2TokenService::CreateAccessTokenFetcher(
return new OAuth2AccessTokenFetcherImpl(consumer, getter, refresh_token);
}
+void MutableProfileOAuth2TokenServiceDelegate::UpdateAuthError(
+ const std::string& account_id,
+ const GoogleServiceAuthError& error) {
+ VLOG(1) << "MutablePO2TS::UpdateAuthError. Error: " << error.state();
+ backoff_entry_.InformOfRequest(!error.IsTransientError());
+ ValidateAccountId(account_id);
+
+ // Do not report connection errors as these are not actually auth errors.
+ // We also want to avoid masking a "real" auth error just because we
+ // subsequently get a transient network error. We do keep it around though
+ // to report for future requests being denied for "backoff" reasons.
+ if (error.IsTransientError()) {
+ backoff_error_ = error;
+ return;
+ }
+
+ if (refresh_tokens_.count(account_id) == 0) {
+ // This could happen if the preferences have been corrupted (see
+ // http://crbug.com/321370). In a Debug build that would be a bug, but in a
+ // Release build we want to deal with it gracefully.
+ NOTREACHED();
+ return;
+ }
+ refresh_tokens_[account_id]->SetLastAuthError(error);
+}
+
+bool MutableProfileOAuth2TokenServiceDelegate::RefreshTokenIsAvailable(
+ const std::string& account_id) const {
+ VLOG(1) << "MutablePO2TS::RefreshTokenIsAvailable";
+ return !GetRefreshToken(account_id).empty();
+}
+
+std::string MutableProfileOAuth2TokenServiceDelegate::GetRefreshToken(
+ const std::string& account_id) const {
+ AccountInfoMap::const_iterator iter = refresh_tokens_.find(account_id);
+ if (iter != refresh_tokens_.end())
+ return iter->second->refresh_token();
+ return std::string();
+}
+
+std::vector<std::string>
+MutableProfileOAuth2TokenServiceDelegate::GetAccounts() {
+ std::vector<std::string> account_ids;
+ for (AccountInfoMap::const_iterator iter = refresh_tokens_.begin();
+ iter != refresh_tokens_.end(); ++iter) {
+ account_ids.push_back(iter->first);
+ }
+ return account_ids;
+}
+
net::URLRequestContextGetter*
-MutableProfileOAuth2TokenService::GetRequestContext() {
- return client()->GetURLRequestContext();
+MutableProfileOAuth2TokenServiceDelegate::GetRequestContext() const {
+ return client_->GetURLRequestContext();
}
-void MutableProfileOAuth2TokenService::LoadCredentials(
+void MutableProfileOAuth2TokenServiceDelegate::LoadCredentials(
const std::string& primary_account_id) {
DCHECK(!primary_account_id.empty());
ValidateAccountId(primary_account_id);
DCHECK(loading_primary_account_id_.empty());
DCHECK_EQ(0, web_data_service_request_);
- CancelAllRequests();
- refresh_tokens().clear();
+ refresh_tokens_.clear();
// If the account_id is an email address, then canonicalize it. This
// is to support legacy account_ids, and will not be needed after
@@ -211,12 +243,12 @@ void MutableProfileOAuth2TokenService::LoadCredentials(
loading_primary_account_id_ = primary_account_id;
}
- scoped_refptr<TokenWebData> token_web_data = client()->GetDatabase();
+ scoped_refptr<TokenWebData> token_web_data = client_->GetDatabase();
if (token_web_data.get())
web_data_service_request_ = token_web_data->GetAllTokens(this);
}
-void MutableProfileOAuth2TokenService::OnWebDataServiceRequestDone(
+void MutableProfileOAuth2TokenServiceDelegate::OnWebDataServiceRequestDone(
WebDataServiceBase::Handle handle,
const WDTypedResult* result) {
VLOG(1) << "MutablePO2TS::OnWebDataServiceRequestDone. Result type: "
@@ -233,8 +265,8 @@ void MutableProfileOAuth2TokenService::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> > * > (
+ const WDResult<std::map<std::string, std::string>>* token_result =
+ static_cast<const WDResult<std::map<std::string, std::string>>*>(
result);
LoadAllCredentialsIntoMemory(token_result->GetValue());
}
@@ -243,21 +275,18 @@ void MutableProfileOAuth2TokenService::OnWebDataServiceRequestDone(
// map. The entry could be missing if there is a corruption in the token DB
// while this profile is connected to an account.
DCHECK(!loading_primary_account_id_.empty());
- if (refresh_tokens().count(loading_primary_account_id_) == 0) {
- refresh_tokens()[loading_primary_account_id_].reset(
- new AccountInfo(signin_error_controller(),
- loading_primary_account_id_,
- std::string()));
+ if (refresh_tokens_.count(loading_primary_account_id_) == 0) {
+ refresh_tokens_[loading_primary_account_id_].reset(new AccountInfo(
+ signin_error_controller_, loading_primary_account_id_, std::string()));
}
// If we don't have a refresh token for a known account, signal an error.
for (AccountInfoMap::const_iterator i = refresh_tokens_.begin();
i != refresh_tokens_.end(); ++i) {
if (!RefreshTokenIsAvailable(i->first)) {
- UpdateAuthError(
- i->first,
- GoogleServiceAuthError(
- GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS));
+ UpdateAuthError(i->first,
+ GoogleServiceAuthError(
+ GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS));
break;
}
}
@@ -265,7 +294,7 @@ void MutableProfileOAuth2TokenService::OnWebDataServiceRequestDone(
loading_primary_account_id_.clear();
}
-void MutableProfileOAuth2TokenService::LoadAllCredentialsIntoMemory(
+void MutableProfileOAuth2TokenServiceDelegate::LoadAllCredentialsIntoMemory(
const std::map<std::string, std::string>& db_tokens) {
std::string old_login_token;
@@ -276,8 +305,7 @@ void MutableProfileOAuth2TokenService::LoadAllCredentialsIntoMemory(
<< db_tokens.size() << " Credential(s).";
for (std::map<std::string, std::string>::const_iterator iter =
db_tokens.begin();
- iter != db_tokens.end();
- ++iter) {
+ iter != db_tokens.end(); ++iter) {
std::string prefixed_account_id = iter->first;
std::string refresh_token = iter->second;
@@ -285,7 +313,7 @@ void MutableProfileOAuth2TokenService::LoadAllCredentialsIntoMemory(
old_login_token = refresh_token;
if (IsLegacyServiceId(prefixed_account_id)) {
- scoped_refptr<TokenWebData> token_web_data = client()->GetDatabase();
+ scoped_refptr<TokenWebData> token_web_data = client_->GetDatabase();
if (token_web_data.get())
token_web_data->RemoveTokenForService(prefixed_account_id);
} else {
@@ -310,17 +338,15 @@ void MutableProfileOAuth2TokenService::LoadAllCredentialsIntoMemory(
account_id = canon_account_id;
}
- refresh_tokens()[account_id].reset(
- new AccountInfo(signin_error_controller(),
- account_id,
- refresh_token));
+ refresh_tokens_[account_id].reset(new AccountInfo(
+ signin_error_controller_, account_id, refresh_token));
FireRefreshTokenAvailable(account_id);
}
}
if (!old_login_token.empty()) {
DCHECK(!loading_primary_account_id_.empty());
- if (refresh_tokens().count(loading_primary_account_id_) == 0)
+ if (refresh_tokens_.count(loading_primary_account_id_) == 0)
UpdateCredentials(loading_primary_account_id_, old_login_token);
}
}
@@ -328,42 +354,7 @@ void MutableProfileOAuth2TokenService::LoadAllCredentialsIntoMemory(
FireRefreshTokensLoaded();
}
-void MutableProfileOAuth2TokenService::UpdateAuthError(
- const std::string& account_id,
- const GoogleServiceAuthError& error) {
- VLOG(1) << "MutablePO2TS::UpdateAuthError. Error: " << error.state();
- backoff_entry_.InformOfRequest(!error.IsTransientError());
- ValidateAccountId(account_id);
-
- // Do not report connection errors as these are not actually auth errors.
- // We also want to avoid masking a "real" auth error just because we
- // subsequently get a transient network error. We do keep it around though
- // to report for future requests being denied for "backoff" reasons.
- if (error.IsTransientError()) {
- backoff_error_ = error;
- return;
- }
-
- if (refresh_tokens_.count(account_id) == 0) {
- // This could happen if the preferences have been corrupted (see
- // http://crbug.com/321370). In a Debug build that would be a bug, but in a
- // Release build we want to deal with it gracefully.
- NOTREACHED();
- return;
- }
- refresh_tokens_[account_id]->SetLastAuthError(error);
-}
-
-std::vector<std::string> MutableProfileOAuth2TokenService::GetAccounts() {
- std::vector<std::string> account_ids;
- for (AccountInfoMap::const_iterator iter = refresh_tokens_.begin();
- iter != refresh_tokens_.end(); ++iter) {
- account_ids.push_back(iter->first);
- }
- return account_ids;
-}
-
-void MutableProfileOAuth2TokenService::UpdateCredentials(
+void MutableProfileOAuth2TokenServiceDelegate::UpdateCredentials(
const std::string& account_id,
const std::string& refresh_token) {
DCHECK(thread_checker_.CalledOnValidThread());
@@ -383,18 +374,13 @@ void MutableProfileOAuth2TokenService::UpdateCredentials(
if (refresh_token_present) {
VLOG(1) << "MutablePO2TS::UpdateCredentials; Refresh Token was present. "
<< "account_id=" << account_id;
- std::string revoke_reason = refresh_token_present ? "token differs" :
- "token is missing";
- CancelRequestsForAccount(account_id);
- ClearCacheForAccount(account_id);
+
refresh_tokens_[account_id]->set_refresh_token(refresh_token);
} else {
VLOG(1) << "MutablePO2TS::UpdateCredentials; Refresh Token was absent. "
<< "account_id=" << account_id;
refresh_tokens_[account_id].reset(
- new AccountInfo(signin_error_controller(),
- account_id,
- refresh_token));
+ new AccountInfo(signin_error_controller_, account_id, refresh_token));
}
// Save the token in memory and in persistent store.
@@ -405,27 +391,10 @@ void MutableProfileOAuth2TokenService::UpdateCredentials(
}
}
-void MutableProfileOAuth2TokenService::RevokeCredentials(
- const std::string& account_id) {
- ValidateAccountId(account_id);
- DCHECK(thread_checker_.CalledOnValidThread());
-
- if (refresh_tokens_.count(account_id) > 0) {
- VLOG(1) << "MutablePO2TS::RevokeCredentials for account_id=" << account_id;
- ScopedBatchChange batch(this);
- RevokeCredentialsOnServer(refresh_tokens_[account_id]->refresh_token());
- CancelRequestsForAccount(account_id);
- ClearCacheForAccount(account_id);
- refresh_tokens_.erase(account_id);
- ClearPersistedCredentials(account_id);
- FireRefreshTokenRevoked(account_id);
- }
-}
-
-void MutableProfileOAuth2TokenService::PersistCredentials(
+void MutableProfileOAuth2TokenServiceDelegate::PersistCredentials(
const std::string& account_id,
const std::string& refresh_token) {
- scoped_refptr<TokenWebData> token_web_data = client()->GetDatabase();
+ scoped_refptr<TokenWebData> token_web_data = client_->GetDatabase();
if (token_web_data.get()) {
VLOG(1) << "MutablePO2TS::PersistCredentials for account_id=" << account_id;
token_web_data->SetTokenForService(ApplyAccountIdPrefix(account_id),
@@ -433,18 +402,8 @@ void MutableProfileOAuth2TokenService::PersistCredentials(
}
}
-void MutableProfileOAuth2TokenService::ClearPersistedCredentials(
- const std::string& account_id) {
- scoped_refptr<TokenWebData> token_web_data = client()->GetDatabase();
- if (token_web_data.get()) {
- VLOG(1) << "MutablePO2TS::ClearPersistedCredentials for account_id="
- << account_id;
- token_web_data->RemoveTokenForService(ApplyAccountIdPrefix(account_id));
- }
-}
-
-void MutableProfileOAuth2TokenService::RevokeAllCredentials() {
- if (!client()->CanRevokeCredentials())
+void MutableProfileOAuth2TokenServiceDelegate::RevokeAllCredentials() {
+ if (!client_->CanRevokeCredentials())
return;
DCHECK(thread_checker_.CalledOnValidThread());
@@ -452,8 +411,6 @@ void MutableProfileOAuth2TokenService::RevokeAllCredentials() {
VLOG(1) << "MutablePO2TS::RevokeAllCredentials";
CancelWebTokenFetch();
- CancelAllRequests();
- ClearCache();
AccountInfoMap tokens = refresh_tokens_;
for (AccountInfoMap::iterator i = tokens.begin(); i != tokens.end(); ++i)
RevokeCredentials(i->first);
@@ -461,24 +418,55 @@ void MutableProfileOAuth2TokenService::RevokeAllCredentials() {
DCHECK_EQ(0u, refresh_tokens_.size());
// Make sure all tokens are removed.
- scoped_refptr<TokenWebData> token_web_data = client()->GetDatabase();
+ scoped_refptr<TokenWebData> token_web_data = client_->GetDatabase();
if (token_web_data.get())
token_web_data->RemoveAllTokens();
}
-void MutableProfileOAuth2TokenService::RevokeCredentialsOnServer(
+void MutableProfileOAuth2TokenServiceDelegate::RevokeCredentials(
+ const std::string& account_id) {
+ ValidateAccountId(account_id);
+ DCHECK(thread_checker_.CalledOnValidThread());
+
+ if (refresh_tokens_.count(account_id) > 0) {
+ VLOG(1) << "MutablePO2TS::RevokeCredentials for account_id=" << account_id;
+ ScopedBatchChange batch(this);
+ RevokeCredentialsOnServer(refresh_tokens_[account_id]->refresh_token());
+ refresh_tokens_.erase(account_id);
+ ClearPersistedCredentials(account_id);
+ FireRefreshTokenRevoked(account_id);
+ }
+}
+
+void MutableProfileOAuth2TokenServiceDelegate::ClearPersistedCredentials(
+ const std::string& account_id) {
+ scoped_refptr<TokenWebData> token_web_data = client_->GetDatabase();
+ if (token_web_data.get()) {
+ VLOG(1) << "MutablePO2TS::ClearPersistedCredentials for account_id="
+ << account_id;
+ token_web_data->RemoveTokenForService(ApplyAccountIdPrefix(account_id));
+ }
+}
+
+void MutableProfileOAuth2TokenServiceDelegate::RevokeCredentialsOnServer(
const std::string& refresh_token) {
// Keep track or all server revoke requests. This way they can be deleted
// before the token service is shutdown and won't outlive the profile.
- server_revokes_.push_back(
- new RevokeServerRefreshToken(this, refresh_token));
+ server_revokes_.push_back(new RevokeServerRefreshToken(this, refresh_token));
}
-void MutableProfileOAuth2TokenService::CancelWebTokenFetch() {
+void MutableProfileOAuth2TokenServiceDelegate::CancelWebTokenFetch() {
if (web_data_service_request_ != 0) {
- scoped_refptr<TokenWebData> token_web_data = client()->GetDatabase();
+ scoped_refptr<TokenWebData> token_web_data = client_->GetDatabase();
DCHECK(token_web_data.get());
token_web_data->CancelRequest(web_data_service_request_);
- web_data_service_request_ = 0;
+ web_data_service_request_ = 0;
}
}
+
+void MutableProfileOAuth2TokenServiceDelegate::Shutdown() {
+ VLOG(1) << "MutablePO2TS::Shutdown";
+ server_revokes_.clear();
+ CancelWebTokenFetch();
+ refresh_tokens_.clear();
+}

Powered by Google App Engine
This is Rietveld 408576698