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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 199 |
200 // Called when the picture given by |key| has been loaded from disk and | 200 // Called when the picture given by |key| has been loaded from disk and |
201 // decoded into |image|. | 201 // decoded into |image|. |
202 void OnAvatarPictureLoaded(const std::string& key, | 202 void OnAvatarPictureLoaded(const std::string& key, |
203 gfx::Image** image) const; | 203 gfx::Image** image) const; |
204 // Called when the picture given by |file_name| has been saved to disk. | 204 // Called when the picture given by |file_name| has been saved to disk. |
205 // Used both for the GAIA profile picture and the high res avatar files. | 205 // Used both for the GAIA profile picture and the high res avatar files. |
206 void OnAvatarPictureSaved(const std::string& file_name, | 206 void OnAvatarPictureSaved(const std::string& file_name, |
207 const base::FilePath& profile_path); | 207 const base::FilePath& profile_path); |
208 | 208 |
| 209 // Migrate any legacy profile names ("First user", "Default Profile") to |
| 210 // new style default names ("Person 1"), and download and high-res avatars |
| 211 // used by the profiles. |
| 212 void MigrateLegacyProfileNamesAndDownloadAvatars(); |
| 213 |
209 PrefService* prefs_; | 214 PrefService* prefs_; |
210 std::vector<std::string> sorted_keys_; | 215 std::vector<std::string> sorted_keys_; |
211 base::FilePath user_data_dir_; | 216 base::FilePath user_data_dir_; |
212 | 217 |
213 ObserverList<ProfileInfoCacheObserver> observer_list_; | 218 ObserverList<ProfileInfoCacheObserver> observer_list_; |
214 | 219 |
215 // A cache of gaia/high res avatar profile pictures. This cache is updated | 220 // A cache of gaia/high res avatar profile pictures. This cache is updated |
216 // lazily so it needs to be mutable. | 221 // lazily so it needs to be mutable. |
217 mutable std::map<std::string, gfx::Image*> cached_avatar_images_; | 222 mutable std::map<std::string, gfx::Image*> cached_avatar_images_; |
218 // Marks a profile picture as loading from disk. This prevents a picture from | 223 // Marks a profile picture as loading from disk. This prevents a picture from |
219 // loading multiple times. | 224 // loading multiple times. |
220 mutable std::map<std::string, bool> cached_avatar_images_loading_; | 225 mutable std::map<std::string, bool> cached_avatar_images_loading_; |
221 | 226 |
222 // Map of profile pictures currently being downloaded from the remote | 227 // Map of profile pictures currently being downloaded from the remote |
223 // location and the ProfileAvatarDownloader instances downloading them. | 228 // location and the ProfileAvatarDownloader instances downloading them. |
224 // This prevents a picture from being downloaded multiple times. The | 229 // This prevents a picture from being downloaded multiple times. The |
225 // ProfileAvatarDownloader instances are deleted when the download completes | 230 // ProfileAvatarDownloader instances are deleted when the download completes |
226 // or when the ProfileInfoCache is destroyed. | 231 // or when the ProfileInfoCache is destroyed. |
227 mutable std::map<std::string, ProfileAvatarDownloader*> | 232 mutable std::map<std::string, ProfileAvatarDownloader*> |
228 avatar_images_downloads_in_progress_; | 233 avatar_images_downloads_in_progress_; |
229 | 234 |
230 DISALLOW_COPY_AND_ASSIGN(ProfileInfoCache); | 235 DISALLOW_COPY_AND_ASSIGN(ProfileInfoCache); |
231 }; | 236 }; |
232 | 237 |
233 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_ | 238 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_ |
OLD | NEW |