OLD | NEW |
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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 // Tries to find an icon index that satisfies all the given conditions. | 182 // Tries to find an icon index that satisfies all the given conditions. |
183 // Returns true if an icon was found, false otherwise. | 183 // Returns true if an icon was found, false otherwise. |
184 bool ChooseAvatarIconIndexForNewProfile(bool allow_generic_icon, | 184 bool ChooseAvatarIconIndexForNewProfile(bool allow_generic_icon, |
185 bool must_be_unique, | 185 bool must_be_unique, |
186 size_t* out_icon_index) const; | 186 size_t* out_icon_index) const; |
187 | 187 |
188 // Updates the position of the profile at the given index so that the list | 188 // Updates the position of the profile at the given index so that the list |
189 // of profiles is still sorted. | 189 // of profiles is still sorted. |
190 void UpdateSortForProfileIndex(size_t index); | 190 void UpdateSortForProfileIndex(size_t index); |
191 | 191 |
192 void OnGAIAPictureLoaded(const base::FilePath& path, | 192 // Loads or uses an already loaded high resolution image of the |
193 gfx::Image** image) const; | 193 // generic profile avatar. |
| 194 const gfx::Image* GetHighResAvatarOfProfileAtIndex(size_t index) const; |
| 195 |
| 196 void LoadAvatarPictureFromPath(const std::string& key, |
| 197 const base::FilePath& image_path) const; |
| 198 void OnAvatarPictureLoaded(const std::string& key, |
| 199 gfx::Image** image) const; |
194 void OnGAIAPictureSaved(const base::FilePath& path, bool* success) const; | 200 void OnGAIAPictureSaved(const base::FilePath& path, bool* success) const; |
195 | 201 |
196 PrefService* prefs_; | 202 PrefService* prefs_; |
197 std::vector<std::string> sorted_keys_; | 203 std::vector<std::string> sorted_keys_; |
198 base::FilePath user_data_dir_; | 204 base::FilePath user_data_dir_; |
199 | 205 |
200 ObserverList<ProfileInfoCacheObserver> observer_list_; | 206 ObserverList<ProfileInfoCacheObserver> observer_list_; |
201 | 207 |
202 // A cache of gaia profile pictures. This cache is updated lazily so it needs | 208 // A cache of gaia/high res avatar profile pictures. This cache is updated |
203 // to be mutable. | 209 // lazily so it needs to be mutable. |
204 mutable std::map<std::string, gfx::Image*> gaia_pictures_; | 210 mutable std::map<std::string, gfx::Image*> cached_avatar_images_; |
205 // Marks a gaia profile picture as loading. This prevents a picture from | 211 // Marks a profile picture as loading. This prevents a picture from |
206 // loading multiple times. | 212 // loading multiple times. |
207 mutable std::map<std::string, bool> gaia_pictures_loading_; | 213 mutable std::map<std::string, bool> cached_avatar_images_loading_; |
208 | 214 |
209 DISALLOW_COPY_AND_ASSIGN(ProfileInfoCache); | 215 DISALLOW_COPY_AND_ASSIGN(ProfileInfoCache); |
210 }; | 216 }; |
211 | 217 |
212 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_ | 218 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_ |
OLD | NEW |