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

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

Issue 1038423004: Reland of: Change default code flag to NewAvatarMenu. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove unneeded code from ProfileInfoCacheTest Created 5 years, 8 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 size_t GetNumberOfProfiles() const override; 55 size_t GetNumberOfProfiles() const override;
56 // Don't cache this value and reuse, because resorting the menu could cause 56 // Don't cache this value and reuse, because resorting the menu could cause
57 // the item being referred to to change out from under you. 57 // the item being referred to to change out from under you.
58 size_t GetIndexOfProfileWithPath( 58 size_t GetIndexOfProfileWithPath(
59 const base::FilePath& profile_path) const override; 59 const base::FilePath& profile_path) const override;
60 base::string16 GetNameOfProfileAtIndex(size_t index) const override; 60 base::string16 GetNameOfProfileAtIndex(size_t index) const override;
61 base::string16 GetShortcutNameOfProfileAtIndex(size_t index) const override; 61 base::string16 GetShortcutNameOfProfileAtIndex(size_t index) const override;
62 base::FilePath GetPathOfProfileAtIndex(size_t index) const override; 62 base::FilePath GetPathOfProfileAtIndex(size_t index) const override;
63 base::Time GetProfileActiveTimeAtIndex(size_t index) const override; 63 base::Time GetProfileActiveTimeAtIndex(size_t index) const override;
64 base::string16 GetUserNameOfProfileAtIndex(size_t index) const override; 64 base::string16 GetUserNameOfProfileAtIndex(size_t index) const override;
65 const gfx::Image& GetAvatarIconOfProfileAtIndex(size_t index) const override; 65 const gfx::Image& GetAvatarIconOfProfileAtIndex(size_t index) override;
66 std::string GetLocalAuthCredentialsOfProfileAtIndex( 66 std::string GetLocalAuthCredentialsOfProfileAtIndex(
67 size_t index) const override; 67 size_t index) const override;
68 // Note that a return value of false could mean an error in collection or 68 // Note that a return value of false could mean an error in collection or
69 // that there are currently no background apps running. However, the action 69 // that there are currently no background apps running. However, the action
70 // which results is the same in both cases (thus far). 70 // which results is the same in both cases (thus far).
71 bool GetBackgroundStatusOfProfileAtIndex(size_t index) const override; 71 bool GetBackgroundStatusOfProfileAtIndex(size_t index) const override;
72 base::string16 GetGAIANameOfProfileAtIndex(size_t index) const override; 72 base::string16 GetGAIANameOfProfileAtIndex(size_t index) const override;
73 base::string16 GetGAIAGivenNameOfProfileAtIndex(size_t index) const override; 73 base::string16 GetGAIAGivenNameOfProfileAtIndex(size_t index) const override;
74 // Returns the GAIA picture for the given profile. This may return NULL 74 // Returns the GAIA picture for the given profile. This may return NULL
75 // if the profile does not have a GAIA picture or if the picture must be 75 // if the profile does not have a GAIA picture or if the picture must be
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 // GAIA profile pictures and the ProfileAvatarDownloader that is used to 141 // GAIA profile pictures and the ProfileAvatarDownloader that is used to
142 // download the high res avatars. 142 // download the high res avatars.
143 void SaveAvatarImageAtPath(const gfx::Image* image, 143 void SaveAvatarImageAtPath(const gfx::Image* image,
144 const std::string& key, 144 const std::string& key,
145 const base::FilePath& image_path, 145 const base::FilePath& image_path,
146 const base::FilePath& profile_path); 146 const base::FilePath& profile_path);
147 147
148 void AddObserver(ProfileInfoCacheObserver* obs); 148 void AddObserver(ProfileInfoCacheObserver* obs);
149 void RemoveObserver(ProfileInfoCacheObserver* obs); 149 void RemoveObserver(ProfileInfoCacheObserver* obs);
150 150
151 void set_disable_avatar_download_for_testing(
152 bool disable_avatar_download_for_testing) {
153 disable_avatar_download_for_testing_ = disable_avatar_download_for_testing;
154 }
155
151 private: 156 private:
152 FRIEND_TEST_ALL_PREFIXES(ProfileInfoCacheTest, DownloadHighResAvatarTest); 157 FRIEND_TEST_ALL_PREFIXES(ProfileInfoCacheTest, DownloadHighResAvatarTest);
153 158
154 const base::DictionaryValue* GetInfoForProfileAtIndex(size_t index) const; 159 const base::DictionaryValue* GetInfoForProfileAtIndex(size_t index) const;
155 // Saves the profile info to a cache and takes ownership of |info|. 160 // Saves the profile info to a cache and takes ownership of |info|.
156 void SetInfoForProfileAtIndex(size_t index, base::DictionaryValue* info); 161 void SetInfoForProfileAtIndex(size_t index, base::DictionaryValue* info);
157 std::string CacheKeyFromProfilePath(const base::FilePath& profile_path) const; 162 std::string CacheKeyFromProfilePath(const base::FilePath& profile_path) const;
158 std::vector<std::string>::iterator FindPositionForProfile( 163 std::vector<std::string>::iterator FindPositionForProfile(
159 const std::string& search_key, 164 const std::string& search_key,
160 const base::string16& search_name); 165 const base::string16& search_name);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 mutable std::map<std::string, bool> cached_avatar_images_loading_; 222 mutable std::map<std::string, bool> cached_avatar_images_loading_;
218 223
219 // Map of profile pictures currently being downloaded from the remote 224 // Map of profile pictures currently being downloaded from the remote
220 // location and the ProfileAvatarDownloader instances downloading them. 225 // location and the ProfileAvatarDownloader instances downloading them.
221 // This prevents a picture from being downloaded multiple times. The 226 // This prevents a picture from being downloaded multiple times. The
222 // ProfileAvatarDownloader instances are deleted when the download completes 227 // ProfileAvatarDownloader instances are deleted when the download completes
223 // or when the ProfileInfoCache is destroyed. 228 // or when the ProfileInfoCache is destroyed.
224 std::map<std::string, ProfileAvatarDownloader*> 229 std::map<std::string, ProfileAvatarDownloader*>
225 avatar_images_downloads_in_progress_; 230 avatar_images_downloads_in_progress_;
226 231
232 // Determines of the ProfileAvatarDownloader should be created and executed
233 // or not. Only set to true for tests.
234 bool disable_avatar_download_for_testing_;
235
227 DISALLOW_COPY_AND_ASSIGN(ProfileInfoCache); 236 DISALLOW_COPY_AND_ASSIGN(ProfileInfoCache);
228 }; 237 };
229 238
230 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_ 239 #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