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 <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
| 10 #include <memory> |
10 #include <string> | 11 #include <string> |
11 #include <unordered_map> | 12 #include <unordered_map> |
12 #include <vector> | 13 #include <vector> |
13 | 14 |
14 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
15 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
16 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
17 #include "base/macros.h" | 18 #include "base/macros.h" |
18 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
19 #include "base/observer_list.h" | 20 #include "base/observer_list.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 bool GetProfileAttributesWithPath(const base::FilePath& path, | 196 bool GetProfileAttributesWithPath(const base::FilePath& path, |
196 ProfileAttributesEntry** entry) override; | 197 ProfileAttributesEntry** entry) override; |
197 | 198 |
198 private: | 199 private: |
199 FRIEND_TEST_ALL_PREFIXES(ProfileInfoCacheTest, DownloadHighResAvatarTest); | 200 FRIEND_TEST_ALL_PREFIXES(ProfileInfoCacheTest, DownloadHighResAvatarTest); |
200 FRIEND_TEST_ALL_PREFIXES(ProfileInfoCacheTest, | 201 FRIEND_TEST_ALL_PREFIXES(ProfileInfoCacheTest, |
201 NothingToDownloadHighResAvatarTest); | 202 NothingToDownloadHighResAvatarTest); |
202 | 203 |
203 const base::DictionaryValue* GetInfoForProfileAtIndex(size_t index) const; | 204 const base::DictionaryValue* GetInfoForProfileAtIndex(size_t index) const; |
204 // Saves the profile info to a cache and takes ownership of |info|. | 205 // Saves the profile info to a cache and takes ownership of |info|. |
205 void SetInfoForProfileAtIndex(size_t index, base::DictionaryValue* info); | 206 void SetInfoForProfileAtIndex(size_t index, |
| 207 std::unique_ptr<base::DictionaryValue> info); |
206 std::string CacheKeyFromProfilePath(const base::FilePath& profile_path) const; | 208 std::string CacheKeyFromProfilePath(const base::FilePath& profile_path) const; |
207 std::vector<std::string>::iterator FindPositionForProfile( | 209 std::vector<std::string>::iterator FindPositionForProfile( |
208 const std::string& search_key, | 210 const std::string& search_key, |
209 const base::string16& search_name); | 211 const base::string16& search_name); |
210 | 212 |
211 // Updates the position of the profile at the given index so that the list | 213 // Updates the position of the profile at the given index so that the list |
212 // of profiles is still sorted. | 214 // of profiles is still sorted. |
213 void UpdateSortForProfileIndex(size_t index); | 215 void UpdateSortForProfileIndex(size_t index); |
214 | 216 |
215 // Loads or uses an already loaded high resolution image of the | 217 // Loads or uses an already loaded high resolution image of the |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 avatar_images_downloads_in_progress_; | 266 avatar_images_downloads_in_progress_; |
265 | 267 |
266 // Determines of the ProfileAvatarDownloader should be created and executed | 268 // Determines of the ProfileAvatarDownloader should be created and executed |
267 // or not. Only set to true for tests. | 269 // or not. Only set to true for tests. |
268 bool disable_avatar_download_for_testing_; | 270 bool disable_avatar_download_for_testing_; |
269 | 271 |
270 DISALLOW_COPY_AND_ASSIGN(ProfileInfoCache); | 272 DISALLOW_COPY_AND_ASSIGN(ProfileInfoCache); |
271 }; | 273 }; |
272 | 274 |
273 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_ | 275 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_ |
OLD | NEW |