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