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

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

Issue 678553002: Badge icons in windows task bar with avatar icon. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove space Created 6 years, 1 month 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
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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // of profiles is still sorted. 178 // of profiles is still sorted.
179 void UpdateSortForProfileIndex(size_t index); 179 void UpdateSortForProfileIndex(size_t index);
180 180
181 // Loads or uses an already loaded high resolution image of the 181 // Loads or uses an already loaded high resolution image of the
182 // generic profile avatar. 182 // generic profile avatar.
183 const gfx::Image* GetHighResAvatarOfProfileAtIndex(size_t index) const; 183 const gfx::Image* GetHighResAvatarOfProfileAtIndex(size_t index) const;
184 184
185 // Returns the decoded image at |image_path|. Used both by the GAIA profile 185 // Returns the decoded image at |image_path|. Used both by the GAIA profile
186 // image and the high res avatars. 186 // image and the high res avatars.
187 const gfx::Image* LoadAvatarPictureFromPath( 187 const gfx::Image* LoadAvatarPictureFromPath(
188 const base::FilePath& profile_path,
188 const std::string& key, 189 const std::string& key,
189 const base::FilePath& image_path) const; 190 const base::FilePath& image_path) const;
190 191
191 // Called when the picture given by |key| has been loaded from disk and 192 // Called when the picture given by |key| has been loaded from disk and
192 // decoded into |image|. 193 // decoded into |image|.
193 void OnAvatarPictureLoaded(const std::string& key, 194 void OnAvatarPictureLoaded(const base::FilePath& profile_path,
195 const std::string& key,
194 gfx::Image** image) const; 196 gfx::Image** image) const;
195 // Called when the picture given by |file_name| has been saved to disk. 197 // Called when the picture given by |file_name| has been saved to disk.
196 // Used both for the GAIA profile picture and the high res avatar files. 198 // Used both for the GAIA profile picture and the high res avatar files.
197 void OnAvatarPictureSaved(const std::string& file_name, 199 void OnAvatarPictureSaved(const std::string& file_name,
198 const base::FilePath& profile_path); 200 const base::FilePath& profile_path);
199 201
200 // Migrate any legacy profile names ("First user", "Default Profile") to 202 // Migrate any legacy profile names ("First user", "Default Profile") to
201 // new style default names ("Person 1"), and download and high-res avatars 203 // new style default names ("Person 1"), and download and high-res avatars
202 // used by the profiles. 204 // used by the profiles.
203 void MigrateLegacyProfileNamesAndDownloadAvatars(); 205 void MigrateLegacyProfileNamesAndDownloadAvatars();
204 206
205 PrefService* prefs_; 207 PrefService* prefs_;
206 std::vector<std::string> sorted_keys_; 208 std::vector<std::string> sorted_keys_;
207 base::FilePath user_data_dir_; 209 base::FilePath user_data_dir_;
208 210
209 ObserverList<ProfileInfoCacheObserver> observer_list_; 211 mutable ObserverList<ProfileInfoCacheObserver> observer_list_;
210 212
211 // A cache of gaia/high res avatar profile pictures. This cache is updated 213 // A cache of gaia/high res avatar profile pictures. This cache is updated
212 // lazily so it needs to be mutable. 214 // lazily so it needs to be mutable.
213 mutable std::map<std::string, gfx::Image*> cached_avatar_images_; 215 mutable std::map<std::string, gfx::Image*> cached_avatar_images_;
214 // Marks a profile picture as loading from disk. This prevents a picture from 216 // Marks a profile picture as loading from disk. This prevents a picture from
215 // loading multiple times. 217 // loading multiple times.
216 mutable std::map<std::string, bool> cached_avatar_images_loading_; 218 mutable std::map<std::string, bool> cached_avatar_images_loading_;
217 219
218 // Map of profile pictures currently being downloaded from the remote 220 // Map of profile pictures currently being downloaded from the remote
219 // location and the ProfileAvatarDownloader instances downloading them. 221 // location and the ProfileAvatarDownloader instances downloading them.
220 // This prevents a picture from being downloaded multiple times. The 222 // This prevents a picture from being downloaded multiple times. The
221 // ProfileAvatarDownloader instances are deleted when the download completes 223 // ProfileAvatarDownloader instances are deleted when the download completes
222 // or when the ProfileInfoCache is destroyed. 224 // or when the ProfileInfoCache is destroyed.
223 mutable std::map<std::string, ProfileAvatarDownloader*> 225 mutable std::map<std::string, ProfileAvatarDownloader*>
224 avatar_images_downloads_in_progress_; 226 avatar_images_downloads_in_progress_;
225 227
226 DISALLOW_COPY_AND_ASSIGN(ProfileInfoCache); 228 DISALLOW_COPY_AND_ASSIGN(ProfileInfoCache);
227 }; 229 };
228 230
229 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_ 231 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698