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

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

Issue 392313002: [Profiles] With new-profile-management all new profiles should have default avatars. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_manager.cc
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc
index 686e3025bf084cab2548364a9e2071f5b20296e1..fd470bd8845ecbecd4ebb9a3fe1dfd3f7993f9f5 100644
--- a/chrome/browser/profiles/profile_manager.cc
+++ b/chrome/browser/profiles/profile_manager.cc
@@ -675,10 +675,21 @@ void ProfileManager::ScheduleProfileForDeletion(
// correct last used profile is set for any notification observers.
local_state->SetString(prefs::kProfileLastUsed,
new_path.BaseName().MaybeAsASCII());
+
+ // If we are using --new-profile-management, then assign the default
+ // placeholder avatar and name. Otherwise, use random ones.
+ bool is_new_profile_management = switches::IsNewProfileManagement();
+ int avatar_index = profiles::GetPlaceholderAvatarIndex();
+ base::string16 new_avatar_url = is_new_profile_management ?
+ base::UTF8ToUTF16(profiles::GetDefaultAvatarIconUrl(avatar_index)) :
+ base::string16();
+ base::string16 new_profile_name = is_new_profile_management ?
+ cache.ChooseNameForNewProfile(avatar_index) : base::string16();
erg 2014/07/16 19:39:07 So, won't this always build new profiles with the
noms (inactive) 2014/07/16 19:41:22 Yup. But this is only runs if you're deleting the
+
CreateProfileAsync(new_path,
callback,
- base::string16(),
- base::string16(),
+ new_profile_name,
+ new_avatar_url,
std::string());
} else {
// On the Mac, the browser process is not killed when all browser windows
@@ -763,9 +774,12 @@ void ProfileManager::InitProfileUserPrefs(Profile* profile) {
cache.GetSupervisedUserIdOfProfileAtIndex(profile_cache_index);
} else if (profile->GetPath() ==
profiles::GetDefaultProfileDir(cache.GetUserDataDir())) {
- avatar_index = 0;
- // The --new-profile-management flag no longer uses the "First User" name.
- profile_name = switches::IsNewProfileManagement() ?
+ // The --new-profile-management flag no longer uses the "First User"
+ // name, and should assign the default avatar icon to all new profiles.
+ bool is_new_profile_management = switches::IsNewProfileManagement();
+ avatar_index = is_new_profile_management ?
+ profiles::GetPlaceholderAvatarIndex() : 0;
+ profile_name = is_new_profile_management ?
base::UTF16ToUTF8(cache.ChooseNameForNewProfile(avatar_index)) :
l10n_util::GetStringUTF8(IDS_DEFAULT_PROFILE_NAME);
} else {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698