Chromium Code Reviews| 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 #include <stddef.h> | 10 #include <stddef.h> |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 433 // Removes XP-era filetype registration making Chrome the default browser. | 433 // Removes XP-era filetype registration making Chrome the default browser. |
| 434 // MSDN (see http://msdn.microsoft.com/library/windows/desktop/cc144148.aspx) | 434 // MSDN (see http://msdn.microsoft.com/library/windows/desktop/cc144148.aspx) |
| 435 // tells us not to do this, but certain applications break following | 435 // tells us not to do this, but certain applications break following |
| 436 // uninstallation if we don't. | 436 // uninstallation if we don't. |
| 437 void RemoveFiletypeRegistration(const InstallerState& installer_state, | 437 void RemoveFiletypeRegistration(const InstallerState& installer_state, |
| 438 HKEY root, | 438 HKEY root, |
| 439 const base::string16& browser_entry_suffix) { | 439 const base::string16& browser_entry_suffix) { |
| 440 base::string16 classes_path(ShellUtil::kRegClasses); | 440 base::string16 classes_path(ShellUtil::kRegClasses); |
| 441 classes_path.push_back(base::FilePath::kSeparators[0]); | 441 classes_path.push_back(base::FilePath::kSeparators[0]); |
| 442 | 442 |
| 443 BrowserDistribution* distribution = BrowserDistribution::GetDistribution(); | 443 const base::string16 prog_id(install_static::GetProgIdPrefix() + |
| 444 const base::string16 prog_id( | 444 browser_entry_suffix); |
| 445 distribution->GetBrowserProgIdPrefix() + browser_entry_suffix); | |
| 446 | 445 |
| 447 // Delete each filetype association if it references this Chrome. Take care | 446 // Delete each filetype association if it references this Chrome. Take care |
| 448 // not to delete the association if it references a system-level install of | 447 // not to delete the association if it references a system-level install of |
| 449 // Chrome (only a risk if the suffix is empty). Don't delete the whole key | 448 // Chrome (only a risk if the suffix is empty). Don't delete the whole key |
| 450 // since other apps may have stored data there. | 449 // since other apps may have stored data there. |
| 451 std::vector<const wchar_t*> cleared_assocs; | 450 std::vector<const wchar_t*> cleared_assocs; |
| 452 if (installer_state.system_install() || | 451 if (installer_state.system_install() || |
| 453 !browser_entry_suffix.empty() || | 452 !browser_entry_suffix.empty() || |
| 454 !base::win::RegKey(HKEY_LOCAL_MACHINE, (classes_path + prog_id).c_str(), | 453 !base::win::RegKey(HKEY_LOCAL_MACHINE, (classes_path + prog_id).c_str(), |
| 455 KEY_QUERY_VALUE).Valid()) { | 454 KEY_QUERY_VALUE).Valid()) { |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 632 DCHECK(exit_code); | 631 DCHECK(exit_code); |
| 633 if (dist->GetDefaultBrowserControlPolicy() == | 632 if (dist->GetDefaultBrowserControlPolicy() == |
| 634 BrowserDistribution::DEFAULT_BROWSER_UNSUPPORTED) { | 633 BrowserDistribution::DEFAULT_BROWSER_UNSUPPORTED) { |
| 635 // We should have never set those keys. | 634 // We should have never set those keys. |
| 636 return true; | 635 return true; |
| 637 } | 636 } |
| 638 | 637 |
| 639 base::FilePath chrome_exe(installer_state.target_path().Append(kChromeExe)); | 638 base::FilePath chrome_exe(installer_state.target_path().Append(kChromeExe)); |
| 640 | 639 |
| 641 // Delete Software\Classes\ChromeHTML. | 640 // Delete Software\Classes\ChromeHTML. |
| 642 const base::string16 prog_id( | 641 DCHECK_EQ(BrowserDistribution::GetDistribution(), dist); |
|
huangs
2017/03/21 15:35:48
|dist| gets used on line 632. Move the DCHECK ther
grt (UTC plus 2)
2017/03/22 08:03:36
I have it here because it's relevant for the call
| |
| 643 dist->GetBrowserProgIdPrefix() + browser_entry_suffix); | 642 const base::string16 prog_id(install_static::GetProgIdPrefix() + |
| 643 browser_entry_suffix); | |
| 644 base::string16 reg_prog_id(ShellUtil::kRegClasses); | 644 base::string16 reg_prog_id(ShellUtil::kRegClasses); |
| 645 reg_prog_id.push_back(base::FilePath::kSeparators[0]); | 645 reg_prog_id.push_back(base::FilePath::kSeparators[0]); |
| 646 reg_prog_id.append(prog_id); | 646 reg_prog_id.append(prog_id); |
| 647 InstallUtil::DeleteRegistryKey(root, reg_prog_id, WorkItem::kWow64Default); | 647 InstallUtil::DeleteRegistryKey(root, reg_prog_id, WorkItem::kWow64Default); |
| 648 | 648 |
| 649 // Delete Software\Classes\Chrome. | 649 // Delete Software\Classes\Chrome. |
| 650 base::string16 reg_app_id(ShellUtil::kRegClasses); | 650 base::string16 reg_app_id(ShellUtil::kRegClasses); |
| 651 reg_app_id.push_back(base::FilePath::kSeparators[0]); | 651 reg_app_id.push_back(base::FilePath::kSeparators[0]); |
| 652 // Append the requested suffix manually here (as ShellUtil::GetBrowserModelId | 652 // Append the requested suffix manually here (as ShellUtil::GetBrowserModelId |
| 653 // would otherwise try to figure out the currently installed suffix). | 653 // would otherwise try to figure out the currently installed suffix). |
| 654 DCHECK_EQ(BrowserDistribution::GetDistribution(), dist); | 654 DCHECK_EQ(BrowserDistribution::GetDistribution(), dist); |
|
huangs
2017/03/21 15:35:48
This check is now redundant.
grt (UTC plus 2)
2017/03/22 08:03:36
Done.
| |
| 655 reg_app_id.append(install_static::GetBaseAppId() + browser_entry_suffix); | 655 reg_app_id.append(install_static::GetBaseAppId() + browser_entry_suffix); |
| 656 InstallUtil::DeleteRegistryKey(root, reg_app_id, WorkItem::kWow64Default); | 656 InstallUtil::DeleteRegistryKey(root, reg_app_id, WorkItem::kWow64Default); |
| 657 | 657 |
| 658 // Delete all Start Menu Internet registrations that refer to this Chrome. | 658 // Delete all Start Menu Internet registrations that refer to this Chrome. |
| 659 { | 659 { |
| 660 using base::win::RegistryKeyIterator; | 660 using base::win::RegistryKeyIterator; |
| 661 InstallUtil::ProgramCompare open_command_pred(chrome_exe); | 661 InstallUtil::ProgramCompare open_command_pred(chrome_exe); |
| 662 base::string16 client_name; | 662 base::string16 client_name; |
| 663 base::string16 client_key; | 663 base::string16 client_key; |
| 664 base::string16 open_key; | 664 base::string16 open_key; |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1103 // If we need a reboot to continue, schedule the parent directories for | 1103 // If we need a reboot to continue, schedule the parent directories for |
| 1104 // deletion unconditionally. If they are not empty, the session manager | 1104 // deletion unconditionally. If they are not empty, the session manager |
| 1105 // will not delete them on reboot. | 1105 // will not delete them on reboot. |
| 1106 ScheduleParentAndGrandparentForDeletion(target_path); | 1106 ScheduleParentAndGrandparentForDeletion(target_path); |
| 1107 } else if (DeleteChromeDirectoriesIfEmpty(target_path) == DELETE_FAILED) { | 1107 } else if (DeleteChromeDirectoriesIfEmpty(target_path) == DELETE_FAILED) { |
| 1108 *uninstall_status = UNINSTALL_FAILED; | 1108 *uninstall_status = UNINSTALL_FAILED; |
| 1109 } | 1109 } |
| 1110 } | 1110 } |
| 1111 | 1111 |
| 1112 } // namespace installer | 1112 } // namespace installer |
| OLD | NEW |