Chromium Code Reviews| Index: chrome/browser/profiles/profile_manager.cc |
| diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc |
| index e8771db996830e14e3f794af7adc9c9872afe918..ef2945ba02a48aab8a4b9edf255ceb3daae37864 100644 |
| --- a/chrome/browser/profiles/profile_manager.cc |
| +++ b/chrome/browser/profiles/profile_manager.cc |
| @@ -304,6 +304,7 @@ Profile* ProfileManager::GetLastUsedProfile() { |
| Profile* ProfileManager::GetLastUsedProfileAllowedByPolicy() { |
| Profile* profile = GetLastUsedProfile(); |
| if (profile->IsGuestSession() || |
| + profile->IsSystemProfile() || |
| IncognitoModePrefs::GetAvailability(profile->GetPrefs()) == |
| IncognitoModePrefs::FORCED) { |
| return profile->GetOffTheRecordProfile(); |
| @@ -437,7 +438,10 @@ void ProfileManager::CreateProfileAsync( |
| if (iter != profiles_info_.end() && info->created) { |
| Profile* profile = info->profile.get(); |
| // If this was the guest profile, apply settings and go OffTheRecord. |
| - if (profile->GetPath() == ProfileManager::GetGuestProfilePath()) { |
| + // SystemProfile also needs characteristics of being off the record, such |
|
msw
2015/05/21 04:34:43
nit: "The system profile"
Mike Lerman
2015/05/21 15:27:31
Done.
|
| + // as having no extensions, not writing to disk, etc. |
| + if (profile->GetPath() == ProfileManager::GetGuestProfilePath() || |
| + profile->GetPath() == ProfileManager::GetSystemProfilePath()) { |
|
msw
2015/05/21 04:34:43
nit: use profile->IsSystemProfile() instead? (ditt
Mike Lerman
2015/05/21 15:27:31
This works now, as these items are set during prof
|
| SetGuestProfilePrefs(profile); |
|
msw
2015/05/21 04:34:43
nit: maybe this should be renamed?
Mike Lerman
2015/05/21 15:27:30
I tried "SetNonPersonalProfilePrefs" since the pro
msw
2015/05/21 17:48:11
SetNonPersonalProfilePrefs sgtm. SetSystemProfileP
|
| profile = profile->GetOffTheRecordProfile(); |
| } |
| @@ -1003,8 +1007,10 @@ void ProfileManager::OnProfileCreated(Profile* profile, |
| if (profile) { |
| // If this was the guest profile, finish setting its special status. |
|
msw
2015/05/21 04:34:43
nit: update comment.
Mike Lerman
2015/05/21 15:27:30
Done.
|
| - if (profile->GetPath() == ProfileManager::GetGuestProfilePath()) |
| + if (profile->GetPath() == ProfileManager::GetGuestProfilePath() || |
|
msw
2015/05/21 04:34:43
ditto nit: use IsSystemProfile() and IsGuestSessio
Mike Lerman
2015/05/21 15:27:31
Done.
|
| + profile->GetPath() == ProfileManager::GetSystemProfilePath()) { |
| SetGuestProfilePrefs(profile); |
| + } |
| // Invoke CREATED callback for incognito profiles. |
| if (go_off_the_record) |
| @@ -1329,10 +1335,6 @@ void ProfileManager::SetGuestProfilePrefs(Profile* profile) { |
| prefs->SetBoolean(bookmarks::prefs::kEditBookmarksEnabled, false); |
| prefs->SetBoolean(bookmarks::prefs::kShowBookmarkBar, false); |
| prefs->ClearPref(DefaultSearchManager::kDefaultSearchProviderDataPrefName); |
| - // This can be removed in the future but needs to be present through |
| - // a release (or two) so that any existing installs get switched to |
| - // the new state and away from the previous "forced" state. |
| - IncognitoModePrefs::SetAvailability(prefs, IncognitoModePrefs::ENABLED); |
| } |
| bool ProfileManager::ShouldGoOffTheRecord(Profile* profile) { |
| @@ -1341,7 +1343,7 @@ bool ProfileManager::ShouldGoOffTheRecord(Profile* profile) { |
| return true; |
| } |
| #endif |
| - return profile->IsGuestSession(); |
| + return profile->IsGuestSession() || profile->IsSystemProfile(); |
| } |
| void ProfileManager::RunCallbacks(const std::vector<CreateCallback>& callbacks, |
| @@ -1367,7 +1369,9 @@ void ProfileManager::UpdateLastUser(Profile* last_active) { |
| PrefService* local_state = g_browser_process->local_state(); |
| DCHECK(local_state); |
| // Only keep track of profiles that we are managing; tests may create others. |
| - if (profiles_info_.find(last_active->GetPath()) != profiles_info_.end()) { |
| + // Also never consider the SystemProfile as "active". |
| + if (profiles_info_.find(last_active->GetPath()) != profiles_info_.end() && |
| + !last_active->IsSystemProfile()) { |
| std::string profile_path_base = |
| last_active->GetPath().BaseName().MaybeAsASCII(); |
| if (profile_path_base != GetLastUsedProfileName()) |