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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // ProfileInfoInterface: | 50 // ProfileInfoInterface: |
51 virtual size_t GetNumberOfProfiles() const OVERRIDE; | 51 virtual size_t GetNumberOfProfiles() const OVERRIDE; |
52 // Don't cache this value and reuse, because resorting the menu could cause | 52 // Don't cache this value and reuse, because resorting the menu could cause |
53 // the item being referred to to change out from under you. | 53 // the item being referred to to change out from under you. |
54 virtual size_t GetIndexOfProfileWithPath( | 54 virtual size_t GetIndexOfProfileWithPath( |
55 const base::FilePath& profile_path) const OVERRIDE; | 55 const base::FilePath& profile_path) const OVERRIDE; |
56 virtual base::string16 GetNameOfProfileAtIndex(size_t index) const OVERRIDE; | 56 virtual base::string16 GetNameOfProfileAtIndex(size_t index) const OVERRIDE; |
57 virtual base::string16 GetShortcutNameOfProfileAtIndex(size_t index) | 57 virtual base::string16 GetShortcutNameOfProfileAtIndex(size_t index) |
58 const OVERRIDE; | 58 const OVERRIDE; |
59 virtual base::FilePath GetPathOfProfileAtIndex(size_t index) const OVERRIDE; | 59 virtual base::FilePath GetPathOfProfileAtIndex(size_t index) const OVERRIDE; |
| 60 virtual base::Time GetProfileActiveTimeAtIndex(size_t index) const OVERRIDE; |
60 virtual base::string16 GetUserNameOfProfileAtIndex( | 61 virtual base::string16 GetUserNameOfProfileAtIndex( |
61 size_t index) const OVERRIDE; | 62 size_t index) const OVERRIDE; |
62 virtual const gfx::Image& GetAvatarIconOfProfileAtIndex( | 63 virtual const gfx::Image& GetAvatarIconOfProfileAtIndex( |
63 size_t index) const OVERRIDE; | 64 size_t index) const OVERRIDE; |
64 virtual std::string GetLocalAuthCredentialsOfProfileAtIndex( | 65 virtual std::string GetLocalAuthCredentialsOfProfileAtIndex( |
65 size_t index) const OVERRIDE; | 66 size_t index) const OVERRIDE; |
66 // Note that a return value of false could mean an error in collection or | 67 // Note that a return value of false could mean an error in collection or |
67 // that there are currently no background apps running. However, the action | 68 // that there are currently no background apps running. However, the action |
68 // which results is the same in both cases (thus far). | 69 // which results is the same in both cases (thus far). |
69 virtual bool GetBackgroundStatusOfProfileAtIndex( | 70 virtual bool GetBackgroundStatusOfProfileAtIndex( |
(...skipping 11 matching lines...) Expand all Loading... |
81 virtual bool IsUsingGAIAPictureOfProfileAtIndex( | 82 virtual bool IsUsingGAIAPictureOfProfileAtIndex( |
82 size_t index) const OVERRIDE; | 83 size_t index) const OVERRIDE; |
83 virtual bool ProfileIsManagedAtIndex(size_t index) const OVERRIDE; | 84 virtual bool ProfileIsManagedAtIndex(size_t index) const OVERRIDE; |
84 virtual bool ProfileIsSigninRequiredAtIndex(size_t index) const OVERRIDE; | 85 virtual bool ProfileIsSigninRequiredAtIndex(size_t index) const OVERRIDE; |
85 virtual std::string GetManagedUserIdOfProfileAtIndex(size_t index) const | 86 virtual std::string GetManagedUserIdOfProfileAtIndex(size_t index) const |
86 OVERRIDE; | 87 OVERRIDE; |
87 virtual bool ProfileIsEphemeralAtIndex(size_t index) const OVERRIDE; | 88 virtual bool ProfileIsEphemeralAtIndex(size_t index) const OVERRIDE; |
88 | 89 |
89 size_t GetAvatarIconIndexOfProfileAtIndex(size_t index) const; | 90 size_t GetAvatarIconIndexOfProfileAtIndex(size_t index) const; |
90 | 91 |
| 92 void SetProfileActiveTimeAtIndex(size_t index); |
91 void SetNameOfProfileAtIndex(size_t index, const base::string16& name); | 93 void SetNameOfProfileAtIndex(size_t index, const base::string16& name); |
92 void SetShortcutNameOfProfileAtIndex(size_t index, | 94 void SetShortcutNameOfProfileAtIndex(size_t index, |
93 const base::string16& name); | 95 const base::string16& name); |
94 void SetUserNameOfProfileAtIndex(size_t index, | 96 void SetUserNameOfProfileAtIndex(size_t index, |
95 const base::string16& user_name); | 97 const base::string16& user_name); |
96 void SetAvatarIconOfProfileAtIndex(size_t index, size_t icon_index); | 98 void SetAvatarIconOfProfileAtIndex(size_t index, size_t icon_index); |
97 void SetManagedUserIdOfProfileAtIndex(size_t index, const std::string& id); | 99 void SetManagedUserIdOfProfileAtIndex(size_t index, const std::string& id); |
98 void SetLocalAuthCredentialsOfProfileAtIndex(size_t index, | 100 void SetLocalAuthCredentialsOfProfileAtIndex(size_t index, |
99 const std::string& auth); | 101 const std::string& auth); |
100 void SetBackgroundStatusOfProfileAtIndex(size_t index, | 102 void SetBackgroundStatusOfProfileAtIndex(size_t index, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 static void RegisterPrefs(PrefRegistrySimple* registry); | 153 static void RegisterPrefs(PrefRegistrySimple* registry); |
152 | 154 |
153 void AddObserver(ProfileInfoCacheObserver* obs); | 155 void AddObserver(ProfileInfoCacheObserver* obs); |
154 void RemoveObserver(ProfileInfoCacheObserver* obs); | 156 void RemoveObserver(ProfileInfoCacheObserver* obs); |
155 | 157 |
156 private: | 158 private: |
157 const base::DictionaryValue* GetInfoForProfileAtIndex(size_t index) const; | 159 const base::DictionaryValue* GetInfoForProfileAtIndex(size_t index) const; |
158 // 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|. |
159 // Currently the only information that is cached is the profile's name, | 161 // Currently the only information that is cached is the profile's name, |
160 // user name, and avatar icon. | 162 // user name, and avatar icon. |
| 163 void SetInfoQuietlyForProfileAtIndex(size_t index, |
| 164 base::DictionaryValue* info); |
161 void SetInfoForProfileAtIndex(size_t index, base::DictionaryValue* info); | 165 void SetInfoForProfileAtIndex(size_t index, base::DictionaryValue* info); |
162 std::string CacheKeyFromProfilePath(const base::FilePath& profile_path) const; | 166 std::string CacheKeyFromProfilePath(const base::FilePath& profile_path) const; |
163 std::vector<std::string>::iterator FindPositionForProfile( | 167 std::vector<std::string>::iterator FindPositionForProfile( |
164 const std::string& search_key, | 168 const std::string& search_key, |
165 const base::string16& search_name); | 169 const base::string16& search_name); |
166 | 170 |
167 // Returns true if the given icon index is not in use by another profie. | 171 // Returns true if the given icon index is not in use by another profie. |
168 bool IconIndexIsUnique(size_t icon_index) const; | 172 bool IconIndexIsUnique(size_t icon_index) const; |
169 | 173 |
170 // Tries to find an icon index that satisfies all the given conditions. | 174 // Tries to find an icon index that satisfies all the given conditions. |
(...skipping 20 matching lines...) Expand all Loading... |
191 // to be mutable. | 195 // to be mutable. |
192 mutable std::map<std::string, gfx::Image*> gaia_pictures_; | 196 mutable std::map<std::string, gfx::Image*> gaia_pictures_; |
193 // Marks a gaia profile picture as loading. This prevents a picture from | 197 // Marks a gaia profile picture as loading. This prevents a picture from |
194 // loading multiple times. | 198 // loading multiple times. |
195 mutable std::map<std::string, bool> gaia_pictures_loading_; | 199 mutable std::map<std::string, bool> gaia_pictures_loading_; |
196 | 200 |
197 DISALLOW_COPY_AND_ASSIGN(ProfileInfoCache); | 201 DISALLOW_COPY_AND_ASSIGN(ProfileInfoCache); |
198 }; | 202 }; |
199 | 203 |
200 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_ | 204 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_ |
OLD | NEW |