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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 const base::FilePath& profile_path); | 152 const base::FilePath& profile_path); |
153 | 153 |
154 void AddObserver(ProfileInfoCacheObserver* obs); | 154 void AddObserver(ProfileInfoCacheObserver* obs); |
155 void RemoveObserver(ProfileInfoCacheObserver* obs); | 155 void RemoveObserver(ProfileInfoCacheObserver* obs); |
156 | 156 |
157 private: | 157 private: |
158 FRIEND_TEST_ALL_PREFIXES(ProfileInfoCacheTest, DownloadHighResAvatarTest); | 158 FRIEND_TEST_ALL_PREFIXES(ProfileInfoCacheTest, DownloadHighResAvatarTest); |
159 | 159 |
160 const base::DictionaryValue* GetInfoForProfileAtIndex(size_t index) const; | 160 const base::DictionaryValue* GetInfoForProfileAtIndex(size_t index) const; |
161 // Saves the profile info to a cache and takes ownership of |info|. | 161 // Saves the profile info to a cache and takes ownership of |info|. |
162 // Currently the only information that is cached is the profile's name, | |
163 // user name, and avatar icon. | |
164 void SetInfoQuietlyForProfileAtIndex(size_t index, | |
165 base::DictionaryValue* info); | |
166 void SetInfoForProfileAtIndex(size_t index, base::DictionaryValue* info); | 162 void SetInfoForProfileAtIndex(size_t index, base::DictionaryValue* info); |
167 std::string CacheKeyFromProfilePath(const base::FilePath& profile_path) const; | 163 std::string CacheKeyFromProfilePath(const base::FilePath& profile_path) const; |
168 std::vector<std::string>::iterator FindPositionForProfile( | 164 std::vector<std::string>::iterator FindPositionForProfile( |
169 const std::string& search_key, | 165 const std::string& search_key, |
170 const base::string16& search_name); | 166 const base::string16& search_name); |
171 | 167 |
172 // Returns true if the given icon index is not in use by another profie. | 168 // Returns true if the given icon index is not in use by another profie. |
173 bool IconIndexIsUnique(size_t icon_index) const; | 169 bool IconIndexIsUnique(size_t icon_index) const; |
174 | 170 |
175 // Tries to find an icon index that satisfies all the given conditions. | 171 // Tries to find an icon index that satisfies all the given conditions. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 // This prevents a picture from being downloaded multiple times. The | 227 // This prevents a picture from being downloaded multiple times. The |
232 // ProfileAvatarDownloader instances are deleted when the download completes | 228 // ProfileAvatarDownloader instances are deleted when the download completes |
233 // or when the ProfileInfoCache is destroyed. | 229 // or when the ProfileInfoCache is destroyed. |
234 std::map<std::string, ProfileAvatarDownloader*> | 230 std::map<std::string, ProfileAvatarDownloader*> |
235 avatar_images_downloads_in_progress_; | 231 avatar_images_downloads_in_progress_; |
236 | 232 |
237 DISALLOW_COPY_AND_ASSIGN(ProfileInfoCache); | 233 DISALLOW_COPY_AND_ASSIGN(ProfileInfoCache); |
238 }; | 234 }; |
239 | 235 |
240 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_ | 236 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_ |
OLD | NEW |