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

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

Issue 212603011: Newly created profiles should have the grey silhouette as avatar. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Undo changes to (.png) image resources. Created 6 years, 9 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: 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 8c357878a0fbb764a48a9a991b04d18d24bada21..7901f0444befb43e36dda0ad6c0e7db75848ac26 100644
--- a/chrome/browser/profiles/profile_info_cache.cc
+++ b/chrome/browser/profiles/profile_info_cache.cc
@@ -89,8 +89,12 @@ const int kDefaultAvatarIconResources[] = {
IDR_PROFILE_AVATAR_23,
IDR_PROFILE_AVATAR_24,
IDR_PROFILE_AVATAR_25,
+ IDR_PROFILE_AVATAR_26,
};
+// This avatar does not exist on the server, the high res copy is in the build.
+const char* kNoHighResAvatar = "NothingToDownload";
+
// File names for the high-res avatar icon resources. In the same order as
// the avatars in kDefaultAvatarIconResources.
const char* kDefaultAvatarIconResourceFileNames[] = {
@@ -120,6 +124,7 @@ const char* kDefaultAvatarIconResourceFileNames[] = {
"avatar_margarita.png",
"avatar_note.png",
"avatar_sun_cloud.png",
+ kNoHighResAvatar,
};
const size_t kDefaultAvatarIconsCount = arraysize(kDefaultAvatarIconResources);
@@ -127,6 +132,9 @@ const size_t kDefaultAvatarIconsCount = arraysize(kDefaultAvatarIconResources);
// The first 8 icons are generic.
const size_t kGenericIconCount = 8;
+// The avatar used as a placeholder (grey silhouette).
+const int kPlaceholderAvatarIcon = 26;
+
// First eight are generic icons, which use IDS_NUMBERED_PROFILE_NAME.
const int kDefaultNames[] = {
IDS_DEFAULT_AVATAR_NAME_8,
@@ -146,7 +154,8 @@ const int kDefaultNames[] = {
IDS_DEFAULT_AVATAR_NAME_22,
IDS_DEFAULT_AVATAR_NAME_23,
IDS_DEFAULT_AVATAR_NAME_24,
- IDS_DEFAULT_AVATAR_NAME_25
+ IDS_DEFAULT_AVATAR_NAME_25,
+ IDS_DEFAULT_AVATAR_NAME_26
};
typedef std::vector<unsigned char> ImageData;
@@ -464,6 +473,9 @@ const gfx::Image* ProfileInfoCache::GetHighResAvatarOfProfileAtIndex(
int avatar_index = GetAvatarIconIndexOfProfileAtIndex(index);
std::string key = kDefaultAvatarIconResourceFileNames[avatar_index];
+ if (!strcmp(key.c_str(), kNoHighResAvatar))
+ return NULL;
+
base::FilePath user_data_dir;
PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
base::FilePath image_path =
@@ -930,6 +942,15 @@ size_t ProfileInfoCache::GetDefaultAvatarIconCount() {
return kDefaultAvatarIconsCount;
}
+
+int ProfileInfoCache::GetPlaceholderAvatarIndex() {
+ return kPlaceholderAvatarIcon;
+}
+
+int ProfileInfoCache::GetPlaceholderAvatarIconResourceID() {
+ return IDR_PROFILE_AVATAR_26;
+}
+
// static
int ProfileInfoCache::GetDefaultAvatarIconResourceIDAtIndex(size_t index) {
DCHECK(IsDefaultAvatarIconIndex(index));

Powered by Google App Engine
This is Rietveld 408576698