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

Unified Diff: google_apis/gaia/oauth2_token_service.cc

Issue 2422843003: Remove usage of FOR_EACH_OBSERVER macro in google_apis (Closed)
Patch Set: Created 4 years, 2 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 | « google_apis/gaia/identity_provider.cc ('k') | google_apis/gaia/oauth2_token_service_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/gaia/oauth2_token_service.cc
diff --git a/google_apis/gaia/oauth2_token_service.cc b/google_apis/gaia/oauth2_token_service.cc
index 7e55a491d4e63b7af9c8cb0df5e13f77fceb25e6..01614d83f8a83916c0eb7eb3c71a386764bca820 100644
--- a/google_apis/gaia/oauth2_token_service.cc
+++ b/google_apis/gaia/oauth2_token_service.cc
@@ -483,10 +483,8 @@ OAuth2TokenService::StartRequestForClientWithContext(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
"422460 OAuth2TokenService::StartRequestForClientWithContext 1"));
std::unique_ptr<RequestImpl> request(new RequestImpl(account_id, consumer));
- FOR_EACH_OBSERVER(DiagnosticsObserver, diagnostics_observer_list_,
- OnAccessTokenRequested(account_id,
- consumer->id(),
- scopes));
+ for (auto& observer : diagnostics_observer_list_)
+ observer.OnAccessTokenRequested(account_id, consumer->id(), scopes);
if (!RefreshTokenIsAvailable(account_id)) {
// TODO(robliao): Remove ScopedTracker below once https://crbug.com/422460
@@ -497,10 +495,10 @@ OAuth2TokenService::StartRequestForClientWithContext(
GoogleServiceAuthError error(GoogleServiceAuthError::USER_NOT_SIGNED_UP);
- FOR_EACH_OBSERVER(DiagnosticsObserver, diagnostics_observer_list_,
- OnFetchAccessTokenComplete(
- account_id, consumer->id(), scopes, error,
- base::Time()));
+ for (auto& observer : diagnostics_observer_list_) {
+ observer.OnFetchAccessTokenComplete(account_id, consumer->id(), scopes,
+ error, base::Time());
+ }
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
@@ -578,13 +576,12 @@ void OAuth2TokenService::StartCacheLookupRequest(
OAuth2TokenService::Consumer* consumer) {
CHECK(HasCacheEntry(request_parameters));
const CacheEntry* cache_entry = GetCacheEntry(request_parameters);
- FOR_EACH_OBSERVER(DiagnosticsObserver, diagnostics_observer_list_,
- OnFetchAccessTokenComplete(
- request_parameters.account_id,
- consumer->id(),
- request_parameters.scopes,
- GoogleServiceAuthError::AuthErrorNone(),
- cache_entry->expiration_date));
+ for (auto& observer : diagnostics_observer_list_) {
+ observer.OnFetchAccessTokenComplete(
+ request_parameters.account_id, consumer->id(),
+ request_parameters.scopes, GoogleServiceAuthError::AuthErrorNone(),
+ cache_entry->expiration_date);
+ }
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::Bind(&RequestImpl::InformConsumer, request->AsWeakPtr(),
@@ -681,11 +678,11 @@ void OAuth2TokenService::OnFetchComplete(Fetcher* fetcher) {
for (size_t i = 0; i < requests.size(); ++i) {
const RequestImpl* req = requests[i].get();
if (req) {
- FOR_EACH_OBSERVER(DiagnosticsObserver, diagnostics_observer_list_,
- OnFetchAccessTokenComplete(
- req->GetAccountId(), req->GetConsumerId(),
- fetcher->GetScopeSet(), fetcher->error(),
- entry ? entry->expiration_date : base::Time()));
+ for (auto& observer : diagnostics_observer_list_) {
+ observer.OnFetchAccessTokenComplete(
+ req->GetAccountId(), req->GetConsumerId(), fetcher->GetScopeSet(),
+ fetcher->error(), entry ? entry->expiration_date : base::Time());
+ }
}
}
@@ -724,9 +721,10 @@ bool OAuth2TokenService::RemoveCacheEntry(
TokenCache::iterator token_iterator = token_cache_.find(request_parameters);
if (token_iterator != token_cache_.end() &&
token_iterator->second.access_token == token_to_remove) {
- FOR_EACH_OBSERVER(DiagnosticsObserver, diagnostics_observer_list_,
- OnTokenRemoved(request_parameters.account_id,
- request_parameters.scopes));
+ for (auto& observer : diagnostics_observer_list_) {
+ observer.OnTokenRemoved(request_parameters.account_id,
+ request_parameters.scopes);
+ }
token_cache_.erase(token_iterator);
return true;
}
@@ -756,9 +754,8 @@ void OAuth2TokenService::ClearCache() {
DCHECK(CalledOnValidThread());
for (TokenCache::iterator iter = token_cache_.begin();
iter != token_cache_.end(); ++iter) {
- FOR_EACH_OBSERVER(DiagnosticsObserver, diagnostics_observer_list_,
- OnTokenRemoved(iter->first.account_id,
- iter->first.scopes));
+ for (auto& observer : diagnostics_observer_list_)
+ observer.OnTokenRemoved(iter->first.account_id, iter->first.scopes);
}
token_cache_.clear();
@@ -770,8 +767,8 @@ void OAuth2TokenService::ClearCacheForAccount(const std::string& account_id) {
iter != token_cache_.end();
/* iter incremented in body */) {
if (iter->first.account_id == account_id) {
- FOR_EACH_OBSERVER(DiagnosticsObserver, diagnostics_observer_list_,
- OnTokenRemoved(account_id, iter->first.scopes));
+ for (auto& observer : diagnostics_observer_list_)
+ observer.OnTokenRemoved(account_id, iter->first.scopes);
token_cache_.erase(iter++);
} else {
++iter;
« no previous file with comments | « google_apis/gaia/identity_provider.cc ('k') | google_apis/gaia/oauth2_token_service_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698