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

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

Issue 8771024: Making profile avatars and names sync. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Fixing nits, lint errors and adding comments. 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 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
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;
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
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 }
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