Index: chrome/installer/setup/uninstall.cc |
diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc |
index d1b67ffbc83fffd74410a75255d97e338d86a55c..0f1376bca64330a0325b63ab2473b4d907fe4c0a 100644 |
--- a/chrome/installer/setup/uninstall.cc |
+++ b/chrome/installer/setup/uninstall.cc |
@@ -395,62 +395,50 @@ DeleteResult DeleteEmptyDir(const base::FilePath& path) { |
return DELETE_FAILED; |
} |
-void GetLocalStateFolders(const Product& product, |
- std::vector<base::FilePath>* paths) { |
+base::FilePath GetLocalStateFolder(const Product& product) { |
// Obtain the location of the user profile data. |
- product.GetUserDataPaths(paths); |
- LOG_IF(ERROR, paths->empty()) |
+ base::FilePath local_state_folder = product.GetUserDataPath(); |
+ LOG_IF(ERROR, local_state_folder.empty()) |
<< "Could not retrieve user's profile directory."; |
+ |
+ return local_state_folder; |
} |
// Creates a copy of the local state file and returns a path to the copy. |
-base::FilePath BackupLocalStateFile( |
- const std::vector<base::FilePath>& local_state_folders) { |
+base::FilePath BackupLocalStateFile(const base::FilePath& local_state_folder) { |
base::FilePath backup; |
- |
- // Copy the first local state file that is found. |
- for (size_t i = 0; i < local_state_folders.size(); ++i) { |
- const base::FilePath& local_state_folder = local_state_folders[i]; |
- base::FilePath state_file( |
- local_state_folder.Append(chrome::kLocalStateFilename)); |
- if (!base::PathExists(state_file)) |
- continue; |
- if (!base::CreateTemporaryFile(&backup)) |
- LOG(ERROR) << "Failed to create temporary file for Local State."; |
- else |
- base::CopyFile(state_file, backup); |
- break; |
- } |
+ base::FilePath state_file( |
+ local_state_folder.Append(chrome::kLocalStateFilename)); |
+ if (!base::CreateTemporaryFile(&backup)) |
+ LOG(ERROR) << "Failed to create temporary file for Local State."; |
+ else |
+ base::CopyFile(state_file, backup); |
return backup; |
} |
-// Deletes all user data directories for a product. |
-DeleteResult DeleteLocalState( |
- const std::vector<base::FilePath>& local_state_folders, |
- bool schedule_on_failure) { |
- if (local_state_folders.empty()) |
+// Deletes a product's user data directory. |
+DeleteResult DeleteLocalState(const base::FilePath& local_state_folder, |
gab
2014/04/02 15:16:57
Why is this called DeleteLocalState if it deletes
grt (UTC plus 2)
2014/04/02 16:53:09
It deletes all locally-stored state (which happens
gab
2014/04/02 17:20:14
Yes that's what I meant, sorry for being unclear :
|
+ bool schedule_on_failure) { |
+ if (local_state_folder.empty()) |
return DELETE_SUCCEEDED; |
DeleteResult result = DELETE_SUCCEEDED; |
- for (size_t i = 0; i < local_state_folders.size(); ++i) { |
- const base::FilePath& user_local_state = local_state_folders[i]; |
- VLOG(1) << "Deleting user profile " << user_local_state.value(); |
- if (!base::DeleteFile(user_local_state, true)) { |
- LOG(ERROR) << "Failed to delete user profile dir: " |
- << user_local_state.value(); |
- if (schedule_on_failure) { |
- ScheduleDirectoryForDeletion(user_local_state); |
- result = DELETE_REQUIRES_REBOOT; |
- } else { |
- result = DELETE_FAILED; |
- } |
+ VLOG(1) << "Deleting user profile " << local_state_folder.value(); |
+ if (!base::DeleteFile(local_state_folder, true)) { |
+ LOG(ERROR) << "Failed to delete user profile dir: " |
+ << local_state_folder.value(); |
+ if (schedule_on_failure) { |
+ ScheduleDirectoryForDeletion(local_state_folder); |
+ result = DELETE_REQUIRES_REBOOT; |
+ } else { |
+ result = DELETE_FAILED; |
} |
} |
if (result == DELETE_REQUIRES_REBOOT) { |
- ScheduleParentAndGrandparentForDeletion(local_state_folders[0]); |
+ ScheduleParentAndGrandparentForDeletion(local_state_folder); |
} else { |
- const base::FilePath user_data_dir(local_state_folders[0].DirName()); |
+ const base::FilePath user_data_dir(local_state_folder.DirName()); |
if (!user_data_dir.empty() && |
DeleteEmptyDir(user_data_dir) == DELETE_SUCCEEDED) { |
const base::FilePath product_dir(user_data_dir.DirName()); |
@@ -1332,9 +1320,8 @@ InstallStatus UninstallProduct(const InstallationState& original_state, |
// When deleting files, we must make sure that we're either a "single" |
// (aka non-multi) installation or we are the Chrome Binaries. |
- std::vector<base::FilePath> local_state_folders; |
- GetLocalStateFolders(product, &local_state_folders); |
- base::FilePath backup_state_file(BackupLocalStateFile(local_state_folders)); |
+ base::FilePath local_state_folder(GetLocalStateFolder(product)); |
+ base::FilePath backup_state_file(BackupLocalStateFile(local_state_folder)); |
if (product.is_chrome_app_host()) { |
DeleteAppHostFilesAndFolders(installer_state, product_state->version()); |
@@ -1350,7 +1337,7 @@ InstallStatus UninstallProduct(const InstallationState& original_state, |
} |
if (delete_profile) |
- DeleteLocalState(local_state_folders, product.is_chrome_frame()); |
+ DeleteLocalState(local_state_folder, product.is_chrome_frame()); |
if (!force_uninstall) { |
VLOG(1) << "Uninstallation complete. Launching post-uninstall operations."; |