diff options
author | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-17 13:24:57 +0000 |
---|---|---|
committer | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-17 13:24:57 +0000 |
commit | 4df8786fcd6334d4f5f92350a8297135149aabae (patch) | |
tree | c373e3afb8ec9104547ee873019ce0be920b14a5 /chrome/installer | |
parent | 7d280cb1adf9c8e66ef8f9c97e8b633b0eac37e0 (diff) | |
download | chromium_src-4df8786fcd6334d4f5f92350a8297135149aabae.zip chromium_src-4df8786fcd6334d4f5f92350a8297135149aabae.tar.gz chromium_src-4df8786fcd6334d4f5f92350a8297135149aabae.tar.bz2 |
On uninstall ask whether to delete profile.
BUG=8431
Review URL: http://codereview.chromium.org/62097
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13926 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer')
-rw-r--r-- | chrome/installer/setup/uninstall.cc | 29 | ||||
-rw-r--r-- | chrome/installer/util/util_constants.h | 1 |
2 files changed, 22 insertions, 8 deletions
diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc index 04907e5..b1414aa 100644 --- a/chrome/installer/setup/uninstall.cc +++ b/chrome/installer/setup/uninstall.cc @@ -99,7 +99,7 @@ void DeleteChromeShortcut(bool system_uninstall) { // of error (only logs the error). bool DeleteFilesAndFolders(const std::wstring& exe_path, bool system_uninstall, const installer::Version& installed_version, - std::wstring* local_state_path) { + std::wstring* local_state_path, bool delete_profile) { std::wstring install_path(installer::GetChromeInstallPath(system_uninstall)); if (install_path.empty()) { LOG(ERROR) << "Could not get installation destination path."; @@ -136,6 +136,13 @@ bool DeleteFilesAndFolders(const std::wstring& exe_path, bool system_uninstall, LOG(ERROR) << "Failed to delete folder (2nd try): " << install_path; } + if (delete_profile) { + LOG(INFO) << "Deleting user profile" << user_local_state.value(); + if (!file_util::Delete(user_local_state, true)) + LOG(ERROR) << "Failed to delete user profle dir: " + << user_local_state.value(); + } + // Now check and delete if the parent directories are empty // For example Google\Chrome or Chromium std::wstring parent_dir = file_util::GetDirectoryFromPath(install_path); @@ -202,8 +209,11 @@ installer_util::InstallStatus IsChromeActiveOrUserCancelled( << exit_code; if ((exit_code == ResultCodes::UNINSTALL_CHROME_ALIVE) || (exit_code == ResultCodes::UNINSTALL_USER_CANCEL) || - (exit_code == ResultCodes::HUNG)) + (exit_code == ResultCodes::HUNG)) { return installer_util::UNINSTALL_CANCELLED; + } else if (exit_code == ResultCodes::UNINSTALL_DELETE_PROFILE) { + return installer_util::UNINSTALL_DELETE_PROFILE; + } } else { LOG(ERROR) << "Failed to launch chrome.exe for uninstall confirmation."; } @@ -217,10 +227,11 @@ installer_util::InstallStatus installer_setup::UninstallChrome( const std::wstring& exe_path, bool system_uninstall, const installer::Version& installed_version, bool remove_all, bool force_uninstall) { + installer_util::InstallStatus status = installer_util::UNINSTALL_CONFIRMED; if (!force_uninstall) { - installer_util::InstallStatus status = - IsChromeActiveOrUserCancelled(system_uninstall); - if (status != installer_util::UNINSTALL_CONFIRMED) + status = IsChromeActiveOrUserCancelled(system_uninstall); + if (status != installer_util::UNINSTALL_CONFIRMED && + status != installer_util::UNINSTALL_DELETE_PROFILE) return status; } else { // Since --force-uninstall command line option is used, we are going to @@ -325,10 +336,12 @@ installer_util::InstallStatus installer_setup::UninstallChrome( // Finally delete all the files from Chrome folder after moving setup.exe // and the user's Local State to a temp location. + bool delete_profile = (status == installer_util::UNINSTALL_DELETE_PROFILE); std::wstring local_state_path; + installer_util::InstallStatus ret = installer_util::UNINSTALL_SUCCESSFUL; if (!DeleteFilesAndFolders(exe_path, system_uninstall, installed_version, - &local_state_path)) - return installer_util::UNINSTALL_FAILED; + &local_state_path, delete_profile)) + ret = installer_util::UNINSTALL_FAILED; if (!force_uninstall) { LOG(INFO) << "Uninstallation complete. Launching Uninstall survey."; @@ -340,5 +353,5 @@ installer_util::InstallStatus installer_setup::UninstallChrome( if (!local_state_path.empty()) file_util::Delete(local_state_path, false); - return installer_util::UNINSTALL_SUCCESSFUL; + return ret; } diff --git a/chrome/installer/util/util_constants.h b/chrome/installer/util/util_constants.h index 3cc3fb6..f2ca6dc 100644 --- a/chrome/installer/util/util_constants.h +++ b/chrome/installer/util/util_constants.h @@ -28,6 +28,7 @@ enum InstallStatus { CHROME_NOT_INSTALLED, // Chrome not installed (returned in case of uninstall) CHROME_RUNNING, // Chrome currently running (when trying to uninstall) UNINSTALL_CONFIRMED, // User has confirmed Chrome uninstall + UNINSTALL_DELETE_PROFILE, // User confirmed uninstall and profile deletion UNINSTALL_SUCCESSFUL, // Chrome successfully uninstalled UNINSTALL_FAILED, // Chrome uninstallation failed UNINSTALL_CANCELLED, // User cancelled Chrome uninstallation |