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

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: Multi-Profiles: Add delete profile command 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
« no previous file with comments | « chrome/browser/profiles/profile_manager.h ('k') | chrome/browser/ui/browser_list.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
===================================================================
--- chrome/browser/profiles/profile_manager.cc (revision 91776)
+++ chrome/browser/profiles/profile_manager.cc (working copy)
@@ -41,8 +41,20 @@
#include "chrome/browser/chromeos/cros/cryptohome_library.h"
#endif
+namespace {
+
+void DeleteProfileDirectories(std::vector<FilePath> paths) {
+ 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,14 @@
ProfileManager::~ProfileManager() {
BrowserList::RemoveObserver(this);
+
+ // TODO(sail): fix http://crbug.com/88586
+ if (profiles_to_delete_.size()) {
+ BrowserThread::PostTask(
+ BrowserThread::FILE, FROM_HERE,
+ NewRunnableFunction(&DeleteProfileDirectories, profiles_to_delete_));
+ profiles_to_delete_.clear();
+ }
}
FilePath ProfileManager::GetDefaultProfileDir(
@@ -535,3 +555,14 @@
cache.ChooseAvatarIconIndexForNewProfile());
}
}
+
+void ProfileManager::ScheduleProfileForDeletion(const FilePath& profile_dir) {
+ // 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)
+ BrowserList::CloseAllBrowsersWithProfile(profile);
+ profiles_to_delete_.push_back(profile_dir);
+ ProfileInfoCache& cache = GetProfileInfoCache();
+ cache.DeleteProfileFromCache(profile_dir);
+}
« no previous file with comments | « chrome/browser/profiles/profile_manager.h ('k') | chrome/browser/ui/browser_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698