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 <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 string16 old_style_suffix; |
| 537 // An unsuffixed appid used to be registered on some user-level install | 537 if (browser_entry_suffix.empty() || |
| 538 // (dev-channel 21.0.1171.0). Make sure it gets cleaned up here. | 538 (ShellUtil::GetOldUserSpecificRegistrySuffix(&old_style_suffix) && |
| 539 browser_entry_suffix.compare(old_style_suffix) == 0)) { | |
|
robertshield
2012/06/27 02:22:29
on uninstall, should we not just unconditionally a
gab
2012/06/27 03:56:56
This would be more work in most cases, but I agree
grt (UTC plus 2)
2012/06/27 15:47:32
nit: i think "browser_entry_suffix == old_style_su
gab
2012/07/03 22:36:06
Done.
gab
2012/07/03 22:36:06
I removed this to always suffix with the passed in
grt (UTC plus 2)
2012/07/05 20:00:19
Does this mean old values will be left behind now?
gab
2012/07/05 21:19:53
No, it means I'm using the browser_entry_suffix pa
| |
| 540 // Some appids were incorrectly registered (unsuffixed in dev-channel | |
| 541 // 21.0.1171.0 and username suffixed in dev 21.0.1180.0). | |
| 542 // Make sure the bad registrations get cleaned up here if they are present. | |
| 539 // Note: this couldn't be cleaned on update as a currently running old | 543 // 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 | 544 // chrome might still be using the bad appid when the registration update |
| 541 // update steps run. | 545 // steps run. |
| 542 InstallUtil::DeleteRegistryKey(root, chrome_app_id + dist->GetBaseAppId()); | 546 InstallUtil::DeleteRegistryKey( |
| 547 root, chrome_app_id + dist->GetBaseAppId() + browser_entry_suffix); | |
| 543 } | 548 } |
| 544 chrome_app_id.append(ShellUtil::GetBrowserModelId(dist, chrome_exe.value())); | 549 chrome_app_id.append(ShellUtil::GetBrowserModelId(dist, chrome_exe.value())); |
| 545 InstallUtil::DeleteRegistryKey(root, chrome_app_id); | 550 InstallUtil::DeleteRegistryKey(root, chrome_app_id); |
| 546 | 551 |
| 547 // Delete all Start Menu Internet registrations that refer to this Chrome. | 552 // Delete all Start Menu Internet registrations that refer to this Chrome. |
| 548 { | 553 { |
| 549 using base::win::RegistryKeyIterator; | 554 using base::win::RegistryKeyIterator; |
| 550 InstallUtil::ProgramCompare open_command_pred(chrome_exe); | 555 InstallUtil::ProgramCompare open_command_pred(chrome_exe); |
| 551 string16 client_name; | 556 string16 client_name; |
| 552 string16 client_key; | 557 string16 client_key; |
| (...skipping 249 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 | 807 // 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 | 808 // 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 | 809 // 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 | 810 // 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 | 811 // suffixed when fully registered in HKLM (e.g. when later making Chrome |
| 807 // default through the UI)). | 812 // default through the UI)). |
| 808 // Remove remaining HKCU entries with no suffix if any. | 813 // Remove remaining HKCU entries with no suffix if any. |
| 809 if (!suffix.empty()) { | 814 if (!suffix.empty()) { |
| 810 DeleteChromeRegistrationKeys(browser_dist, HKEY_CURRENT_USER, string16(), | 815 DeleteChromeRegistrationKeys(browser_dist, HKEY_CURRENT_USER, string16(), |
| 811 installer_state.target_path(), &ret); | 816 installer_state.target_path(), &ret); |
| 817 | |
| 818 // For similar reasons it is possible in very few installs (from 21.0.1180.0 | |
| 819 // and fixed shortly after) to be installed with the new-style suffix, but | |
| 820 // have some old-style suffix registrations left behind. | |
| 821 string16 old_style_suffix; | |
| 822 if (ShellUtil::GetOldUserSpecificRegistrySuffix(&old_style_suffix) && | |
| 823 suffix.compare(old_style_suffix) != 0) { | |
|
grt (UTC plus 2)
2012/06/27 15:47:32
same nit as above: "suffix != old_style_suffix" is
gab
2012/07/03 22:36:06
Done.
| |
| 824 DeleteChromeRegistrationKeys(browser_dist, HKEY_CURRENT_USER, | |
| 825 old_style_suffix, | |
| 826 installer_state.target_path(), &ret); | |
| 827 } | |
| 812 } | 828 } |
| 813 | 829 |
| 814 // Chrome is registered in HKLM for all system-level installs and for | 830 // 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. | 831 // user-level installs for which Chrome has been made the default browser. |
| 816 // Always remove the HKLM registration for system-level installs. For | 832 // 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 | 833 // 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 | 834 // 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 | 835 // 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 | 836 // made Chrome their default browser (i.e. has shell integration entries |
| 821 // registered with |suffix| (note: |suffix| will be the empty string if | 837 // 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 | 973 |
| 958 // Try and delete the preserved local state once the post-install | 974 // Try and delete the preserved local state once the post-install |
| 959 // operations are complete. | 975 // operations are complete. |
| 960 if (!backup_state_file.empty()) | 976 if (!backup_state_file.empty()) |
| 961 file_util::Delete(backup_state_file, false); | 977 file_util::Delete(backup_state_file, false); |
| 962 | 978 |
| 963 return ret; | 979 return ret; |
| 964 } | 980 } |
| 965 | 981 |
| 966 } // namespace installer | 982 } // namespace installer |
| OLD | NEW |