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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/i18n/case_conversion.h" | 10 #include "base/i18n/case_conversion.h" |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
611 return user_data_dir_; | 611 return user_data_dir_; |
612 } | 612 } |
613 | 613 |
614 // static | 614 // static |
615 size_t ProfileInfoCache::GetDefaultAvatarIconCount() { | 615 size_t ProfileInfoCache::GetDefaultAvatarIconCount() { |
616 return kDefaultAvatarIconsCount; | 616 return kDefaultAvatarIconsCount; |
617 } | 617 } |
618 | 618 |
619 // static | 619 // static |
620 int ProfileInfoCache::GetDefaultAvatarIconResourceIDAtIndex(size_t index) { | 620 int ProfileInfoCache::GetDefaultAvatarIconResourceIDAtIndex(size_t index) { |
621 DCHECK_LT(index, GetDefaultAvatarIconCount()); | 621 DCHECK(IsDefaultAvatarIconIndex(index)); |
622 return kDefaultAvatarIconResources[index]; | 622 return kDefaultAvatarIconResources[index]; |
623 } | 623 } |
624 | 624 |
625 // static | 625 // static |
626 std::string ProfileInfoCache::GetDefaultAvatarIconUrl(size_t index) { | 626 std::string ProfileInfoCache::GetDefaultAvatarIconUrl(size_t index) { |
627 DCHECK_LT(index, kDefaultAvatarIconsCount); | 627 DCHECK(IsDefaultAvatarIconIndex(index)); |
628 return StringPrintf("%s%" PRIuS, kDefaultUrlPrefix, index); | 628 return StringPrintf("%s%" PRIuS, kDefaultUrlPrefix, index); |
629 } | 629 } |
630 | 630 |
631 // static | 631 // static |
632 bool ProfileInfoCache::IsDefaultAvatarIconIndex(size_t index) { | |
633 return index<kDefaultAvatarIconsCount; | |
sail
2011/12/02 19:07:10
space before and after "<"
jwd
2011/12/02 21:10:16
Done.
| |
634 } | |
635 | |
636 // static | |
632 bool ProfileInfoCache::IsDefaultAvatarIconUrl(const std::string& url, | 637 bool ProfileInfoCache::IsDefaultAvatarIconUrl(const std::string& url, |
633 size_t* icon_index) { | 638 size_t* icon_index) { |
634 DCHECK(icon_index); | 639 DCHECK(icon_index); |
635 if (url.find(kDefaultUrlPrefix) != 0) | 640 if (url.find(kDefaultUrlPrefix) != 0) |
636 return false; | 641 return false; |
637 | 642 |
638 int int_value = -1; | 643 int int_value = -1; |
639 if (base::StringToInt(url.begin() + strlen(kDefaultUrlPrefix), | 644 if (base::StringToInt(url.begin() + strlen(kDefaultUrlPrefix), |
640 url.end(), | 645 url.end(), |
641 &int_value)) { | 646 &int_value)) { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
728 info->GetString(kNameKey, &name); | 733 info->GetString(kNameKey, &name); |
729 names.push_back(name); | 734 names.push_back(name); |
730 } | 735 } |
731 return names; | 736 return names; |
732 } | 737 } |
733 | 738 |
734 // static | 739 // static |
735 void ProfileInfoCache::RegisterPrefs(PrefService* prefs) { | 740 void ProfileInfoCache::RegisterPrefs(PrefService* prefs) { |
736 prefs->RegisterDictionaryPref(prefs::kProfileInfoCache); | 741 prefs->RegisterDictionaryPref(prefs::kProfileInfoCache); |
737 } | 742 } |
OLD | NEW |