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

Unified Diff: chrome/browser/profiles/profile_info_cache.cc

Issue 7275026: Revert 90820 - Multi-Profiles: New Profile Setup UI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 6 months 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_info_cache.cc
===================================================================
--- chrome/browser/profiles/profile_info_cache.cc (revision 90826)
+++ chrome/browser/profiles/profile_info_cache.cc (working copy)
@@ -51,6 +51,12 @@
return false;
}
+// Returns a URL for the default avatar icon with specified index.
+std::string GetDefaultAvatarIconUrl(int icon_index) {
+ DCHECK_LT(icon_index, kDefaultAvatarIconsCount);
+ return StringPrintf("%s%d", kDefaultUrlPrefix, icon_index);
+}
+
} // namespace
ProfileInfoCache::ProfileInfoCache(PrefService* prefs,
@@ -102,18 +108,6 @@
return sorted_keys_.size();
}
-size_t ProfileInfoCache::GetIndexOfProfileWithPath(
- const FilePath& profile_path) const {
- if (profile_path.DirName() != user_data_dir_)
- return std::string::npos;
- std::string search_key = profile_path.BaseName().MaybeAsASCII();
- for (size_t i = 0; i < sorted_keys_.size(); ++i) {
- if (sorted_keys_[i] == search_key)
- return i;
- }
- return std::string::npos;
-}
-
string16 ProfileInfoCache::GetNameOfProfileAtIndex(size_t index) const {
string16 name;
GetInfoForProfileAtIndex(index)->GetString(kNameKey, &name);
@@ -132,21 +126,17 @@
const gfx::Image& ProfileInfoCache::GetAvatarIconOfProfileAtIndex(
size_t index) const {
- int resource_id = GetDefaultAvatarIconResourceIDAtIndex(
- GetAvatarIconIndexOfProfileAtIndex(index));
- return ResourceBundle::GetSharedInstance().GetImageNamed(resource_id);
-}
-
-size_t ProfileInfoCache::GetAvatarIconIndexOfProfileAtIndex(size_t index)
- const {
std::string icon_url;
GetInfoForProfileAtIndex(index)->GetString(kAvatarIconKey, &icon_url);
size_t icon_index = 0;
- if (IsDefaultAvatarIconUrl(icon_url, &icon_index))
- return icon_index;
+ if (IsDefaultAvatarIconUrl(icon_url, &icon_index)) {
+ int resource_id = GetDefaultAvatarIconResourceIDAtIndex(icon_index);
+ return ResourceBundle::GetSharedInstance().GetImageNamed(resource_id);
+ }
DLOG(WARNING) << "Unknown avatar icon: " << icon_url;
- return GetDefaultAvatarIconResourceIDAtIndex(0);
+ return ResourceBundle::GetSharedInstance().GetImageNamed(
+ GetDefaultAvatarIconResourceIDAtIndex(0));
}
void ProfileInfoCache::SetNameOfProfileAtIndex(size_t index,
@@ -174,12 +164,6 @@
return kDefaultAvatarIconResources[index];
}
-std::string ProfileInfoCache::GetDefaultAvatarIconUrl(size_t index) {
- int icon_index = index;
- DCHECK_LT(icon_index, kDefaultAvatarIconsCount);
- return StringPrintf("%s%d", kDefaultUrlPrefix, icon_index);
-}
-
const DictionaryValue* ProfileInfoCache::GetInfoForProfileAtIndex(
size_t index) const {
DCHECK_LT(index, GetNumberOfProfiles());
« 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