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

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

Issue 1631373003: Refactor ProfileInfoCache in c/b/ui/app_list (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased, moved sorting code to GetAllProfilesAttributesSortedByName Created 4 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
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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 const base::FilePath& profile_path); 175 const base::FilePath& profile_path);
176 176
177 // Saves the avatar |image| at |image_path|. This is used both for the 177 // Saves the avatar |image| at |image_path|. This is used both for the
178 // GAIA profile pictures and the ProfileAvatarDownloader that is used to 178 // GAIA profile pictures and the ProfileAvatarDownloader that is used to
179 // download the high res avatars. 179 // download the high res avatars.
180 void SaveAvatarImageAtPath(const gfx::Image* image, 180 void SaveAvatarImageAtPath(const gfx::Image* image,
181 const std::string& key, 181 const std::string& key,
182 const base::FilePath& image_path, 182 const base::FilePath& image_path,
183 const base::FilePath& profile_path); 183 const base::FilePath& profile_path);
184 184
185 void AddObserver(ProfileInfoCacheObserver* obs); 185 void AddObserver(ProfileInfoCacheObserver* obs) override;
186 void RemoveObserver(ProfileInfoCacheObserver* obs); 186 void RemoveObserver(ProfileInfoCacheObserver* obs) override;
187 187
188 void set_disable_avatar_download_for_testing( 188 void set_disable_avatar_download_for_testing(
189 bool disable_avatar_download_for_testing) { 189 bool disable_avatar_download_for_testing) {
190 disable_avatar_download_for_testing_ = disable_avatar_download_for_testing; 190 disable_avatar_download_for_testing_ = disable_avatar_download_for_testing;
191 } 191 }
192 192
193 // ProfileAttributesStorage: 193 // ProfileAttributesStorage:
194 void AddProfile(const base::FilePath& profile_path, 194 void AddProfile(const base::FilePath& profile_path,
195 const base::string16& name, 195 const base::string16& name,
196 const std::string& gaia_id, 196 const std::string& gaia_id,
197 const base::string16& user_name, 197 const base::string16& user_name,
198 size_t icon_index, 198 size_t icon_index,
199 const std::string& supervised_user_id) override; 199 const std::string& supervised_user_id) override;
200 void RemoveProfile(const base::FilePath& profile_path) override; 200 void RemoveProfile(const base::FilePath& profile_path) override;
201 // Returns a vector containing one attributes entry per known profile. They 201 // Returns a vector containing one attributes entry per known profile. They
202 // are not sorted in any particular order. 202 // are not sorted in any particular order.
203 std::vector<ProfileAttributesEntry*> GetAllProfilesAttributes() override; 203 std::vector<ProfileAttributesEntry*> GetAllProfilesAttributes() override;
204 std::vector<ProfileAttributesEntry*> GetAllProfilesAttributesSortedByName()
205 override;
204 bool GetProfileAttributesWithPath( 206 bool GetProfileAttributesWithPath(
205 const base::FilePath& path, 207 const base::FilePath& path,
206 ProfileAttributesEntry** entry) override; 208 ProfileAttributesEntry** entry) override;
207 209
208 private: 210 private:
209 FRIEND_TEST_ALL_PREFIXES(ProfileInfoCacheTest, DownloadHighResAvatarTest); 211 FRIEND_TEST_ALL_PREFIXES(ProfileInfoCacheTest, DownloadHighResAvatarTest);
210 FRIEND_TEST_ALL_PREFIXES(ProfileInfoCacheTest, 212 FRIEND_TEST_ALL_PREFIXES(ProfileInfoCacheTest,
211 NothingToDownloadHighResAvatarTest); 213 NothingToDownloadHighResAvatarTest);
212 214
213 const base::DictionaryValue* GetInfoForProfileAtIndex(size_t index) const; 215 const base::DictionaryValue* GetInfoForProfileAtIndex(size_t index) const;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 avatar_images_downloads_in_progress_; 288 avatar_images_downloads_in_progress_;
287 289
288 // Determines of the ProfileAvatarDownloader should be created and executed 290 // Determines of the ProfileAvatarDownloader should be created and executed
289 // or not. Only set to true for tests. 291 // or not. Only set to true for tests.
290 bool disable_avatar_download_for_testing_; 292 bool disable_avatar_download_for_testing_;
291 293
292 DISALLOW_COPY_AND_ASSIGN(ProfileInfoCache); 294 DISALLOW_COPY_AND_ASSIGN(ProfileInfoCache);
293 }; 295 };
294 296
295 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_ 297 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698