OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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" |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 return installer_util::UNINSTALL_DELETE_PROFILE; | 332 return installer_util::UNINSTALL_DELETE_PROFILE; |
333 } | 333 } |
334 } else { | 334 } else { |
335 LOG(ERROR) << "Failed to launch chrome.exe for uninstall confirmation."; | 335 LOG(ERROR) << "Failed to launch chrome.exe for uninstall confirmation."; |
336 } | 336 } |
337 | 337 |
338 return installer_util::UNINSTALL_CONFIRMED; | 338 return installer_util::UNINSTALL_CONFIRMED; |
339 } | 339 } |
340 | 340 |
341 bool ShouldDeleteProfile(const CommandLine& cmd_line, | 341 bool ShouldDeleteProfile(const CommandLine& cmd_line, |
342 installer_util::InstallStatus status) { | 342 installer_util::InstallStatus status, |
| 343 bool system_uninstall) { |
343 bool should_delete = false; | 344 bool should_delete = false; |
344 | 345 |
345 // Chrome Frame uninstallations always want to delete the profile (we have no | 346 // Chrome Frame uninstallations always want to delete the profile (we have no |
346 // UI to prompt otherwise and the profile stores no useful data anyway) | 347 // UI to prompt otherwise and the profile stores no useful data anyway) |
347 // unless they are managed by MSI. MSI uninstalls will explicitly include | 348 // unless they are managed by MSI. MSI uninstalls will explicitly include |
348 // the --delete-profile flag to distinguish them from MSI upgrades. | 349 // the --delete-profile flag to distinguish them from MSI upgrades. |
349 if (InstallUtil::IsChromeFrameProcess() && !InstallUtil::IsMSIProcess()) { | 350 if (InstallUtil::IsChromeFrameProcess() && |
| 351 !InstallUtil::IsMSIProcess(system_uninstall)) { |
350 should_delete = true; | 352 should_delete = true; |
351 } else { | 353 } else { |
352 should_delete = | 354 should_delete = |
353 status == installer_util::UNINSTALL_DELETE_PROFILE || | 355 status == installer_util::UNINSTALL_DELETE_PROFILE || |
354 cmd_line.HasSwitch(installer_util::switches::kDeleteProfile); | 356 cmd_line.HasSwitch(installer_util::switches::kDeleteProfile); |
355 } | 357 } |
356 | 358 |
357 return should_delete; | 359 return should_delete; |
358 } | 360 } |
359 | 361 |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 dll_list->Do(); | 564 dll_list->Do(); |
563 } | 565 } |
564 } | 566 } |
565 } | 567 } |
566 | 568 |
567 if (!installed_version.get()) | 569 if (!installed_version.get()) |
568 return installer_util::UNINSTALL_SUCCESSFUL; | 570 return installer_util::UNINSTALL_SUCCESSFUL; |
569 | 571 |
570 // Finally delete all the files from Chrome folder after moving setup.exe | 572 // Finally delete all the files from Chrome folder after moving setup.exe |
571 // and the user's Local State to a temp location. | 573 // and the user's Local State to a temp location. |
572 bool delete_profile = ShouldDeleteProfile(cmd_line, status); | 574 bool delete_profile = ShouldDeleteProfile(cmd_line, status, system_uninstall); |
573 std::wstring local_state_path; | 575 std::wstring local_state_path; |
574 ret = installer_util::UNINSTALL_SUCCESSFUL; | 576 ret = installer_util::UNINSTALL_SUCCESSFUL; |
575 | 577 |
576 DeleteResult delete_result = DeleteFilesAndFolders(exe_path, | 578 DeleteResult delete_result = DeleteFilesAndFolders(exe_path, |
577 system_uninstall, *installed_version, &local_state_path, delete_profile); | 579 system_uninstall, *installed_version, &local_state_path, delete_profile); |
578 if (delete_result == DELETE_FAILED) { | 580 if (delete_result == DELETE_FAILED) { |
579 ret = installer_util::UNINSTALL_FAILED; | 581 ret = installer_util::UNINSTALL_FAILED; |
580 } else if (delete_result == DELETE_REQUIRES_REBOOT) { | 582 } else if (delete_result == DELETE_REQUIRES_REBOOT) { |
581 ret = installer_util::UNINSTALL_REQUIRES_REBOOT; | 583 ret = installer_util::UNINSTALL_REQUIRES_REBOOT; |
582 } | 584 } |
583 | 585 |
584 if (!force_uninstall) { | 586 if (!force_uninstall) { |
585 LOG(INFO) << "Uninstallation complete. Launching Uninstall survey."; | 587 LOG(INFO) << "Uninstallation complete. Launching Uninstall survey."; |
586 dist->DoPostUninstallOperations(*installed_version, local_state_path, | 588 dist->DoPostUninstallOperations(*installed_version, local_state_path, |
587 distribution_data); | 589 distribution_data); |
588 } | 590 } |
589 | 591 |
590 // Try and delete the preserved local state once the post-install | 592 // Try and delete the preserved local state once the post-install |
591 // operations are complete. | 593 // operations are complete. |
592 if (!local_state_path.empty()) | 594 if (!local_state_path.empty()) |
593 file_util::Delete(local_state_path, false); | 595 file_util::Delete(local_state_path, false); |
594 | 596 |
595 return ret; | 597 return ret; |
596 } | 598 } |
OLD | NEW |