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

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

Issue 7321011: Multi-Profiles: Add delete profile command (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove debug code Created 9 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
Index: chrome/browser/profiles/profile_manager.cc
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc
index e84bbc3fe01843de7c7ef527d2e335e92b579757..a85901efec0a4c2406d7dd917437df96e111d62d 100644
--- a/chrome/browser/profiles/profile_manager.cc
+++ b/chrome/browser/profiles/profile_manager.cc
@@ -41,8 +41,20 @@
#include "chrome/browser/chromeos/cros/cryptohome_library.h"
#endif
+namespace {
+
+void DeleteProfileDirectories(std::vector<FilePath> paths) {
willchan no longer on Chromium 2011/07/07 17:36:27 const std::vector<FilePath>&
sail 2011/07/07 18:00:19 To make it thread safe I want this to be a copy of
willchan no longer on Chromium 2011/07/08 08:33:17 NewRunnableFunction() will take the parameters and
sail 2011/07/08 16:04:33 Thanks for the explanation! Sent out fix in a sepa
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
+ for (std::vector<FilePath>::iterator it = paths.begin();
+ it != paths.end(); ++it) {
+ file_util::Delete(*it, true);
+ }
+}
+
+} // namespace
+
bool ProfileManagerObserver::DeleteAfterCreation() {
- return false;
+ return false;
}
// The NewProfileLauncher class is created when to wait for a multi-profile
@@ -99,6 +111,13 @@ ProfileManager::ProfileManager() : logged_in_(false) {
ProfileManager::~ProfileManager() {
BrowserList::RemoveObserver(this);
+
+ if (profiles_to_delete_.size()) {
willchan no longer on Chromium 2011/07/07 17:36:27 Perhaps we should tag this with TODO: fix crbug.co
Miranda Callahan 2011/07/07 17:45:55 Agreed wholeheartedly about tagging; another reaso
sail 2011/07/07 18:00:19 Done.
+ BrowserThread::PostTask(
+ BrowserThread::FILE, FROM_HERE,
+ NewRunnableFunction(&DeleteProfileDirectories, profiles_to_delete_));
+ profiles_to_delete_.clear();
+ }
}
FilePath ProfileManager::GetDefaultProfileDir(
@@ -535,3 +554,11 @@ void ProfileManager::AddProfileToCache(Profile* profile) {
cache.ChooseAvatarIconIndexForNewProfile());
}
}
+
+void ProfileManager::ScheduleProfileForDeletion(const FilePath& profile_dir) {
+ Profile* profile = GetProfileByPath(profile_dir);
+ if (profile)
+ BrowserList::CloseAllBrowsersWithProfile(profile);
Miranda Callahan 2011/07/07 17:43:02 Is there any issue with BackgroundApps that we hav
sail 2011/07/07 18:00:19 No idea. Would rachel know?
Miranda Callahan 2011/07/07 18:24:16 I can imagine that she would -- adding her in.
rpetterson 2011/07/07 18:24:30 This particular call shouldn't affect BackgroundAp
+ profiles_to_delete_.push_back(profile_dir);
+ GetProfileInfoCache().DeleteProfileFromCache(profile_dir);
+}

Powered by Google App Engine
This is Rietveld 408576698