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

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

Issue 210043005: [Profiles] Use high resolution avatars if they exist (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: roger comments 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_info_cache.cc » ('j') | 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 #ifndef CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_ 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_
6 #define CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_ 6 #define CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 // Tries to find an icon index that satisfies all the given conditions. 170 // Tries to find an icon index that satisfies all the given conditions.
171 // Returns true if an icon was found, false otherwise. 171 // Returns true if an icon was found, false otherwise.
172 bool ChooseAvatarIconIndexForNewProfile(bool allow_generic_icon, 172 bool ChooseAvatarIconIndexForNewProfile(bool allow_generic_icon,
173 bool must_be_unique, 173 bool must_be_unique,
174 size_t* out_icon_index) const; 174 size_t* out_icon_index) const;
175 175
176 // Updates the position of the profile at the given index so that the list 176 // Updates the position of the profile at the given index so that the list
177 // of profiles is still sorted. 177 // of profiles is still sorted.
178 void UpdateSortForProfileIndex(size_t index); 178 void UpdateSortForProfileIndex(size_t index);
179 179
180 void OnGAIAPictureLoaded(const base::FilePath& path, 180 // Loads or uses an already loaded high resolution image of the
181 gfx::Image** image) const; 181 // generic profile avatar.
182 const gfx::Image* GetHighResAvatarOfProfileAtIndex(size_t index) const;
183
184 const gfx::Image* LoadAvatarPictureFromPath(
185 const std::string& key,
186 const base::FilePath& image_path) const;
187 void OnAvatarPictureLoaded(const std::string& key,
188 gfx::Image** image) const;
182 void OnGAIAPictureSaved(const base::FilePath& path, bool* success) const; 189 void OnGAIAPictureSaved(const base::FilePath& path, bool* success) const;
183 190
184 PrefService* prefs_; 191 PrefService* prefs_;
185 std::vector<std::string> sorted_keys_; 192 std::vector<std::string> sorted_keys_;
186 base::FilePath user_data_dir_; 193 base::FilePath user_data_dir_;
187 194
188 ObserverList<ProfileInfoCacheObserver> observer_list_; 195 ObserverList<ProfileInfoCacheObserver> observer_list_;
189 196
190 // A cache of gaia profile pictures. This cache is updated lazily so it needs 197 // A cache of gaia/high res avatar profile pictures. This cache is updated
191 // to be mutable. 198 // lazily so it needs to be mutable.
192 mutable std::map<std::string, gfx::Image*> gaia_pictures_; 199 mutable std::map<std::string, gfx::Image*> cached_avatar_images_;
193 // Marks a gaia profile picture as loading. This prevents a picture from 200 // Marks a profile picture as loading. This prevents a picture from
194 // loading multiple times. 201 // loading multiple times.
195 mutable std::map<std::string, bool> gaia_pictures_loading_; 202 mutable std::map<std::string, bool> cached_avatar_images_loading_;
196 203
197 DISALLOW_COPY_AND_ASSIGN(ProfileInfoCache); 204 DISALLOW_COPY_AND_ASSIGN(ProfileInfoCache);
198 }; 205 };
199 206
200 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_ 207 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_info_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698