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

Unified Diff: components/proximity_auth/cryptauth/cryptauth_gcm_manager_impl.cc

Issue 2423353002: Reduce usage of FOR_EACH_OBSERVER macro in components/ (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
Index: components/proximity_auth/cryptauth/cryptauth_gcm_manager_impl.cc
diff --git a/components/proximity_auth/cryptauth/cryptauth_gcm_manager_impl.cc b/components/proximity_auth/cryptauth/cryptauth_gcm_manager_impl.cc
index 588ddcf3a458db33c3d42987649a29694ac2ce73..77680e8f31f40be707e320f2f0acdb05c644797b 100644
--- a/components/proximity_auth/cryptauth/cryptauth_gcm_manager_impl.cc
+++ b/components/proximity_auth/cryptauth/cryptauth_gcm_manager_impl.cc
@@ -102,9 +102,11 @@ void CryptAuthGCMManagerImpl::OnMessage(const std::string& app_id,
if (tickle_type == kRegistrationTickleTypeForceEnrollment ||
tickle_type == kRegistrationTickleTypeUpdateEnrollment) {
// These tickle types correspond to re-enrollment messages.
- FOR_EACH_OBSERVER(Observer, observers_, OnReenrollMessage());
+ for (auto& observer : observers_)
+ observer.OnReenrollMessage();
} else if (tickle_type == kRegistrationTickleTypeDevicesSync) {
- FOR_EACH_OBSERVER(Observer, observers_, OnResyncMessage());
+ for (auto& observer : observers_)
+ observer.OnResyncMessage();
} else {
PA_LOG(WARNING) << "Unknown tickle type in GCM message.";
}
@@ -133,14 +135,16 @@ void CryptAuthGCMManagerImpl::OnRegistrationCompleted(
if (result != gcm::GCMClient::SUCCESS) {
PA_LOG(WARNING) << "GCM registration failed with result="
<< static_cast<int>(result);
- FOR_EACH_OBSERVER(Observer, observers_, OnGCMRegistrationResult(false));
+ for (auto& observer : observers_)
+ observer.OnGCMRegistrationResult(false);
return;
}
PA_LOG(INFO) << "GCM registration success, registration_id="
<< registration_id;
pref_service_->SetString(prefs::kCryptAuthGCMRegistrationId, registration_id);
- FOR_EACH_OBSERVER(Observer, observers_, OnGCMRegistrationResult(true));
+ for (auto& observer : observers_)
+ observer.OnGCMRegistrationResult(true);
}
} // namespace proximity_auth

Powered by Google App Engine
This is Rietveld 408576698