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

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

Issue 171523004: Stop using the old-style profile names when using --new-profile-management (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_manager.h" 5 #include "chrome/browser/profiles/profile_manager.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 if (profile_cache_index != std::string::npos) { 714 if (profile_cache_index != std::string::npos) {
715 avatar_index = 715 avatar_index =
716 cache.GetAvatarIconIndexOfProfileAtIndex(profile_cache_index); 716 cache.GetAvatarIconIndexOfProfileAtIndex(profile_cache_index);
717 profile_name = 717 profile_name =
718 base::UTF16ToUTF8(cache.GetNameOfProfileAtIndex(profile_cache_index)); 718 base::UTF16ToUTF8(cache.GetNameOfProfileAtIndex(profile_cache_index));
719 managed_user_id = 719 managed_user_id =
720 cache.GetManagedUserIdOfProfileAtIndex(profile_cache_index); 720 cache.GetManagedUserIdOfProfileAtIndex(profile_cache_index);
721 } else if (profile->GetPath() == 721 } else if (profile->GetPath() ==
722 profiles::GetDefaultProfileDir(cache.GetUserDataDir())) { 722 profiles::GetDefaultProfileDir(cache.GetUserDataDir())) {
723 avatar_index = 0; 723 avatar_index = 0;
724 profile_name = l10n_util::GetStringUTF8(IDS_DEFAULT_PROFILE_NAME); 724 // The --new-profile-management flag no longer uses the "First User" name.
725 profile_name = switches::IsNewProfileManagement() ?
726 base::UTF16ToUTF8(cache.ChooseNameForNewProfile(avatar_index)) :
727 l10n_util::GetStringUTF8(IDS_DEFAULT_PROFILE_NAME);
725 } else { 728 } else {
726 avatar_index = cache.ChooseAvatarIconIndexForNewProfile(); 729 avatar_index = cache.ChooseAvatarIconIndexForNewProfile();
727 profile_name = 730 profile_name =
728 base::UTF16ToUTF8(cache.ChooseNameForNewProfile(avatar_index)); 731 base::UTF16ToUTF8(cache.ChooseNameForNewProfile(avatar_index));
729 } 732 }
730 } 733 }
731 734
732 if (!profile->GetPrefs()->HasPrefPath(prefs::kProfileAvatarIndex)) 735 if (!profile->GetPrefs()->HasPrefPath(prefs::kProfileAvatarIndex))
733 profile->GetPrefs()->SetInteger(prefs::kProfileAvatarIndex, avatar_index); 736 profile->GetPrefs()->SetInteger(prefs::kProfileAvatarIndex, avatar_index);
734 737
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 1108
1106 if (profile->GetPrefs()->GetBoolean(prefs::kForceEphemeralProfiles)) { 1109 if (profile->GetPrefs()->GetBoolean(prefs::kForceEphemeralProfiles)) {
1107 cache.SetProfileIsEphemeralAtIndex( 1110 cache.SetProfileIsEphemeralAtIndex(
1108 cache.GetIndexOfProfileWithPath(profile->GetPath()), true); 1111 cache.GetIndexOfProfileWithPath(profile->GetPath()), true);
1109 } 1112 }
1110 } 1113 }
1111 1114
1112 void ProfileManager::SetGuestProfilePrefs(Profile* profile) { 1115 void ProfileManager::SetGuestProfilePrefs(Profile* profile) {
1113 // This can be removed in the future but needs to be present through 1116 // This can be removed in the future but needs to be present through
1114 // a release (or two) so that any existing installs get switched to 1117 // a release (or two) so that any existing installs get switched to
1115 // the new state and away from the previous "forced" state. 1118 // the new state and away from the previous "forced" state.
rpetterson 2014/02/24 23:50:47 Perhaps open a bug for this and reference the bug
noms (inactive) 2014/02/25 01:08:27 Sure. I'll add the TODO tomorrow in a separate CL,
1116 IncognitoModePrefs::SetAvailability(profile->GetPrefs(), 1119 IncognitoModePrefs::SetAvailability(profile->GetPrefs(),
1117 IncognitoModePrefs::ENABLED); 1120 IncognitoModePrefs::ENABLED);
1118 } 1121 }
1119 1122
1120 bool ProfileManager::ShouldGoOffTheRecord(Profile* profile) { 1123 bool ProfileManager::ShouldGoOffTheRecord(Profile* profile) {
1121 #if defined(OS_CHROMEOS) 1124 #if defined(OS_CHROMEOS)
1122 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 1125 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
1123 if (profile->GetPath().BaseName().value() == chrome::kInitialProfile && 1126 if (profile->GetPath().BaseName().value() == chrome::kInitialProfile &&
1124 (!command_line.HasSwitch(switches::kTestType) || 1127 (!command_line.HasSwitch(switches::kTestType) ||
1125 command_line.HasSwitch(chromeos::switches::kLoginProfile))) { 1128 command_line.HasSwitch(chromeos::switches::kLoginProfile))) {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 last_non_managed_profile_path.BaseName().MaybeAsASCII()); 1240 last_non_managed_profile_path.BaseName().MaybeAsASCII());
1238 FinishDeletingProfile(profile_to_delete_path); 1241 FinishDeletingProfile(profile_to_delete_path);
1239 } 1242 }
1240 } 1243 }
1241 } 1244 }
1242 #endif 1245 #endif
1243 1246
1244 ProfileManagerWithoutInit::ProfileManagerWithoutInit( 1247 ProfileManagerWithoutInit::ProfileManagerWithoutInit(
1245 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { 1248 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) {
1246 } 1249 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_info_cache.cc ('k') | chrome/browser/profiles/profile_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698