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

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

Issue 1307093004: Remove references to IsNewAvatarMenu since the flag was removed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review feedback Created 5 years, 3 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/profiles/avatar_menu.cc ('k') | chrome/browser/profiles/profile_info_cache_unittest.cc » ('j') | 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 652c0f1ce8ab7945f4d922fe289f0bc1b5ffbed3..f7e8b2b9dff8991e2583c48f556cf6a675e1d6ea 100644
--- a/chrome/browser/profiles/profile_info_cache.cc
+++ b/chrome/browser/profiles/profile_info_cache.cc
@@ -184,7 +184,7 @@ ProfileInfoCache::ProfileInfoCache(PrefService* prefs,
// If needed, start downloading the high-res avatars and migrate any legacy
// profile names.
- if (switches::IsNewAvatarMenu() && !disable_avatar_download_for_testing_)
+ if (!disable_avatar_download_for_testing_)
MigrateLegacyProfileNamesAndDownloadAvatars();
}
@@ -225,7 +225,7 @@ void ProfileInfoCache::AddProfileToCache(
sorted_keys_.insert(FindPositionForProfile(key, name), key);
- if (switches::IsNewAvatarMenu() && !disable_avatar_download_for_testing_)
+ if (!disable_avatar_download_for_testing_)
DownloadHighResAvatarIfNeeded(icon_index, profile_path);
FOR_EACH_OBSERVER(ProfileInfoCacheObserver,
@@ -331,12 +331,13 @@ const gfx::Image& ProfileInfoCache::GetAvatarIconOfProfileAtIndex(
return *image;
}
- // Use the high resolution version of the avatar if it exists.
- if (switches::IsNewAvatarMenu()) {
- const gfx::Image* image = GetHighResAvatarOfProfileAtIndex(index);
- if (image)
- return *image;
- }
+#if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS)
+ // Use the high resolution version of the avatar if it exists. Mobile and
+ // ChromeOS don't need the high resolution version so no need to fetch it.
+ const gfx::Image* image = GetHighResAvatarOfProfileAtIndex(index);
+ if (image)
+ return *image;
+#endif
int resource_id = profiles::GetDefaultAvatarIconResourceIDAtIndex(
GetAvatarIconIndexOfProfileAtIndex(index));
@@ -585,7 +586,7 @@ void ProfileInfoCache::SetAvatarIconOfProfileAtIndex(size_t index,
base::FilePath profile_path = GetPathOfProfileAtIndex(index);
- if (switches::IsNewAvatarMenu() && !disable_avatar_download_for_testing_)
+ if (!disable_avatar_download_for_testing_)
DownloadHighResAvatarIfNeeded(icon_index, profile_path);
FOR_EACH_OBSERVER(ProfileInfoCacheObserver,
@@ -864,10 +865,11 @@ base::string16 ProfileInfoCache::ChooseNameForNewProfile(
size_t icon_index) const {
base::string16 name;
for (int name_index = 1; ; ++name_index) {
- if (switches::IsNewAvatarMenu()) {
- name = l10n_util::GetStringFUTF16Int(IDS_NEW_NUMBERED_PROFILE_NAME,
- name_index);
- } else if (icon_index < profiles::GetGenericAvatarIconCount()) {
+#if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS)
+ name = l10n_util::GetStringFUTF16Int(IDS_NEW_NUMBERED_PROFILE_NAME,
+ name_index);
+#else
+ if (icon_index < profiles::GetGenericAvatarIconCount()) {
name = l10n_util::GetStringFUTF16Int(IDS_NUMBERED_PROFILE_NAME,
name_index);
} else {
@@ -876,6 +878,7 @@ base::string16 ProfileInfoCache::ChooseNameForNewProfile(
if (name_index > 1)
name.append(base::UTF8ToUTF16(base::IntToString(name_index)));
}
+#endif
// Loop through previously named profiles to ensure we're not duplicating.
bool name_found = false;
@@ -1027,10 +1030,10 @@ bool ProfileInfoCache::ChooseAvatarIconIndexForNewProfile(
bool allow_generic_icon,
bool must_be_unique,
size_t* out_icon_index) const {
- // Always allow all icons for new profiles if using the
- // --new-avatar-menu flag.
- if (switches::IsNewAvatarMenu())
- allow_generic_icon = true;
+#if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS)
+ // Always allow the generic icon when displaying the new avatar menu.
+ allow_generic_icon = true;
+#endif
size_t start = allow_generic_icon ? 0 : profiles::GetGenericAvatarIconCount();
size_t end = profiles::GetDefaultAvatarIconCount();
size_t count = end - start;
@@ -1200,8 +1203,6 @@ void ProfileInfoCache::OnAvatarPictureSaved(
}
void ProfileInfoCache::MigrateLegacyProfileNamesAndDownloadAvatars() {
- DCHECK(switches::IsNewAvatarMenu());
-
// Only do this on desktop platforms.
#if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS)
// Migrate any legacy profile names ("First user", "Default Profile") to
« no previous file with comments | « chrome/browser/profiles/avatar_menu.cc ('k') | chrome/browser/profiles/profile_info_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698