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

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

Issue 2905903002: Delete the PreferenceMACs on profile deletion. (Closed)
Patch Set: Update comments Created 3 years, 4 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_manager.h ('k') | components/prefs/in_memory_pref_store.h » ('j') | 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 157df6823e5d8274401835fca2014e357f906bca..feade27f6da194ef253642ea0e0699995ca89dd0 100644
--- a/chrome/browser/profiles/profile_manager.cc
+++ b/chrome/browser/profiles/profile_manager.cc
@@ -1451,19 +1451,12 @@ void ProfileManager::EnsureActiveProfileExistsBeforeDeletion(
new_profile_name, new_avatar_url, std::string());
}
-void ProfileManager::FinishDeletingProfile(
+void ProfileManager::OnLoadProfileForProfileDeletion(
const base::FilePath& profile_dir,
- const base::FilePath& new_active_profile_dir) {
- // Update the last used profile pref before closing browser windows. This
- // way the correct last used profile is set for any notification observers.
- profiles::SetLastUsedProfile(
- new_active_profile_dir.BaseName().MaybeAsASCII());
-
+ Profile* profile) {
ProfileAttributesStorage& storage = GetProfileAttributesStorage();
// TODO(sail): Due to bug 88586 we don't delete the profile instance. Once we
// start deleting the profile instance we need to close background apps too.
- Profile* profile = GetProfileByPath(profile_dir);
-
if (profile) {
// TODO: Migrate additional code in this block to observe this notification
// instead of being implemented here.
@@ -1495,8 +1488,9 @@ void ProfileManager::FinishDeletingProfile(
ProfileMetrics::LogProfileDelete(entry->IsAuthenticated());
// Some platforms store passwords in keychains. They should be removed.
scoped_refptr<password_manager::PasswordStore> password_store =
- PasswordStoreFactory::GetForProfile(
- profile, ServiceAccessType::EXPLICIT_ACCESS).get();
+ PasswordStoreFactory::GetForProfile(profile,
+ ServiceAccessType::EXPLICIT_ACCESS)
+ .get();
if (password_store.get()) {
password_store->RemoveLoginsCreatedBetween(
base::Time(), base::Time::Max(), base::Closure());
@@ -1505,18 +1499,37 @@ void ProfileManager::FinishDeletingProfile(
// The Profile Data doesn't get wiped until Chrome closes. Since we promised
// that the user's data would be removed, do so immediately.
profiles::RemoveBrowsingDataForProfile(profile_dir);
+
+ // Clean-up pref data that won't be cleaned up by deleting the profile dir.
+ profile->GetPrefs()->OnStoreDeletionFromDisk();
} else {
- // It is safe to delete a not yet loaded Profile from disk.
+ // We failed to load the profile, but it's safe to delete a not yet loaded
+ // Profile from disk.
BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
base::BindOnce(&NukeProfileFromDisk, profile_dir));
}
- // Queue even a profile that was nuked so it will be MarkedForDeletion and so
- // CreateProfileAsync can't create it.
- MarkProfileDirectoryForDeletion(profile_dir);
storage.RemoveProfile(profile_dir);
ProfileMetrics::UpdateReportedProfilesStatistics(this);
}
+
+void ProfileManager::FinishDeletingProfile(
+ const base::FilePath& profile_dir,
+ const base::FilePath& new_active_profile_dir) {
+ // Update the last used profile pref before closing browser windows. This
+ // way the correct last used profile is set for any notification observers.
+ profiles::SetLastUsedProfile(
+ new_active_profile_dir.BaseName().MaybeAsASCII());
+
+ // Attempt to load the profile before deleting it to properly clean up
+ // profile-specific data stored outside the profile directory.
+ LoadProfileByPath(profile_dir, false,
+ base::Bind(&ProfileManager::OnLoadProfileForProfileDeletion,
+ base::Unretained(this), profile_dir));
+
+ // Prevents CreateProfileAsync from re-creating the profile.
+ MarkProfileDirectoryForDeletion(profile_dir);
+}
#endif // !defined(OS_ANDROID)
ProfileManager::ProfileInfo* ProfileManager::RegisterProfile(
« no previous file with comments | « chrome/browser/profiles/profile_manager.h ('k') | components/prefs/in_memory_pref_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698