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

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

Issue 7493082: Multi-Profiles: New Icon drop (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 2nd try Created 9 years, 5 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/app/theme/theme_resources.grd ('k') | chrome/browser/ui/views/avatar_menu.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 32bf6d57297e0f5348fb228f7cf432fda2bb402c..d50e24ed9a631b72cd916f79da396e23568e0bf4 100644
--- a/chrome/browser/profiles/profile_info_cache.cc
+++ b/chrome/browser/profiles/profile_info_cache.cc
@@ -49,10 +49,28 @@ const int kDefaultAvatarIconResources[] = {
IDR_PROFILE_AVATAR_17,
IDR_PROFILE_AVATAR_18,
IDR_PROFILE_AVATAR_19,
+ IDR_PROFILE_AVATAR_20,
+ IDR_PROFILE_AVATAR_21,
+ IDR_PROFILE_AVATAR_22,
+ IDR_PROFILE_AVATAR_23,
+ IDR_PROFILE_AVATAR_24,
+ IDR_PROFILE_AVATAR_25,
};
const size_t kDefaultAvatarIconsCount = arraysize(kDefaultAvatarIconResources);
+// Returns true if the resource ID belongs to a generic avatar icon.
+bool IsAvatarIconGeneric(int icon_id) {
+ return icon_id == IDR_PROFILE_AVATAR_0 ||
+ icon_id == IDR_PROFILE_AVATAR_1 ||
+ icon_id == IDR_PROFILE_AVATAR_2 ||
+ icon_id == IDR_PROFILE_AVATAR_3 ||
+ icon_id == IDR_PROFILE_AVATAR_4 ||
+ icon_id == IDR_PROFILE_AVATAR_5 ||
+ icon_id == IDR_PROFILE_AVATAR_6 ||
+ icon_id == IDR_PROFILE_AVATAR_7;
+}
+
} // namespace
ProfileInfoCache::ProfileInfoCache(PrefService* prefs,
@@ -195,6 +213,10 @@ int ProfileInfoCache::ChooseAvatarIconIndexForNewProfile() {
++icon_index) {
size_t rand_icon_index =
(icon_index + rand_start_index) % GetDefaultAvatarIconCount();
+ if (IsAvatarIconGeneric(GetDefaultAvatarIconResourceIDAtIndex(
+ rand_icon_index)))
+ continue;
+
bool icon_found = false;
for (size_t i = 0; i < GetNumberOfProfiles(); ++i) {
if (GetAvatarIconIndexOfProfileAtIndex(i) == rand_icon_index) {
« no previous file with comments | « chrome/app/theme/theme_resources.grd ('k') | chrome/browser/ui/views/avatar_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698