Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(290)

Side by Side Diff: chrome/browser/profiles/profile_info_cache.cc

Issue 8815005: Lands http://codereview.chromium.org/8801034/ in hopes of getting a (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/profiles/profile_info_cache.h ('k') | chrome/browser/profiles/profile_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 return user_data_dir_; 644 return user_data_dir_;
645 } 645 }
646 646
647 // static 647 // static
648 size_t ProfileInfoCache::GetDefaultAvatarIconCount() { 648 size_t ProfileInfoCache::GetDefaultAvatarIconCount() {
649 return kDefaultAvatarIconsCount; 649 return kDefaultAvatarIconsCount;
650 } 650 }
651 651
652 // static 652 // static
653 int ProfileInfoCache::GetDefaultAvatarIconResourceIDAtIndex(size_t index) { 653 int ProfileInfoCache::GetDefaultAvatarIconResourceIDAtIndex(size_t index) {
654 DCHECK(IsDefaultAvatarIconIndex(index)); 654 DCHECK_LT(index, GetDefaultAvatarIconCount());
655 return kDefaultAvatarIconResources[index]; 655 return kDefaultAvatarIconResources[index];
656 } 656 }
657 657
658 // static 658 // static
659 std::string ProfileInfoCache::GetDefaultAvatarIconUrl(size_t index) { 659 std::string ProfileInfoCache::GetDefaultAvatarIconUrl(size_t index) {
660 DCHECK(IsDefaultAvatarIconIndex(index)); 660 DCHECK_LT(index, kDefaultAvatarIconsCount);
661 return StringPrintf("%s%" PRIuS, kDefaultUrlPrefix, index); 661 return StringPrintf("%s%" PRIuS, kDefaultUrlPrefix, index);
662 } 662 }
663 663
664 // static 664 // static
665 bool ProfileInfoCache::IsDefaultAvatarIconIndex(size_t index) {
666 return index < kDefaultAvatarIconsCount;
667 }
668
669 // static
670 bool ProfileInfoCache::IsDefaultAvatarIconUrl(const std::string& url, 665 bool ProfileInfoCache::IsDefaultAvatarIconUrl(const std::string& url,
671 size_t* icon_index) { 666 size_t* icon_index) {
672 DCHECK(icon_index); 667 DCHECK(icon_index);
673 if (url.find(kDefaultUrlPrefix) != 0) 668 if (url.find(kDefaultUrlPrefix) != 0)
674 return false; 669 return false;
675 670
676 int int_value = -1; 671 int int_value = -1;
677 if (base::StringToInt(url.begin() + strlen(kDefaultUrlPrefix), 672 if (base::StringToInt(url.begin() + strlen(kDefaultUrlPrefix),
678 url.end(), 673 url.end(),
679 &int_value)) { 674 &int_value)) {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 info->GetString(kNameKey, &name); 761 info->GetString(kNameKey, &name);
767 names.push_back(name); 762 names.push_back(name);
768 } 763 }
769 return names; 764 return names;
770 } 765 }
771 766
772 // static 767 // static
773 void ProfileInfoCache::RegisterPrefs(PrefService* prefs) { 768 void ProfileInfoCache::RegisterPrefs(PrefService* prefs) {
774 prefs->RegisterDictionaryPref(prefs::kProfileInfoCache); 769 prefs->RegisterDictionaryPref(prefs::kProfileInfoCache);
775 } 770 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_info_cache.h ('k') | chrome/browser/profiles/profile_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698