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 | 10 |
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 742 *proto != NULL; | 742 *proto != NULL; |
| 743 ++proto) { | 743 ++proto) { |
| 744 parent_key.resize(base_length); | 744 parent_key.resize(base_length); |
| 745 parent_key.push_back(FilePath::kSeparators[0]); | 745 parent_key.push_back(FilePath::kSeparators[0]); |
| 746 parent_key.append(*proto); | 746 parent_key.append(*proto); |
| 747 child_key.assign(parent_key).append(ShellUtil::kRegShellOpen); | 747 child_key.assign(parent_key).append(ShellUtil::kRegShellOpen); |
| 748 InstallUtil::DeleteRegistryKeyIf(root, parent_key, child_key, L"", | 748 InstallUtil::DeleteRegistryKeyIf(root, parent_key, child_key, L"", |
| 749 open_command_pred); | 749 open_command_pred); |
| 750 } | 750 } |
| 751 | 751 |
| 752 // Delete each filetype association if it references this Chrome. Don't | |
| 753 // delete the whole key since other apps may have stored data there. | |
| 754 InstallUtil::ValueEquals prog_id_pred(prog_id); | |
|
gab
2012/09/19 16:11:16
|prog_id| here could be suffixed and unsuffixed (b
grt (UTC plus 2)
2012/09/19 19:43:15
Great catch. Updated as discussed.
| |
| 755 for (const wchar_t* const* filetype = &ShellUtil::kFileAssociations[0]; | |
|
gab
2012/09/19 16:11:16
I feel this is overly complicated to loop through
grt (UTC plus 2)
2012/09/19 19:43:15
The size of the array isn't known here as it is in
gab
2012/09/19 19:58:50
Hmmm, the suggested code doesn't depend on the siz
grt (UTC plus 2)
2012/09/19 20:04:52
Oh, I see. I read the suggestion as knowing array
| |
| 756 *filetype != NULL; ++filetype) { | |
| 757 parent_key.resize(base_length); | |
| 758 parent_key.push_back(FilePath::kSeparators[0]); | |
|
gab
2012/09/19 16:11:16
If |parent_key| is always going to have the separa
grt (UTC plus 2)
2012/09/19 19:43:15
Done.
| |
| 759 parent_key.append(*filetype); | |
| 760 InstallUtil::DeleteRegistryValueIf(root, parent_key.c_str(), L"", | |
|
gab
2012/09/19 16:11:16
optional: I don't like that this method takes wcha
grt (UTC plus 2)
2012/09/19 19:43:15
Ignored. It's common to call this fn with a liter
| |
| 761 prog_id_pred); | |
| 762 } | |
| 763 | |
| 752 // Note that we do not attempt to delete filetype associations since MSDN | 764 // Note that we do not attempt to delete filetype associations since MSDN |
| 753 // says "Windows respects the Default value only if the ProgID found there is | 765 // says "Windows respects the Default value only if the ProgID found there is |
| 754 // a registered ProgID. If the ProgID is unregistered, it is ignored." | 766 // a registered ProgID. If the ProgID is unregistered, it is ignored." |
| 755 | 767 |
| 756 *exit_code = installer::UNINSTALL_SUCCESSFUL; | 768 *exit_code = installer::UNINSTALL_SUCCESSFUL; |
| 757 return true; | 769 return true; |
| 758 } | 770 } |
| 759 | 771 |
| 760 void RemoveChromeLegacyRegistryKeys(BrowserDistribution* dist, | 772 void RemoveChromeLegacyRegistryKeys(BrowserDistribution* dist, |
| 761 const string16& chrome_exe) { | 773 const string16& chrome_exe) { |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1042 installer_state.target_path(), &ret); | 1054 installer_state.target_path(), &ret); |
| 1043 | 1055 |
| 1044 // If the user's Chrome is registered with a suffix: it is possible that old | 1056 // If the user's Chrome is registered with a suffix: it is possible that old |
| 1045 // unsuffixed registrations were left in HKCU (e.g. if this install was | 1057 // unsuffixed registrations were left in HKCU (e.g. if this install was |
| 1046 // previously installed with no suffix in HKCU (old suffix rules if the user | 1058 // previously installed with no suffix in HKCU (old suffix rules if the user |
| 1047 // is not an admin (or declined UAC at first run)) and later had to be | 1059 // is not an admin (or declined UAC at first run)) and later had to be |
| 1048 // suffixed when fully registered in HKLM (e.g. when later making Chrome | 1060 // suffixed when fully registered in HKLM (e.g. when later making Chrome |
| 1049 // default through the UI)). | 1061 // default through the UI)). |
| 1050 // Remove remaining HKCU entries with no suffix if any. | 1062 // Remove remaining HKCU entries with no suffix if any. |
| 1051 if (!suffix.empty()) { | 1063 if (!suffix.empty()) { |
| 1052 DeleteChromeRegistrationKeys(browser_dist, HKEY_CURRENT_USER, string16(), | 1064 DeleteChromeRegistrationKeys(browser_dist, HKEY_CURRENT_USER, string16(), |
|
gab
2012/09/19 16:11:16
here.
| |
| 1053 installer_state.target_path(), &ret); | 1065 installer_state.target_path(), &ret); |
| 1054 | 1066 |
| 1055 // For similar reasons it is possible in very few installs (from | 1067 // For similar reasons it is possible in very few installs (from |
| 1056 // 21.0.1180.0 and fixed shortly after) to be installed with the new-style | 1068 // 21.0.1180.0 and fixed shortly after) to be installed with the new-style |
| 1057 // suffix, but have some old-style suffix registrations left behind. | 1069 // suffix, but have some old-style suffix registrations left behind. |
| 1058 string16 old_style_suffix; | 1070 string16 old_style_suffix; |
| 1059 if (ShellUtil::GetOldUserSpecificRegistrySuffix(&old_style_suffix) && | 1071 if (ShellUtil::GetOldUserSpecificRegistrySuffix(&old_style_suffix) && |
| 1060 suffix != old_style_suffix) { | 1072 suffix != old_style_suffix) { |
| 1061 DeleteChromeRegistrationKeys(browser_dist, HKEY_CURRENT_USER, | 1073 DeleteChromeRegistrationKeys(browser_dist, HKEY_CURRENT_USER, |
| 1062 old_style_suffix, | 1074 old_style_suffix, |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 1089 | 1101 |
| 1090 ProcessDelegateExecuteWorkItems(installer_state, product); | 1102 ProcessDelegateExecuteWorkItems(installer_state, product); |
| 1091 | 1103 |
| 1092 ProcessOnOsUpgradeWorkItems(installer_state, product); | 1104 ProcessOnOsUpgradeWorkItems(installer_state, product); |
| 1093 | 1105 |
| 1094 // TODO(gab): This is only disabled for M22 as the shortcut CL using Active | 1106 // TODO(gab): This is only disabled for M22 as the shortcut CL using Active |
| 1095 // Setup will not make it in M22. | 1107 // Setup will not make it in M22. |
| 1096 #if 0 | 1108 #if 0 |
| 1097 UninstallActiveSetupEntries(installer_state, product); | 1109 UninstallActiveSetupEntries(installer_state, product); |
| 1098 #endif | 1110 #endif |
| 1111 | |
| 1112 // Notify the shell that associations have changed since Chrome was likely | |
| 1113 // unregistered. | |
| 1114 SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL); | |
| 1099 } | 1115 } |
| 1100 | 1116 |
| 1101 if (product.is_chrome_frame()) { | 1117 if (product.is_chrome_frame()) { |
| 1102 ProcessChromeFrameWorkItems(original_state, installer_state, setup_path, | 1118 ProcessChromeFrameWorkItems(original_state, installer_state, setup_path, |
| 1103 product); | 1119 product); |
| 1104 } | 1120 } |
| 1105 | 1121 |
| 1106 if (installer_state.is_multi_install()) | 1122 if (installer_state.is_multi_install()) |
| 1107 ProcessGoogleUpdateItems(original_state, installer_state, product); | 1123 ProcessGoogleUpdateItems(original_state, installer_state, product); |
| 1108 | 1124 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1205 | 1221 |
| 1206 // Try and delete the preserved local state once the post-install | 1222 // Try and delete the preserved local state once the post-install |
| 1207 // operations are complete. | 1223 // operations are complete. |
| 1208 if (!backup_state_file.empty()) | 1224 if (!backup_state_file.empty()) |
| 1209 file_util::Delete(backup_state_file, false); | 1225 file_util::Delete(backup_state_file, false); |
| 1210 | 1226 |
| 1211 return ret; | 1227 return ret; |
| 1212 } | 1228 } |
| 1213 | 1229 |
| 1214 } // namespace installer | 1230 } // namespace installer |
| OLD | NEW |