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

Unified Diff: chrome/installer/setup/uninstall.cc

Issue 392013: Correctly schedule empty parent directories for deletion when Chrome Frame is... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 1 month 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 | « no previous file | chrome/installer/util/delete_after_reboot_helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/setup/uninstall.cc
===================================================================
--- chrome/installer/setup/uninstall.cc (revision 31781)
+++ chrome/installer/setup/uninstall.cc (working copy)
@@ -117,6 +117,23 @@
}
}
+bool ScheduleParentAndGrandparentForDeletion(const FilePath& path) {
+ FilePath parent_dir = path.DirName();
+ bool ret = ScheduleFileSystemEntityForDeletion(parent_dir.value().c_str());
+ if (!ret) {
+ LOG(ERROR) << "Failed to schedule parent dir for deletion: "
+ << parent_dir.value();
+ } else {
+ FilePath grandparent_dir(parent_dir.DirName());
+ ret = ScheduleFileSystemEntityForDeletion(grandparent_dir.value().c_str());
+ if (!ret) {
+ LOG(ERROR) << "Failed to schedule grandparent dir for deletion: "
+ << grandparent_dir.value();
+ }
+ }
+ return ret;
+}
+
// Deletes empty parent & empty grandparent dir of given path.
bool DeleteEmptyParentDir(const std::wstring& path) {
bool ret = true;
@@ -233,12 +250,23 @@
result = DELETE_FAILED;
}
}
- DeleteEmptyParentDir(user_local_state.value());
+ if (result == DELETE_REQUIRES_REBOOT) {
+ ScheduleParentAndGrandparentForDeletion(user_local_state);
+ } else {
+ DeleteEmptyParentDir(user_local_state.value());
+ }
}
- // Now check and delete if the parent directories are empty
- // For example Google\Chrome or Chromium
- DeleteEmptyParentDir(install_path);
+ if (result == DELETE_REQUIRES_REBOOT) {
+ // If we need a reboot to continue, schedule the parent directories for
+ // deletion unconditionally. If they are not empty, the session manager
+ // will not delete them on reboot.
+ ScheduleParentAndGrandparentForDeletion(FilePath(install_path));
+ } else {
+ // Now check and delete if the parent directories are empty
+ // For example Google\Chrome or Chromium
+ DeleteEmptyParentDir(install_path);
+ }
return result;
}
« no previous file with comments | « no previous file | chrome/installer/util/delete_after_reboot_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698