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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 121 |
122 // Returns an avatar icon index that can be assigned to a newly created | 122 // Returns an avatar icon index that can be assigned to a newly created |
123 // profile. Note that the icon may not be unique since there are a limited | 123 // profile. Note that the icon may not be unique since there are a limited |
124 // set of default icons. | 124 // set of default icons. |
125 size_t ChooseAvatarIconIndexForNewProfile() const; | 125 size_t ChooseAvatarIconIndexForNewProfile() const; |
126 | 126 |
127 const base::FilePath& GetUserDataDir() const; | 127 const base::FilePath& GetUserDataDir() const; |
128 | 128 |
129 // Gets the number of default avatar icons that exist. | 129 // Gets the number of default avatar icons that exist. |
130 static size_t GetDefaultAvatarIconCount(); | 130 static size_t GetDefaultAvatarIconCount(); |
| 131 // Gets the index for the (grey silhouette) avatar used as a placeholder. |
| 132 static int GetPlaceholderAvatarIndex(); |
131 // Gets the resource ID of the default avatar icon at |index|. | 133 // Gets the resource ID of the default avatar icon at |index|. |
132 static int GetDefaultAvatarIconResourceIDAtIndex(size_t index); | 134 static int GetDefaultAvatarIconResourceIDAtIndex(size_t index); |
| 135 // Gets the resource ID of the placeholder avatar icon. |
| 136 static int GetPlaceholderAvatarIconResourceID(); |
133 // Returns a URL for the default avatar icon with specified index. | 137 // Returns a URL for the default avatar icon with specified index. |
134 static std::string GetDefaultAvatarIconUrl(size_t index); | 138 static std::string GetDefaultAvatarIconUrl(size_t index); |
135 // Checks if |index| is a valid avatar icon index | 139 // Checks if |index| is a valid avatar icon index |
136 static bool IsDefaultAvatarIconIndex(size_t index); | 140 static bool IsDefaultAvatarIconIndex(size_t index); |
137 // Checks if the given URL points to one of the default avatar icons. If it | 141 // Checks if the given URL points to one of the default avatar icons. If it |
138 // is, returns true and its index through |icon_index|. If not, returns false. | 142 // is, returns true and its index through |icon_index|. If not, returns false. |
139 static bool IsDefaultAvatarIconUrl(const std::string& icon_url, | 143 static bool IsDefaultAvatarIconUrl(const std::string& icon_url, |
140 size_t *icon_index); | 144 size_t *icon_index); |
141 | 145 |
142 // Gets all names of profiles associated with this instance of Chrome. | 146 // Gets all names of profiles associated with this instance of Chrome. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 // lazily so it needs to be mutable. | 202 // lazily so it needs to be mutable. |
199 mutable std::map<std::string, gfx::Image*> cached_avatar_images_; | 203 mutable std::map<std::string, gfx::Image*> cached_avatar_images_; |
200 // Marks a profile picture as loading. This prevents a picture from | 204 // Marks a profile picture as loading. This prevents a picture from |
201 // loading multiple times. | 205 // loading multiple times. |
202 mutable std::map<std::string, bool> cached_avatar_images_loading_; | 206 mutable std::map<std::string, bool> cached_avatar_images_loading_; |
203 | 207 |
204 DISALLOW_COPY_AND_ASSIGN(ProfileInfoCache); | 208 DISALLOW_COPY_AND_ASSIGN(ProfileInfoCache); |
205 }; | 209 }; |
206 | 210 |
207 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_ | 211 #endif // CHROME_BROWSER_PROFILES_PROFILE_INFO_CACHE_H_ |
OLD | NEW |