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 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
830 user_reg_root.Close(); | 830 user_reg_root.Close(); |
831 if (RegUnLoadKey(HKEY_USERS, profile_sid) == ERROR_SUCCESS) | 831 if (RegUnLoadKey(HKEY_USERS, profile_sid) == ERROR_SUCCESS) |
832 VLOG(1) << "Unloaded registry hive for " << profile_sid; | 832 VLOG(1) << "Unloaded registry hive for " << profile_sid; |
833 else | 833 else |
834 LOG(ERROR) << "Error unloading registry hive for " << profile_sid; | 834 LOG(ERROR) << "Error unloading registry hive for " << profile_sid; |
835 } | 835 } |
836 } | 836 } |
837 } | 837 } |
838 | 838 |
839 // Removes the persistent blacklist state for the current user. Note: this will | 839 // Removes the persistent blacklist state for the current user. Note: this will |
840 // not remove the state for users other than the one uninstalling chrome on a | 840 // not remove the state for users other than the one uninstalling Chrome on a |
841 // system-level install (http://crbug.com/388725). Doing so would require | 841 // system-level install (http://crbug.com/388725). Doing so would require |
842 // extracting the per-user registry hive iteration from | 842 // extracting the per-user registry hive iteration from |
843 // UninstallActiveSetupEntries so that it could service multiple tasks. | 843 // UninstallActiveSetupEntries so that it could service multiple tasks. |
844 void RemoveBlacklistState() { | 844 void RemoveBlacklistState() { |
845 InstallUtil::DeleteRegistryKey(HKEY_CURRENT_USER, | 845 InstallUtil::DeleteRegistryKey(HKEY_CURRENT_USER, |
846 blacklist::kRegistryBeaconPath, | 846 blacklist::kRegistryBeaconPath, |
847 0); // wow64_access | 847 0); // wow64_access |
848 InstallUtil::DeleteRegistryKey(HKEY_CURRENT_USER, | 848 InstallUtil::DeleteRegistryKey(HKEY_CURRENT_USER, |
849 blacklist::kRegistryFinchListPath, | 849 blacklist::kRegistryFinchListPath, |
850 0); // wow64_access | 850 0); // wow64_access |
851 } | 851 } |
852 | 852 |
853 // Removes the persistent state for |distribution| for the current user. Note: | |
854 // this will not remove the state for users other than the one uninstalling | |
855 // Chrome on a system-level install; see RemoveBlacklistState for details. | |
robertshield
2015/09/01 14:20:12
This deletes all persistent state, more than just
grt (UTC plus 2)
2015/09/03 18:12:06
No, I didn't. As a policy, I believe that selectin
| |
856 void RemoveDistributionRegistryState(BrowserDistribution* distribution) { | |
857 base::string16 key_name(L"Software\\"); | |
858 key_name += distribution->GetInstallSubDir(); | |
859 InstallUtil::DeleteRegistryKey(HKEY_CURRENT_USER, key_name, KEY_WOW64_32KEY); | |
860 } | |
861 | |
853 } // namespace | 862 } // namespace |
854 | 863 |
855 DeleteResult DeleteChromeDirectoriesIfEmpty( | 864 DeleteResult DeleteChromeDirectoriesIfEmpty( |
856 const base::FilePath& application_directory) { | 865 const base::FilePath& application_directory) { |
857 DeleteResult result(DeleteEmptyDir(application_directory)); | 866 DeleteResult result(DeleteEmptyDir(application_directory)); |
858 if (result == DELETE_SUCCEEDED) { | 867 if (result == DELETE_SUCCEEDED) { |
859 // Now check and delete if the parent directories are empty | 868 // Now check and delete if the parent directories are empty |
860 // For example Google\Chrome or Chromium | 869 // For example Google\Chrome or Chromium |
861 const base::FilePath product_directory(application_directory.DirName()); | 870 const base::FilePath product_directory(application_directory.DirName()); |
862 if (!product_directory.empty()) { | 871 if (!product_directory.empty()) { |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1332 if (!installer_state.is_multi_install() || product.is_chrome_binaries()) { | 1341 if (!installer_state.is_multi_install() || product.is_chrome_binaries()) { |
1333 DeleteResult delete_result = DeleteChromeFilesAndFolders( | 1342 DeleteResult delete_result = DeleteChromeFilesAndFolders( |
1334 installer_state, base::MakeAbsoluteFilePath(setup_exe)); | 1343 installer_state, base::MakeAbsoluteFilePath(setup_exe)); |
1335 if (delete_result == DELETE_FAILED) { | 1344 if (delete_result == DELETE_FAILED) { |
1336 ret = installer::UNINSTALL_FAILED; | 1345 ret = installer::UNINSTALL_FAILED; |
1337 } else if (delete_result == DELETE_REQUIRES_REBOOT) { | 1346 } else if (delete_result == DELETE_REQUIRES_REBOOT) { |
1338 ret = installer::UNINSTALL_REQUIRES_REBOOT; | 1347 ret = installer::UNINSTALL_REQUIRES_REBOOT; |
1339 } | 1348 } |
1340 } | 1349 } |
1341 | 1350 |
1342 if (delete_profile) | 1351 if (delete_profile) { |
1343 DeleteUserDataDir(user_data_dir, product.is_chrome_frame()); | 1352 DeleteUserDataDir(user_data_dir, product.is_chrome_frame()); |
1353 RemoveDistributionRegistryState(browser_dist); | |
1354 } | |
1344 | 1355 |
1345 if (!force_uninstall) { | 1356 if (!force_uninstall) { |
1346 VLOG(1) << "Uninstallation complete. Launching post-uninstall operations."; | 1357 VLOG(1) << "Uninstallation complete. Launching post-uninstall operations."; |
1347 browser_dist->DoPostUninstallOperations(product_state->version(), | 1358 browser_dist->DoPostUninstallOperations(product_state->version(), |
1348 backup_state_file, distribution_data); | 1359 backup_state_file, distribution_data); |
1349 } | 1360 } |
1350 | 1361 |
1351 // Try and delete the preserved local state once the post-install | 1362 // Try and delete the preserved local state once the post-install |
1352 // operations are complete. | 1363 // operations are complete. |
1353 if (!backup_state_file.empty()) | 1364 if (!backup_state_file.empty()) |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1419 // If we need a reboot to continue, schedule the parent directories for | 1430 // If we need a reboot to continue, schedule the parent directories for |
1420 // deletion unconditionally. If they are not empty, the session manager | 1431 // deletion unconditionally. If they are not empty, the session manager |
1421 // will not delete them on reboot. | 1432 // will not delete them on reboot. |
1422 ScheduleParentAndGrandparentForDeletion(target_path); | 1433 ScheduleParentAndGrandparentForDeletion(target_path); |
1423 } else if (DeleteChromeDirectoriesIfEmpty(target_path) == DELETE_FAILED) { | 1434 } else if (DeleteChromeDirectoriesIfEmpty(target_path) == DELETE_FAILED) { |
1424 *uninstall_status = UNINSTALL_FAILED; | 1435 *uninstall_status = UNINSTALL_FAILED; |
1425 } | 1436 } |
1426 } | 1437 } |
1427 | 1438 |
1428 } // namespace installer | 1439 } // namespace installer |
OLD | NEW |