| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // This file defines the methods useful for uninstalling Chrome. | 5 // This file defines the methods useful for uninstalling Chrome. |
| 6 | 6 |
| 7 #include "chrome/installer/setup/uninstall.h" | 7 #include "chrome/installer/setup/uninstall.h" |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "base/registry.h" | 11 #include "base/registry.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "chrome/app/result_codes.h" | 13 #include "chrome/app/result_codes.h" |
| 14 #include "chrome/installer/setup/setup.h" | 14 #include "chrome/installer/setup/setup.h" |
| 15 #include "chrome/installer/setup/setup_constants.h" | 15 #include "chrome/installer/setup/setup_constants.h" |
| 16 #include "chrome/installer/util/browser_distribution.h" | 16 #include "chrome/installer/util/browser_distribution.h" |
| 17 #include "chrome/installer/util/helper.h" | 17 #include "chrome/installer/util/helper.h" |
| 18 #include "chrome/installer/util/logging_installer.h" | 18 #include "chrome/installer/util/logging_installer.h" |
| 19 #include "chrome/installer/util/shell_util.h" | 19 #include "chrome/installer/util/shell_util.h" |
| 20 #include "chrome/installer/util/util_constants.h" |
| 20 #include "chrome/installer/util/version.h" | 21 #include "chrome/installer/util/version.h" |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| 23 | 24 |
| 24 // This functions checks for any Chrome instances that are | 25 // This functions checks for any Chrome instances that are |
| 25 // running and first asks them to close politely by sending a Windows message. | 26 // running and first asks them to close politely by sending a Windows message. |
| 26 // If there is an error while sending message or if there are still Chrome | 27 // If there is an error while sending message or if there are still Chrome |
| 27 // procesess active after the message has been sent, this function will try | 28 // procesess active after the message has been sent, this function will try |
| 28 // to kill them. | 29 // to kill them. |
| 29 void CloseAllChromeProcesses() { | 30 void CloseAllChromeProcesses() { |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 | 249 |
| 249 // Delete shared registry keys as well (these require admin rights) if | 250 // Delete shared registry keys as well (these require admin rights) if |
| 250 // remove_all option is specified. | 251 // remove_all option is specified. |
| 251 if (remove_all) { | 252 if (remove_all) { |
| 252 DeleteRegistryKey(hklm_key, set_access_key); | 253 DeleteRegistryKey(hklm_key, set_access_key); |
| 253 DeleteRegistryKey(hklm_key, html_prog_id); | 254 DeleteRegistryKey(hklm_key, html_prog_id); |
| 254 DeleteRegistryValue(HKEY_LOCAL_MACHINE, | 255 DeleteRegistryValue(HKEY_LOCAL_MACHINE, |
| 255 ShellUtil::kRegRegisteredApplications, | 256 ShellUtil::kRegRegisteredApplications, |
| 256 dist->GetApplicationName()); | 257 dist->GetApplicationName()); |
| 257 | 258 |
| 259 // Delete the App Paths key that lets explorer find Chrome. |
| 260 DeleteRegistryKey(hklm_key, installer_util::kAppPathsRegistryKey); |
| 261 |
| 258 // Delete media player registry key that exists only in HKLM. | 262 // Delete media player registry key that exists only in HKLM. |
| 259 std::wstring reg_path(installer::kMediaPlayerRegPath); | 263 std::wstring reg_path(installer::kMediaPlayerRegPath); |
| 260 file_util::AppendToPath(®_path, installer_util::kChromeExe); | 264 file_util::AppendToPath(®_path, installer_util::kChromeExe); |
| 261 DeleteRegistryKey(hklm_key, reg_path); | 265 DeleteRegistryKey(hklm_key, reg_path); |
| 262 hklm_key.Close(); | 266 hklm_key.Close(); |
| 263 } | 267 } |
| 264 | 268 |
| 265 // Finally delete all the files from Chrome folder after moving setup.exe | 269 // Finally delete all the files from Chrome folder after moving setup.exe |
| 266 // to a temp location. | 270 // to a temp location. |
| 267 if (!DeleteFilesAndFolders(exe_path, system_uninstall, installed_version)) | 271 if (!DeleteFilesAndFolders(exe_path, system_uninstall, installed_version)) |
| 268 return installer_util::UNINSTALL_FAILED; | 272 return installer_util::UNINSTALL_FAILED; |
| 269 | 273 |
| 270 if (!force_uninstall) { | 274 if (!force_uninstall) { |
| 271 LOG(INFO) << "Uninstallation complete. Launching Uninstall survey."; | 275 LOG(INFO) << "Uninstallation complete. Launching Uninstall survey."; |
| 272 dist->DoPostUninstallOperations(installed_version); | 276 dist->DoPostUninstallOperations(installed_version); |
| 273 } | 277 } |
| 274 return installer_util::UNINSTALL_SUCCESSFUL; | 278 return installer_util::UNINSTALL_SUCCESSFUL; |
| 275 } | 279 } |
| 276 | 280 |
| OLD | NEW |