| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/profiles/profile_info_cache.h" | 5 #include "chrome/browser/profiles/profile_info_cache.h" |
| 6 | 6 |
| 7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 const char kNameKey[] = "name"; | 27 const char kNameKey[] = "name"; |
| 28 const char kAvatarIconKey[] = "avatar_icon"; | 28 const char kAvatarIconKey[] = "avatar_icon"; |
| 29 const char kDefaultUrlPrefix[] = "chrome://theme/IDR_PROFILE_AVATAR_"; | 29 const char kDefaultUrlPrefix[] = "chrome://theme/IDR_PROFILE_AVATAR_"; |
| 30 | 30 |
| 31 const int kDefaultAvatarIconResources[] = { | 31 const int kDefaultAvatarIconResources[] = { |
| 32 IDR_PROFILE_AVATAR_0, | 32 IDR_PROFILE_AVATAR_0, |
| 33 IDR_PROFILE_AVATAR_1, | 33 IDR_PROFILE_AVATAR_1, |
| 34 IDR_PROFILE_AVATAR_2, | 34 IDR_PROFILE_AVATAR_2, |
| 35 IDR_PROFILE_AVATAR_3, | 35 IDR_PROFILE_AVATAR_3, |
| 36 IDR_PROFILE_AVATAR_4, |
| 37 IDR_PROFILE_AVATAR_5, |
| 38 IDR_PROFILE_AVATAR_6, |
| 39 IDR_PROFILE_AVATAR_7, |
| 40 IDR_PROFILE_AVATAR_8, |
| 41 IDR_PROFILE_AVATAR_9, |
| 36 }; | 42 }; |
| 37 | 43 |
| 38 const size_t kDefaultAvatarIconsCount = arraysize(kDefaultAvatarIconResources); | 44 const size_t kDefaultAvatarIconsCount = arraysize(kDefaultAvatarIconResources); |
| 39 | 45 |
| 40 // Checks if the given URL points to one of the default avatar icons. if it is, | 46 // Checks if the given URL points to one of the default avatar icons. if it is, |
| 41 // returns true and its index through |icon_index|. If not, returns false. | 47 // returns true and its index through |icon_index|. If not, returns false. |
| 42 bool IsDefaultAvatarIconUrl(const std::string& url, size_t* icon_index) { | 48 bool IsDefaultAvatarIconUrl(const std::string& url, size_t* icon_index) { |
| 43 DCHECK(icon_index); | 49 DCHECK(icon_index); |
| 44 if (url.find(kDefaultUrlPrefix) != 0) | 50 if (url.find(kDefaultUrlPrefix) != 0) |
| 45 return false; | 51 return false; |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 if (key_compare < 0) | 275 if (key_compare < 0) |
| 270 return sorted_keys_.begin() + i; | 276 return sorted_keys_.begin() + i; |
| 271 } | 277 } |
| 272 } | 278 } |
| 273 return sorted_keys_.end(); | 279 return sorted_keys_.end(); |
| 274 } | 280 } |
| 275 | 281 |
| 276 void ProfileInfoCache::RegisterPrefs(PrefService* prefs) { | 282 void ProfileInfoCache::RegisterPrefs(PrefService* prefs) { |
| 277 prefs->RegisterDictionaryPref(prefs::kProfileInfoCache); | 283 prefs->RegisterDictionaryPref(prefs::kProfileInfoCache); |
| 278 } | 284 } |
| OLD | NEW |