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 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 // Removes XP-era filetype registration making Chrome the default browser. | 679 // Removes XP-era filetype registration making Chrome the default browser. |
680 // MSDN (see http://msdn.microsoft.com/library/windows/desktop/cc144148.aspx) | 680 // MSDN (see http://msdn.microsoft.com/library/windows/desktop/cc144148.aspx) |
681 // tells us not to do this, but certain applications break following | 681 // tells us not to do this, but certain applications break following |
682 // uninstallation if we don't. | 682 // uninstallation if we don't. |
683 void RemoveFiletypeRegistration(const InstallerState& installer_state, | 683 void RemoveFiletypeRegistration(const InstallerState& installer_state, |
684 HKEY root, | 684 HKEY root, |
685 const string16& browser_entry_suffix) { | 685 const string16& browser_entry_suffix) { |
686 string16 classes_path(ShellUtil::kRegClasses); | 686 string16 classes_path(ShellUtil::kRegClasses); |
687 classes_path.push_back(base::FilePath::kSeparators[0]); | 687 classes_path.push_back(base::FilePath::kSeparators[0]); |
688 | 688 |
689 const string16 prog_id(ShellUtil::kChromeHTMLProgId + browser_entry_suffix); | 689 const string16 prog_id(ShellUtil::GetBrowserProgIdPrefix() + |
| 690 browser_entry_suffix); |
690 | 691 |
691 // Delete each filetype association if it references this Chrome. Take care | 692 // Delete each filetype association if it references this Chrome. Take care |
692 // not to delete the association if it references a system-level install of | 693 // not to delete the association if it references a system-level install of |
693 // Chrome (only a risk if the suffix is empty). Don't delete the whole key | 694 // Chrome (only a risk if the suffix is empty). Don't delete the whole key |
694 // since other apps may have stored data there. | 695 // since other apps may have stored data there. |
695 std::vector<const wchar_t*> cleared_assocs; | 696 std::vector<const wchar_t*> cleared_assocs; |
696 if (installer_state.system_install() || | 697 if (installer_state.system_install() || |
697 !browser_entry_suffix.empty() || | 698 !browser_entry_suffix.empty() || |
698 !base::win::RegKey(HKEY_LOCAL_MACHINE, (classes_path + prog_id).c_str(), | 699 !base::win::RegKey(HKEY_LOCAL_MACHINE, (classes_path + prog_id).c_str(), |
699 KEY_QUERY_VALUE).Valid()) { | 700 KEY_QUERY_VALUE).Valid()) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 InstallStatus* exit_code) { | 753 InstallStatus* exit_code) { |
753 DCHECK(exit_code); | 754 DCHECK(exit_code); |
754 if (!dist->CanSetAsDefault()) { | 755 if (!dist->CanSetAsDefault()) { |
755 // We should have never set those keys. | 756 // We should have never set those keys. |
756 return true; | 757 return true; |
757 } | 758 } |
758 | 759 |
759 base::FilePath chrome_exe(installer_state.target_path().Append(kChromeExe)); | 760 base::FilePath chrome_exe(installer_state.target_path().Append(kChromeExe)); |
760 | 761 |
761 // Delete Software\Classes\ChromeHTML. | 762 // Delete Software\Classes\ChromeHTML. |
762 const string16 prog_id(ShellUtil::kChromeHTMLProgId + browser_entry_suffix); | 763 const string16 prog_id(ShellUtil::GetBrowserProgIdPrefix() + |
| 764 browser_entry_suffix); |
763 string16 reg_prog_id(ShellUtil::kRegClasses); | 765 string16 reg_prog_id(ShellUtil::kRegClasses); |
764 reg_prog_id.push_back(base::FilePath::kSeparators[0]); | 766 reg_prog_id.push_back(base::FilePath::kSeparators[0]); |
765 reg_prog_id.append(prog_id); | 767 reg_prog_id.append(prog_id); |
766 InstallUtil::DeleteRegistryKey(root, reg_prog_id); | 768 InstallUtil::DeleteRegistryKey(root, reg_prog_id); |
767 | 769 |
768 // Delete Software\Classes\Chrome. | 770 // Delete Software\Classes\Chrome. |
769 string16 reg_app_id(ShellUtil::kRegClasses); | 771 string16 reg_app_id(ShellUtil::kRegClasses); |
770 reg_app_id.push_back(base::FilePath::kSeparators[0]); | 772 reg_app_id.push_back(base::FilePath::kSeparators[0]); |
771 // Append the requested suffix manually here (as ShellUtil::GetBrowserModelId | 773 // Append the requested suffix manually here (as ShellUtil::GetBrowserModelId |
772 // would otherwise try to figure out the currently installed suffix). | 774 // would otherwise try to figure out the currently installed suffix). |
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1427 // deletion unconditionally. If they are not empty, the session manager | 1429 // deletion unconditionally. If they are not empty, the session manager |
1428 // will not delete them on reboot. | 1430 // will not delete them on reboot. |
1429 ScheduleParentAndGrandparentForDeletion(target_path); | 1431 ScheduleParentAndGrandparentForDeletion(target_path); |
1430 } else if (DeleteApplicationProductAndVendorDirectories(target_path) == | 1432 } else if (DeleteApplicationProductAndVendorDirectories(target_path) == |
1431 installer::DELETE_FAILED) { | 1433 installer::DELETE_FAILED) { |
1432 *uninstall_status = installer::UNINSTALL_FAILED; | 1434 *uninstall_status = installer::UNINSTALL_FAILED; |
1433 } | 1435 } |
1434 } | 1436 } |
1435 | 1437 |
1436 } // namespace installer | 1438 } // namespace installer |
OLD | NEW |