| 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 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 // Removes XP-era filetype registration making Chrome the default browser. | 729 // Removes XP-era filetype registration making Chrome the default browser. |
| 730 // MSDN (see http://msdn.microsoft.com/library/windows/desktop/cc144148.aspx) | 730 // MSDN (see http://msdn.microsoft.com/library/windows/desktop/cc144148.aspx) |
| 731 // tells us not to do this, but certain applications break following | 731 // tells us not to do this, but certain applications break following |
| 732 // uninstallation if we don't. | 732 // uninstallation if we don't. |
| 733 void RemoveFiletypeRegistration(const InstallerState& installer_state, | 733 void RemoveFiletypeRegistration(const InstallerState& installer_state, |
| 734 HKEY root, | 734 HKEY root, |
| 735 const string16& browser_entry_suffix) { | 735 const string16& browser_entry_suffix) { |
| 736 string16 classes_path(ShellUtil::kRegClasses); | 736 string16 classes_path(ShellUtil::kRegClasses); |
| 737 classes_path.push_back(base::FilePath::kSeparators[0]); | 737 classes_path.push_back(base::FilePath::kSeparators[0]); |
| 738 | 738 |
| 739 const string16 prog_id(ShellUtil::kChromeHTMLProgId + browser_entry_suffix); | 739 BrowserDistribution* distribution = BrowserDistribution::GetDistribution(); |
| 740 const string16 prog_id(distribution->GetBrowserProgIdPrefix() + |
| 741 browser_entry_suffix); |
| 740 | 742 |
| 741 // Delete each filetype association if it references this Chrome. Take care | 743 // Delete each filetype association if it references this Chrome. Take care |
| 742 // not to delete the association if it references a system-level install of | 744 // not to delete the association if it references a system-level install of |
| 743 // Chrome (only a risk if the suffix is empty). Don't delete the whole key | 745 // Chrome (only a risk if the suffix is empty). Don't delete the whole key |
| 744 // since other apps may have stored data there. | 746 // since other apps may have stored data there. |
| 745 std::vector<const wchar_t*> cleared_assocs; | 747 std::vector<const wchar_t*> cleared_assocs; |
| 746 if (installer_state.system_install() || | 748 if (installer_state.system_install() || |
| 747 !browser_entry_suffix.empty() || | 749 !browser_entry_suffix.empty() || |
| 748 !base::win::RegKey(HKEY_LOCAL_MACHINE, (classes_path + prog_id).c_str(), | 750 !base::win::RegKey(HKEY_LOCAL_MACHINE, (classes_path + prog_id).c_str(), |
| 749 KEY_QUERY_VALUE).Valid()) { | 751 KEY_QUERY_VALUE).Valid()) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 } | 796 } |
| 795 } | 797 } |
| 796 } | 798 } |
| 797 | 799 |
| 798 bool DeleteChromeRegistrationKeys(const InstallerState& installer_state, | 800 bool DeleteChromeRegistrationKeys(const InstallerState& installer_state, |
| 799 BrowserDistribution* dist, | 801 BrowserDistribution* dist, |
| 800 HKEY root, | 802 HKEY root, |
| 801 const string16& browser_entry_suffix, | 803 const string16& browser_entry_suffix, |
| 802 InstallStatus* exit_code) { | 804 InstallStatus* exit_code) { |
| 803 DCHECK(exit_code); | 805 DCHECK(exit_code); |
| 804 if (!dist->CanSetAsDefault()) { | 806 if (!dist->IsSetAsDefaultSupported()) { |
| 805 // We should have never set those keys. | 807 // We should have never set those keys. |
| 806 return true; | 808 return true; |
| 807 } | 809 } |
| 808 | 810 |
| 809 base::FilePath chrome_exe(installer_state.target_path().Append(kChromeExe)); | 811 base::FilePath chrome_exe(installer_state.target_path().Append(kChromeExe)); |
| 810 | 812 |
| 811 // Delete Software\Classes\ChromeHTML. | 813 // Delete Software\Classes\ChromeHTML. |
| 812 const string16 prog_id(ShellUtil::kChromeHTMLProgId + browser_entry_suffix); | 814 const string16 prog_id(dist->GetBrowserProgIdPrefix() + |
| 815 browser_entry_suffix); |
| 813 string16 reg_prog_id(ShellUtil::kRegClasses); | 816 string16 reg_prog_id(ShellUtil::kRegClasses); |
| 814 reg_prog_id.push_back(base::FilePath::kSeparators[0]); | 817 reg_prog_id.push_back(base::FilePath::kSeparators[0]); |
| 815 reg_prog_id.append(prog_id); | 818 reg_prog_id.append(prog_id); |
| 816 InstallUtil::DeleteRegistryKey(root, reg_prog_id); | 819 InstallUtil::DeleteRegistryKey(root, reg_prog_id); |
| 817 | 820 |
| 818 // Delete Software\Classes\Chrome. | 821 // Delete Software\Classes\Chrome. |
| 819 string16 reg_app_id(ShellUtil::kRegClasses); | 822 string16 reg_app_id(ShellUtil::kRegClasses); |
| 820 reg_app_id.push_back(base::FilePath::kSeparators[0]); | 823 reg_app_id.push_back(base::FilePath::kSeparators[0]); |
| 821 // Append the requested suffix manually here (as ShellUtil::GetBrowserModelId | 824 // Append the requested suffix manually here (as ShellUtil::GetBrowserModelId |
| 822 // would otherwise try to figure out the currently installed suffix). | 825 // would otherwise try to figure out the currently installed suffix). |
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1497 // deletion unconditionally. If they are not empty, the session manager | 1500 // deletion unconditionally. If they are not empty, the session manager |
| 1498 // will not delete them on reboot. | 1501 // will not delete them on reboot. |
| 1499 ScheduleParentAndGrandparentForDeletion(target_path); | 1502 ScheduleParentAndGrandparentForDeletion(target_path); |
| 1500 } else if (DeleteApplicationProductAndVendorDirectories(target_path) == | 1503 } else if (DeleteApplicationProductAndVendorDirectories(target_path) == |
| 1501 installer::DELETE_FAILED) { | 1504 installer::DELETE_FAILED) { |
| 1502 *uninstall_status = installer::UNINSTALL_FAILED; | 1505 *uninstall_status = installer::UNINSTALL_FAILED; |
| 1503 } | 1506 } |
| 1504 } | 1507 } |
| 1505 | 1508 |
| 1506 } // namespace installer | 1509 } // namespace installer |
| OLD | NEW |