Skip to content

Commit

Permalink
[Profiles] Delete CleanupGuestProfile()
Browse files Browse the repository at this point in the history
This function had only one callsite, and the code can be simplified by
inlining it.

Change-Id: Ic1ea22a700025e9fb3e490cd6f80e175e97190fb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4388599
Reviewed-by: Alex Ilin <alexilin@chromium.org>
Commit-Queue: David Roger <droger@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1124765}
  • Loading branch information
David Roger authored and Chromium LUCI CQ committed Mar 31, 2023
1 parent ca1c9ad commit 3ec0b44
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 22 deletions.
26 changes: 7 additions & 19 deletions chrome/browser/profiles/profile_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1820,23 +1820,6 @@ absl::optional<base::FilePath> ProfileManager::FindLastActiveProfile(
: absl::nullopt;
}

// static
void ProfileManager::CleanUpGuestProfile() {
// ChromeOS handles guest data independently.
#if !BUILDFLAG(IS_CHROMEOS_ASH)
ProfileManager* profile_manager = g_browser_process->profile_manager();

Profile* profile =
profile_manager->GetProfileByPath(profile_manager->GetGuestProfilePath());
if (profile) {
// Clear all browsing data once a Guest Session completes. The Guest
// profile has BrowserContextKeyedServices that the ProfileDestroyer
// can't delete it properly.
profiles::RemoveBrowsingDataForProfile(GetGuestProfilePath());
}
#endif //! BUILDFLAG(IS_CHROMEOS_ASH)
}

DeleteProfileHelper& ProfileManager::GetDeleteProfileHelper() {
return *delete_profile_helper_;
}
Expand Down Expand Up @@ -2067,8 +2050,13 @@ void ProfileManager::OnBrowserClosed(Browser* browser) {
base::UmaHistogramCustomCounts("Profile.Guest.OTR.Lifetime",
duration.InMinutes(), 1,
base::Days(28).InMinutes(), 100);

CleanUpGuestProfile();
// ChromeOS handles guest data independently.
#if !BUILDFLAG(IS_CHROMEOS_ASH)
// Clear all browsing data once a Guest Session completes. The Guest profile
// has BrowserContextKeyedServices that the ProfileDestroyer can't delete
// properly.
profiles::RemoveBrowsingDataForProfile(profile->GetPath());
#endif //! BUILDFLAG(IS_CHROMEOS_ASH)
}

base::FilePath path = profile->GetPath();
Expand Down
3 changes: 0 additions & 3 deletions chrome/browser/profiles/profile_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,6 @@ class ProfileManager : public Profile::Delegate {
absl::optional<base::FilePath> FindLastActiveProfile(
base::RepeatingCallback<bool(ProfileAttributesEntry*)> predicate);

// Deletes Guest profile's browsing data.
static void CleanUpGuestProfile();

DeleteProfileHelper& GetDeleteProfileHelper();
#endif

Expand Down

0 comments on commit 3ec0b44

Please sign in to comment.