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

Unified Diff: chrome/browser/profiles/profile_info_cache.cc

Issue 2422963002: Remove FOR_EACH_OBSERVER macro usage in chrome/browser/extensions (Closed)
Patch Set: extensions 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 | « chrome/browser/extensions/window_controller_list.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_info_cache.cc
diff --git a/chrome/browser/profiles/profile_info_cache.cc b/chrome/browser/profiles/profile_info_cache.cc
index 75f50968a70e36f13e1a1033bbe9332dc887df75..dcd2ed2a2602336ea46950eef976bcc11326b823 100644
--- a/chrome/browser/profiles/profile_info_cache.cc
+++ b/chrome/browser/profiles/profile_info_cache.cc
@@ -209,9 +209,8 @@ void ProfileInfoCache::AddProfileToCache(
if (!disable_avatar_download_for_testing_)
DownloadHighResAvatarIfNeeded(icon_index, profile_path);
- FOR_EACH_OBSERVER(ProfileInfoCacheObserver,
- observer_list_,
- OnProfileAdded(profile_path));
+ for (auto& observer : observer_list_)
+ observer.OnProfileAdded(profile_path);
}
void ProfileInfoCache::AddObserver(ProfileInfoCacheObserver* obs) {
@@ -231,9 +230,8 @@ void ProfileInfoCache::DeleteProfileFromCache(
}
base::string16 name = GetNameOfProfileAtIndex(profile_index);
- FOR_EACH_OBSERVER(ProfileInfoCacheObserver,
- observer_list_,
- OnProfileWillBeRemoved(profile_path));
+ for (auto& observer : observer_list_)
+ observer.OnProfileWillBeRemoved(profile_path);
DictionaryPrefUpdate update(prefs_, prefs::kProfileInfoCache);
base::DictionaryValue* cache = update.Get();
@@ -242,9 +240,8 @@ void ProfileInfoCache::DeleteProfileFromCache(
sorted_keys_.erase(std::find(sorted_keys_.begin(), sorted_keys_.end(), key));
profile_attributes_entries_.erase(profile_path.value());
- FOR_EACH_OBSERVER(ProfileInfoCacheObserver,
- observer_list_,
- OnProfileWasRemoved(profile_path, name));
+ for (auto& observer : observer_list_)
+ observer.OnProfileWasRemoved(profile_path, name);
}
size_t ProfileInfoCache::GetNumberOfProfiles() const {
@@ -562,9 +559,8 @@ void ProfileInfoCache::SetNameOfProfileAtIndex(size_t index,
UpdateSortForProfileIndex(index);
if (old_display_name != new_display_name) {
- FOR_EACH_OBSERVER(ProfileInfoCacheObserver,
- observer_list_,
- OnProfileNameChanged(profile_path, old_display_name));
+ for (auto& observer : observer_list_)
+ observer.OnProfileNameChanged(profile_path, old_display_name);
}
}
@@ -600,9 +596,8 @@ void ProfileInfoCache::SetAuthInfoOfProfileAtIndex(
SetInfoForProfileAtIndex(index, info.release());
base::FilePath profile_path = GetPathOfProfileAtIndex(index);
- FOR_EACH_OBSERVER(ProfileInfoCacheObserver,
- observer_list_,
- OnProfileAuthInfoChanged(profile_path));
+ for (auto& observer : observer_list_)
+ observer.OnProfileAuthInfoChanged(profile_path);
}
void ProfileInfoCache::SetAvatarIconOfProfileAtIndex(size_t index,
@@ -619,9 +614,8 @@ void ProfileInfoCache::SetAvatarIconOfProfileAtIndex(size_t index,
if (!disable_avatar_download_for_testing_)
DownloadHighResAvatarIfNeeded(icon_index, profile_path);
- FOR_EACH_OBSERVER(ProfileInfoCacheObserver,
- observer_list_,
- OnProfileAvatarChanged(profile_path));
+ for (auto& observer : observer_list_)
+ observer.OnProfileAvatarChanged(profile_path);
}
void ProfileInfoCache::SetIsOmittedProfileAtIndex(size_t index,
@@ -635,9 +629,8 @@ void ProfileInfoCache::SetIsOmittedProfileAtIndex(size_t index,
SetInfoForProfileAtIndex(index, info.release());
base::FilePath profile_path = GetPathOfProfileAtIndex(index);
- FOR_EACH_OBSERVER(ProfileInfoCacheObserver,
- observer_list_,
- OnProfileIsOmittedChanged(profile_path));
+ for (auto& observer : observer_list_)
+ observer.OnProfileIsOmittedChanged(profile_path);
}
void ProfileInfoCache::SetSupervisedUserIdOfProfileAtIndex(
@@ -652,9 +645,8 @@ void ProfileInfoCache::SetSupervisedUserIdOfProfileAtIndex(
SetInfoForProfileAtIndex(index, info.release());
base::FilePath profile_path = GetPathOfProfileAtIndex(index);
- FOR_EACH_OBSERVER(ProfileInfoCacheObserver,
- observer_list_,
- OnProfileSupervisedUserIdChanged(profile_path));
+ for (auto& observer : observer_list_)
+ observer.OnProfileSupervisedUserIdChanged(profile_path);
}
void ProfileInfoCache::SetLocalAuthCredentialsOfProfileAtIndex(
@@ -705,9 +697,8 @@ void ProfileInfoCache::SetGAIANameOfProfileAtIndex(size_t index,
UpdateSortForProfileIndex(index);
if (old_display_name != new_display_name) {
- FOR_EACH_OBSERVER(ProfileInfoCacheObserver,
- observer_list_,
- OnProfileNameChanged(profile_path, old_display_name));
+ for (auto& observer : observer_list_)
+ observer.OnProfileNameChanged(profile_path, old_display_name);
}
}
@@ -728,9 +719,8 @@ void ProfileInfoCache::SetGAIAGivenNameOfProfileAtIndex(
UpdateSortForProfileIndex(index);
if (old_display_name != new_display_name) {
- FOR_EACH_OBSERVER(ProfileInfoCacheObserver,
- observer_list_,
- OnProfileNameChanged(profile_path, old_display_name));
+ for (auto& observer : observer_list_)
+ observer.OnProfileNameChanged(profile_path, old_display_name);
}
}
@@ -769,9 +759,8 @@ void ProfileInfoCache::SetGAIAPictureOfProfileAtIndex(size_t index,
// This takes ownership of |info|.
SetInfoForProfileAtIndex(index, info.release());
- FOR_EACH_OBSERVER(ProfileInfoCacheObserver,
- observer_list_,
- OnProfileAvatarChanged(path));
+ for (auto& observer : observer_list_)
+ observer.OnProfileAvatarChanged(path);
}
void ProfileInfoCache::SetIsUsingGAIAPictureOfProfileAtIndex(size_t index,
@@ -783,9 +772,8 @@ void ProfileInfoCache::SetIsUsingGAIAPictureOfProfileAtIndex(size_t index,
SetInfoForProfileAtIndex(index, info.release());
base::FilePath profile_path = GetPathOfProfileAtIndex(index);
- FOR_EACH_OBSERVER(ProfileInfoCacheObserver,
- observer_list_,
- OnProfileAvatarChanged(profile_path));
+ for (auto& observer : observer_list_)
+ observer.OnProfileAvatarChanged(profile_path);
}
void ProfileInfoCache::SetProfileSigninRequiredAtIndex(size_t index,
@@ -800,9 +788,8 @@ void ProfileInfoCache::SetProfileSigninRequiredAtIndex(size_t index,
SetInfoForProfileAtIndex(index, info.release());
base::FilePath profile_path = GetPathOfProfileAtIndex(index);
- FOR_EACH_OBSERVER(ProfileInfoCacheObserver,
- observer_list_,
- OnProfileSigninRequiredChanged(profile_path));
+ for (auto& observer : observer_list_)
+ observer.OnProfileSigninRequiredChanged(profile_path);
}
void ProfileInfoCache::SetProfileIsEphemeralAtIndex(size_t index, bool value) {
@@ -833,9 +820,8 @@ void ProfileInfoCache::SetProfileIsUsingDefaultNameAtIndex(
const base::FilePath profile_path = GetPathOfProfileAtIndex(index);
if (old_display_name != new_display_name) {
- FOR_EACH_OBSERVER(ProfileInfoCacheObserver,
- observer_list_,
- OnProfileNameChanged(profile_path, old_display_name));
+ for (auto& observer : observer_list_)
+ observer.OnProfileNameChanged(profile_path, old_display_name);
}
}
@@ -1146,9 +1132,8 @@ void ProfileInfoCache::OnAvatarPictureLoaded(const base::FilePath& profile_path,
"461175 ProfileInfoCache::OnAvatarPictureLoaded::DeleteImage"));
delete image;
- FOR_EACH_OBSERVER(ProfileInfoCacheObserver,
- observer_list_,
- OnProfileHighResAvatarLoaded(profile_path));
+ for (auto& observer : observer_list_)
+ observer.OnProfileHighResAvatarLoaded(profile_path);
}
void ProfileInfoCache::OnAvatarPictureSaved(
@@ -1156,9 +1141,8 @@ void ProfileInfoCache::OnAvatarPictureSaved(
const base::FilePath& profile_path) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
- FOR_EACH_OBSERVER(ProfileInfoCacheObserver,
- observer_list_,
- OnProfileHighResAvatarLoaded(profile_path));
+ for (auto& observer : observer_list_)
+ observer.OnProfileHighResAvatarLoaded(profile_path);
}
void ProfileInfoCache::MigrateLegacyProfileNamesAndDownloadAvatars() {
« no previous file with comments | « chrome/browser/extensions/window_controller_list.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698