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

Side by Side Diff: chrome/browser/profiles/profile_info_cache.cc

Issue 854433003: [Resources] Add profile-sized assets for the generic placeholder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: match variable name to asset file name Created 5 years, 11 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/profiles/profile_avatar_icon_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/profiles/profile_info_cache.h" 5 #include "chrome/browser/profiles/profile_info_cache.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/i18n/case_conversion.h" 9 #include "base/i18n/case_conversion.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, 999 chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED,
1000 content::NotificationService::AllSources(), 1000 content::NotificationService::AllSources(),
1001 content::NotificationService::NoDetails()); 1001 content::NotificationService::NoDetails());
1002 } 1002 }
1003 1003
1004 const gfx::Image* ProfileInfoCache::GetHighResAvatarOfProfileAtIndex( 1004 const gfx::Image* ProfileInfoCache::GetHighResAvatarOfProfileAtIndex(
1005 size_t index) const { 1005 size_t index) const {
1006 int avatar_index = GetAvatarIconIndexOfProfileAtIndex(index); 1006 int avatar_index = GetAvatarIconIndexOfProfileAtIndex(index);
1007 std::string key = profiles::GetDefaultAvatarIconFileNameAtIndex(avatar_index); 1007 std::string key = profiles::GetDefaultAvatarIconFileNameAtIndex(avatar_index);
1008 1008
1009 if (!strcmp(key.c_str(), profiles::GetNoHighResAvatarFileName())) 1009 // If this is the placeholder avatar, it is already included in the
1010 return NULL; 1010 // resources, so it doesn't need to be downloaded.
1011 if (!strcmp(key.c_str(), profiles::GetNoHighResAvatarFileName())) {
1012 return &ui::ResourceBundle::GetSharedInstance().GetImageNamed(
1013 profiles::GetPlaceholderAvatarIconResourceID());
1014 }
1011 1015
1012 base::FilePath image_path = 1016 base::FilePath image_path =
1013 profiles::GetPathOfHighResAvatarAtIndex(avatar_index); 1017 profiles::GetPathOfHighResAvatarAtIndex(avatar_index);
1014 return LoadAvatarPictureFromPath(GetPathOfProfileAtIndex(index), 1018 return LoadAvatarPictureFromPath(GetPathOfProfileAtIndex(index),
1015 key, image_path); 1019 key, image_path);
1016 } 1020 }
1017 1021
1018 const gfx::Image* ProfileInfoCache::LoadAvatarPictureFromPath( 1022 const gfx::Image* ProfileInfoCache::LoadAvatarPictureFromPath(
1019 const base::FilePath& profile_path, 1023 const base::FilePath& profile_path,
1020 const std::string& key, 1024 const std::string& key,
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 std::vector<base::FilePath>::const_iterator it; 1127 std::vector<base::FilePath>::const_iterator it;
1124 for (it = profiles_to_rename.begin(); it != profiles_to_rename.end(); ++it) { 1128 for (it = profiles_to_rename.begin(); it != profiles_to_rename.end(); ++it) {
1125 size_t profile_index = GetIndexOfProfileWithPath(*it); 1129 size_t profile_index = GetIndexOfProfileWithPath(*it);
1126 SetProfileIsUsingDefaultNameAtIndex(profile_index, true); 1130 SetProfileIsUsingDefaultNameAtIndex(profile_index, true);
1127 // This will assign a new "Person %d" type name and re-sort the cache. 1131 // This will assign a new "Person %d" type name and re-sort the cache.
1128 SetNameOfProfileAtIndex(profile_index, ChooseNameForNewProfile( 1132 SetNameOfProfileAtIndex(profile_index, ChooseNameForNewProfile(
1129 GetAvatarIconIndexOfProfileAtIndex(profile_index))); 1133 GetAvatarIconIndexOfProfileAtIndex(profile_index)));
1130 } 1134 }
1131 #endif 1135 #endif
1132 } 1136 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_avatar_icon_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698