OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <windows.h> | 9 #include <windows.h> |
10 | 10 |
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 user_reg_root.Close(); | 821 user_reg_root.Close(); |
822 if (RegUnLoadKey(HKEY_USERS, profile_sid) == ERROR_SUCCESS) | 822 if (RegUnLoadKey(HKEY_USERS, profile_sid) == ERROR_SUCCESS) |
823 VLOG(1) << "Unloaded registry hive for " << profile_sid; | 823 VLOG(1) << "Unloaded registry hive for " << profile_sid; |
824 else | 824 else |
825 LOG(ERROR) << "Error unloading registry hive for " << profile_sid; | 825 LOG(ERROR) << "Error unloading registry hive for " << profile_sid; |
826 } | 826 } |
827 } | 827 } |
828 } | 828 } |
829 | 829 |
830 // Removes the persistent blacklist state for the current user. Note: this will | 830 // Removes the persistent blacklist state for the current user. Note: this will |
831 // not remove the state for users other than the one uninstalling chrome on a | 831 // not remove the state for users other than the one uninstalling Chrome on a |
832 // system-level install (http://crbug.com/388725). Doing so would require | 832 // system-level install (http://crbug.com/388725). Doing so would require |
833 // extracting the per-user registry hive iteration from | 833 // extracting the per-user registry hive iteration from |
834 // UninstallActiveSetupEntries so that it could service multiple tasks. | 834 // UninstallActiveSetupEntries so that it could service multiple tasks. |
835 void RemoveBlacklistState() { | 835 void RemoveBlacklistState() { |
836 InstallUtil::DeleteRegistryKey(HKEY_CURRENT_USER, | 836 InstallUtil::DeleteRegistryKey(HKEY_CURRENT_USER, |
837 blacklist::kRegistryBeaconPath, | 837 blacklist::kRegistryBeaconPath, |
838 0); // wow64_access | 838 0); // wow64_access |
839 InstallUtil::DeleteRegistryKey(HKEY_CURRENT_USER, | 839 InstallUtil::DeleteRegistryKey(HKEY_CURRENT_USER, |
840 blacklist::kRegistryFinchListPath, | 840 blacklist::kRegistryFinchListPath, |
841 0); // wow64_access | 841 0); // wow64_access |
842 } | 842 } |
843 | 843 |
| 844 // Removes the persistent state for |distribution| for the current user. Note: |
| 845 // this will not remove the state for users other than the one uninstalling |
| 846 // Chrome on a system-level install; see RemoveBlacklistState for details. |
| 847 void RemoveDistributionRegistryState(BrowserDistribution* distribution) { |
| 848 base::string16 key_name(L"Software\\"); |
| 849 key_name += distribution->GetInstallSubDir(); |
| 850 InstallUtil::DeleteRegistryKey(HKEY_CURRENT_USER, key_name, KEY_WOW64_32KEY); |
| 851 } |
| 852 |
844 } // namespace | 853 } // namespace |
845 | 854 |
846 DeleteResult DeleteChromeDirectoriesIfEmpty( | 855 DeleteResult DeleteChromeDirectoriesIfEmpty( |
847 const base::FilePath& application_directory) { | 856 const base::FilePath& application_directory) { |
848 DeleteResult result(DeleteEmptyDir(application_directory)); | 857 DeleteResult result(DeleteEmptyDir(application_directory)); |
849 if (result == DELETE_SUCCEEDED) { | 858 if (result == DELETE_SUCCEEDED) { |
850 // Now check and delete if the parent directories are empty | 859 // Now check and delete if the parent directories are empty |
851 // For example Google\Chrome or Chromium | 860 // For example Google\Chrome or Chromium |
852 const base::FilePath product_directory(application_directory.DirName()); | 861 const base::FilePath product_directory(application_directory.DirName()); |
853 if (!product_directory.empty()) { | 862 if (!product_directory.empty()) { |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1323 if (!installer_state.is_multi_install() || product.is_chrome_binaries()) { | 1332 if (!installer_state.is_multi_install() || product.is_chrome_binaries()) { |
1324 DeleteResult delete_result = DeleteChromeFilesAndFolders( | 1333 DeleteResult delete_result = DeleteChromeFilesAndFolders( |
1325 installer_state, base::MakeAbsoluteFilePath(setup_exe)); | 1334 installer_state, base::MakeAbsoluteFilePath(setup_exe)); |
1326 if (delete_result == DELETE_FAILED) { | 1335 if (delete_result == DELETE_FAILED) { |
1327 ret = installer::UNINSTALL_FAILED; | 1336 ret = installer::UNINSTALL_FAILED; |
1328 } else if (delete_result == DELETE_REQUIRES_REBOOT) { | 1337 } else if (delete_result == DELETE_REQUIRES_REBOOT) { |
1329 ret = installer::UNINSTALL_REQUIRES_REBOOT; | 1338 ret = installer::UNINSTALL_REQUIRES_REBOOT; |
1330 } | 1339 } |
1331 } | 1340 } |
1332 | 1341 |
1333 if (delete_profile) | 1342 if (delete_profile) { |
1334 DeleteUserDataDir(user_data_dir, product.is_chrome_frame()); | 1343 DeleteUserDataDir(user_data_dir, product.is_chrome_frame()); |
| 1344 RemoveDistributionRegistryState(browser_dist); |
| 1345 } |
1335 | 1346 |
1336 if (!force_uninstall) { | 1347 if (!force_uninstall) { |
1337 VLOG(1) << "Uninstallation complete. Launching post-uninstall operations."; | 1348 VLOG(1) << "Uninstallation complete. Launching post-uninstall operations."; |
1338 browser_dist->DoPostUninstallOperations(product_state->version(), | 1349 browser_dist->DoPostUninstallOperations(product_state->version(), |
1339 backup_state_file, distribution_data); | 1350 backup_state_file, distribution_data); |
1340 } | 1351 } |
1341 | 1352 |
1342 // Try and delete the preserved local state once the post-install | 1353 // Try and delete the preserved local state once the post-install |
1343 // operations are complete. | 1354 // operations are complete. |
1344 if (!backup_state_file.empty()) | 1355 if (!backup_state_file.empty()) |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1410 // If we need a reboot to continue, schedule the parent directories for | 1421 // If we need a reboot to continue, schedule the parent directories for |
1411 // deletion unconditionally. If they are not empty, the session manager | 1422 // deletion unconditionally. If they are not empty, the session manager |
1412 // will not delete them on reboot. | 1423 // will not delete them on reboot. |
1413 ScheduleParentAndGrandparentForDeletion(target_path); | 1424 ScheduleParentAndGrandparentForDeletion(target_path); |
1414 } else if (DeleteChromeDirectoriesIfEmpty(target_path) == DELETE_FAILED) { | 1425 } else if (DeleteChromeDirectoriesIfEmpty(target_path) == DELETE_FAILED) { |
1415 *uninstall_status = UNINSTALL_FAILED; | 1426 *uninstall_status = UNINSTALL_FAILED; |
1416 } | 1427 } |
1417 } | 1428 } |
1418 | 1429 |
1419 } // namespace installer | 1430 } // namespace installer |
OLD | NEW |