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

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

Issue 861053004: [Profiles] Send out less profile avatar related notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mike nit Created 5 years, 10 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 | « 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 129
130 // Gets all names of profiles associated with this instance of Chrome. 130 // Gets all names of profiles associated with this instance of Chrome.
131 // Because this method will be called during uninstall, before the creation 131 // Because this method will be called during uninstall, before the creation
132 // of the ProfileManager, it reads directly from the local state preferences, 132 // of the ProfileManager, it reads directly from the local state preferences,
133 // rather than going through the ProfileInfoCache object. 133 // rather than going through the ProfileInfoCache object.
134 static std::vector<base::string16> GetProfileNames(); 134 static std::vector<base::string16> GetProfileNames();
135 135
136 // Register cache related preferences in Local State. 136 // Register cache related preferences in Local State.
137 static void RegisterPrefs(PrefRegistrySimple* registry); 137 static void RegisterPrefs(PrefRegistrySimple* registry);
138 138
139 // Starts downloading the high res avatar at index |icon_index| for profile 139 // Checks whether the high res avatar at index |icon_index| exists, and
140 // with path |profile_path|. 140 // if it does not, calls |DownloadHighResAvatar|.
141 void DownloadHighResAvatar(size_t icon_index, 141 void DownloadHighResAvatarIfNeeded(size_t icon_index,
142 const base::FilePath& profile_path); 142 const base::FilePath& profile_path);
143 143
144 // Saves the avatar |image| at |image_path|. This is used both for the 144 // Saves the avatar |image| at |image_path|. This is used both for the
145 // GAIA profile pictures and the ProfileAvatarDownloader that is used to 145 // GAIA profile pictures and the ProfileAvatarDownloader that is used to
146 // download the high res avatars. 146 // download the high res avatars.
147 void SaveAvatarImageAtPath(const gfx::Image* image, 147 void SaveAvatarImageAtPath(const gfx::Image* image,
148 const std::string& key, 148 const std::string& key,
149 const base::FilePath& image_path, 149 const base::FilePath& image_path,
150 const base::FilePath& profile_path); 150 const base::FilePath& profile_path);
151 151
152 void AddObserver(ProfileInfoCacheObserver* obs); 152 void AddObserver(ProfileInfoCacheObserver* obs);
(...skipping 24 matching lines...) Expand all
177 size_t* out_icon_index) const; 177 size_t* out_icon_index) const;
178 178
179 // Updates the position of the profile at the given index so that the list 179 // Updates the position of the profile at the given index so that the list
180 // of profiles is still sorted. 180 // of profiles is still sorted.
181 void UpdateSortForProfileIndex(size_t index); 181 void UpdateSortForProfileIndex(size_t index);
182 182
183 // Loads or uses an already loaded high resolution image of the 183 // Loads or uses an already loaded high resolution image of the
184 // generic profile avatar. 184 // generic profile avatar.
185 const gfx::Image* GetHighResAvatarOfProfileAtIndex(size_t index) const; 185 const gfx::Image* GetHighResAvatarOfProfileAtIndex(size_t index) const;
186 186
187 // Starts downloading the high res avatar at index |icon_index| for profile
188 // with path |profile_path|.
189 void DownloadHighResAvatar(size_t icon_index,
190 const base::FilePath& profile_path);
191
187 // Returns the decoded image at |image_path|. Used both by the GAIA profile 192 // Returns the decoded image at |image_path|. Used both by the GAIA profile
188 // image and the high res avatars. 193 // image and the high res avatars.
189 const gfx::Image* LoadAvatarPictureFromPath( 194 const gfx::Image* LoadAvatarPictureFromPath(
190 const base::FilePath& profile_path, 195 const base::FilePath& profile_path,
191 const std::string& key, 196 const std::string& key,
192 const base::FilePath& image_path) const; 197 const base::FilePath& image_path) const;
193 198
194 // Called when the picture given by |key| has been loaded from disk and 199 // Called when the picture given by |key| has been loaded from disk and
195 // decoded into |image|. 200 // decoded into |image|.
196 void OnAvatarPictureLoaded(const base::FilePath& profile_path, 201 void OnAvatarPictureLoaded(const base::FilePath& profile_path,
(...skipping 27 matching lines...) Expand all
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_
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