| 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 <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 // well anyways. | 526 // well anyways. |
| 527 string16 html_prog_id(ShellUtil::kRegClasses); | 527 string16 html_prog_id(ShellUtil::kRegClasses); |
| 528 html_prog_id.push_back(FilePath::kSeparators[0]); | 528 html_prog_id.push_back(FilePath::kSeparators[0]); |
| 529 html_prog_id.append(ShellUtil::kChromeHTMLProgId); | 529 html_prog_id.append(ShellUtil::kChromeHTMLProgId); |
| 530 html_prog_id.append(browser_entry_suffix); | 530 html_prog_id.append(browser_entry_suffix); |
| 531 InstallUtil::DeleteRegistryKey(root, html_prog_id); | 531 InstallUtil::DeleteRegistryKey(root, html_prog_id); |
| 532 | 532 |
| 533 // Delete Software\Classes\Chrome (Same comment as above applies for this too) | 533 // Delete Software\Classes\Chrome (Same comment as above applies for this too) |
| 534 string16 chrome_app_id(ShellUtil::kRegClasses); | 534 string16 chrome_app_id(ShellUtil::kRegClasses); |
| 535 chrome_app_id.push_back(FilePath::kSeparators[0]); | 535 chrome_app_id.push_back(FilePath::kSeparators[0]); |
| 536 if (browser_entry_suffix.empty()) { | 536 // Append the requested suffix manually here (as ShellUtil::GetBrowserModelId |
| 537 // An unsuffixed appid used to be registered on some user-level install | 537 // would otherwise try to figure out the currently installed suffix). |
| 538 // (dev-channel 21.0.1171.0). Make sure it gets cleaned up here. | 538 chrome_app_id.append(dist->GetBaseAppId() + browser_entry_suffix); |
| 539 // Note: this couldn't be cleaned on update as a currently running old | |
| 540 // chrome might still be using the unsuffixed appid when the registration | |
| 541 // update steps run. | |
| 542 InstallUtil::DeleteRegistryKey(root, chrome_app_id + dist->GetBaseAppId()); | |
| 543 } | |
| 544 chrome_app_id.append(ShellUtil::GetBrowserModelId(dist, chrome_exe.value())); | |
| 545 InstallUtil::DeleteRegistryKey(root, chrome_app_id); | 539 InstallUtil::DeleteRegistryKey(root, chrome_app_id); |
| 546 | 540 |
| 547 // Delete all Start Menu Internet registrations that refer to this Chrome. | 541 // Delete all Start Menu Internet registrations that refer to this Chrome. |
| 548 { | 542 { |
| 549 using base::win::RegistryKeyIterator; | 543 using base::win::RegistryKeyIterator; |
| 550 InstallUtil::ProgramCompare open_command_pred(chrome_exe); | 544 InstallUtil::ProgramCompare open_command_pred(chrome_exe); |
| 551 string16 client_name; | 545 string16 client_name; |
| 552 string16 client_key; | 546 string16 client_key; |
| 553 string16 open_key; | 547 string16 open_key; |
| 554 for (RegistryKeyIterator iter(root, ShellUtil::kRegStartMenuInternet); | 548 for (RegistryKeyIterator iter(root, ShellUtil::kRegStartMenuInternet); |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 // If the user's Chrome is registered with a suffix: it is possible that old | 796 // If the user's Chrome is registered with a suffix: it is possible that old |
| 803 // unsuffixed registrations were left in HKCU (e.g. if this install was | 797 // unsuffixed registrations were left in HKCU (e.g. if this install was |
| 804 // previously installed with no suffix in HKCU (old suffix rules if the user | 798 // previously installed with no suffix in HKCU (old suffix rules if the user |
| 805 // is not an admin (or declined UAC at first run)) and later had to be | 799 // is not an admin (or declined UAC at first run)) and later had to be |
| 806 // suffixed when fully registered in HKLM (e.g. when later making Chrome | 800 // suffixed when fully registered in HKLM (e.g. when later making Chrome |
| 807 // default through the UI)). | 801 // default through the UI)). |
| 808 // Remove remaining HKCU entries with no suffix if any. | 802 // Remove remaining HKCU entries with no suffix if any. |
| 809 if (!suffix.empty()) { | 803 if (!suffix.empty()) { |
| 810 DeleteChromeRegistrationKeys(browser_dist, HKEY_CURRENT_USER, string16(), | 804 DeleteChromeRegistrationKeys(browser_dist, HKEY_CURRENT_USER, string16(), |
| 811 installer_state.target_path(), &ret); | 805 installer_state.target_path(), &ret); |
| 806 |
| 807 // For similar reasons it is possible in very few installs (from 21.0.1180.0 |
| 808 // and fixed shortly after) to be installed with the new-style suffix, but |
| 809 // have some old-style suffix registrations left behind. |
| 810 string16 old_style_suffix; |
| 811 if (ShellUtil::GetOldUserSpecificRegistrySuffix(&old_style_suffix) && |
| 812 suffix != old_style_suffix) { |
| 813 DeleteChromeRegistrationKeys(browser_dist, HKEY_CURRENT_USER, |
| 814 old_style_suffix, |
| 815 installer_state.target_path(), &ret); |
| 816 } |
| 812 } | 817 } |
| 813 | 818 |
| 814 // Chrome is registered in HKLM for all system-level installs and for | 819 // Chrome is registered in HKLM for all system-level installs and for |
| 815 // user-level installs for which Chrome has been made the default browser. | 820 // user-level installs for which Chrome has been made the default browser. |
| 816 // Always remove the HKLM registration for system-level installs. For | 821 // Always remove the HKLM registration for system-level installs. For |
| 817 // user-level installs, only remove it if both: 1) this uninstall isn't a self | 822 // user-level installs, only remove it if both: 1) this uninstall isn't a self |
| 818 // destruct following the installation of a system-level Chrome (because the | 823 // destruct following the installation of a system-level Chrome (because the |
| 819 // system-level Chrome owns the HKLM registration now), and 2) this user has | 824 // system-level Chrome owns the HKLM registration now), and 2) this user has |
| 820 // made Chrome their default browser (i.e. has shell integration entries | 825 // made Chrome their default browser (i.e. has shell integration entries |
| 821 // registered with |suffix| (note: |suffix| will be the empty string if | 826 // registered with |suffix| (note: |suffix| will be the empty string if |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 | 962 |
| 958 // Try and delete the preserved local state once the post-install | 963 // Try and delete the preserved local state once the post-install |
| 959 // operations are complete. | 964 // operations are complete. |
| 960 if (!backup_state_file.empty()) | 965 if (!backup_state_file.empty()) |
| 961 file_util::Delete(backup_state_file, false); | 966 file_util::Delete(backup_state_file, false); |
| 962 | 967 |
| 963 return ret; | 968 return ret; |
| 964 } | 969 } |
| 965 | 970 |
| 966 } // namespace installer | 971 } // namespace installer |
| OLD | NEW |