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 |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/base_paths.h" | 13 #include "base/base_paths.h" |
14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
15 #include "base/files/file_enumerator.h" | 15 #include "base/files/file_enumerator.h" |
16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
17 #include "base/process/kill.h" | 17 #include "base/process/kill.h" |
18 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
19 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
20 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
21 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
22 #include "base/win/registry.h" | 22 #include "base/win/registry.h" |
23 #include "base/win/scoped_handle.h" | 23 #include "base/win/scoped_handle.h" |
24 #include "base/win/shortcut.h" | 24 #include "base/win/shortcut.h" |
25 #include "base/win/windows_version.h" | 25 #include "base/win/windows_version.h" |
26 #include "chrome/common/chrome_constants.h" | 26 #include "chrome/common/chrome_constants.h" |
27 #include "chrome/common/chrome_paths.h" | 27 #include "chrome/common/chrome_paths.h" |
28 #include "chrome/common/chrome_result_codes.h" | 28 #include "chrome/common/chrome_result_codes.h" |
| 29 #include "chrome/installer/launcher_support/chrome_launcher_support.h" |
29 #include "chrome/installer/setup/install.h" | 30 #include "chrome/installer/setup/install.h" |
30 #include "chrome/installer/setup/install_worker.h" | 31 #include "chrome/installer/setup/install_worker.h" |
31 #include "chrome/installer/setup/setup_constants.h" | 32 #include "chrome/installer/setup/setup_constants.h" |
32 #include "chrome/installer/setup/setup_util.h" | 33 #include "chrome/installer/setup/setup_util.h" |
33 #include "chrome/installer/util/auto_launch_util.h" | 34 #include "chrome/installer/util/auto_launch_util.h" |
34 #include "chrome/installer/util/browser_distribution.h" | 35 #include "chrome/installer/util/browser_distribution.h" |
35 #include "chrome/installer/util/channel_info.h" | 36 #include "chrome/installer/util/channel_info.h" |
36 #include "chrome/installer/util/delete_after_reboot_helper.h" | 37 #include "chrome/installer/util/delete_after_reboot_helper.h" |
37 #include "chrome/installer/util/firewall_manager_win.h" | 38 #include "chrome/installer/util/firewall_manager_win.h" |
38 #include "chrome/installer/util/google_update_constants.h" | 39 #include "chrome/installer/util/google_update_constants.h" |
(...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1273 UninstallFirewallRules(browser_dist, base::FilePath(chrome_exe)); | 1274 UninstallFirewallRules(browser_dist, base::FilePath(chrome_exe)); |
1274 | 1275 |
1275 RemoveBlacklistState(); | 1276 RemoveBlacklistState(); |
1276 | 1277 |
1277 // Notify the shell that associations have changed since Chrome was likely | 1278 // Notify the shell that associations have changed since Chrome was likely |
1278 // unregistered. | 1279 // unregistered. |
1279 SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL); | 1280 SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL); |
1280 | 1281 |
1281 // TODO(huangs): Implement actual migration code and remove the hack below. | 1282 // TODO(huangs): Implement actual migration code and remove the hack below. |
1282 // Remove the "shadow" App Launcher registry keys. | 1283 // Remove the "shadow" App Launcher registry keys. |
1283 // TODO(hunags): Management of this key should not be conditional on | |
1284 // multi-install since the app list feature is available regardless of how | |
1285 // chrome is installed. | |
1286 if (installer_state.is_multi_install()) { | 1284 if (installer_state.is_multi_install()) { |
1287 // Delete the "shadow" keys. | 1285 // If we're not uninstalling the legacy App Launcher, and if it was |
1288 BrowserDistribution* shadow_app_launcher_dist = | 1286 // not installed in the first place, then delete the "shadow" keys. |
1289 BrowserDistribution::GetSpecificDistribution( | 1287 chrome_launcher_support::InstallationState level_to_check = |
1290 BrowserDistribution::CHROME_APP_HOST); | 1288 installer_state.system_install() ? |
1291 InstallUtil::DeleteRegistryKey( | 1289 chrome_launcher_support::INSTALLED_AT_SYSTEM_LEVEL : |
1292 reg_root, | 1290 chrome_launcher_support::INSTALLED_AT_USER_LEVEL; |
1293 shadow_app_launcher_dist->GetVersionKey(), | 1291 bool has_legacy_app_launcher = level_to_check == |
1294 KEY_WOW64_32KEY); | 1292 chrome_launcher_support::GetAppLauncherInstallationState(); |
| 1293 if (!has_legacy_app_launcher) { |
| 1294 BrowserDistribution* shadow_app_launcher_dist = |
| 1295 BrowserDistribution::GetSpecificDistribution( |
| 1296 BrowserDistribution::CHROME_APP_HOST); |
| 1297 InstallUtil::DeleteRegistryKey( |
| 1298 reg_root, |
| 1299 shadow_app_launcher_dist->GetVersionKey(), |
| 1300 KEY_WOW64_32KEY); |
| 1301 } |
1295 } | 1302 } |
1296 } | 1303 } |
1297 | 1304 |
1298 if (installer_state.is_multi_install()) | 1305 if (installer_state.is_multi_install()) |
1299 ProcessGoogleUpdateItems(original_state, installer_state, product); | 1306 ProcessGoogleUpdateItems(original_state, installer_state, product); |
1300 | 1307 |
1301 // Get the state of the installed product (if any) | 1308 // Get the state of the installed product (if any) |
1302 const ProductState* product_state = | 1309 const ProductState* product_state = |
1303 original_state.GetProductState(installer_state.system_install(), | 1310 original_state.GetProductState(installer_state.system_install(), |
1304 browser_dist->GetType()); | 1311 browser_dist->GetType()); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1467 // If we need a reboot to continue, schedule the parent directories for | 1474 // If we need a reboot to continue, schedule the parent directories for |
1468 // deletion unconditionally. If they are not empty, the session manager | 1475 // deletion unconditionally. If they are not empty, the session manager |
1469 // will not delete them on reboot. | 1476 // will not delete them on reboot. |
1470 ScheduleParentAndGrandparentForDeletion(target_path); | 1477 ScheduleParentAndGrandparentForDeletion(target_path); |
1471 } else if (DeleteChromeDirectoriesIfEmpty(target_path) == DELETE_FAILED) { | 1478 } else if (DeleteChromeDirectoriesIfEmpty(target_path) == DELETE_FAILED) { |
1472 *uninstall_status = UNINSTALL_FAILED; | 1479 *uninstall_status = UNINSTALL_FAILED; |
1473 } | 1480 } |
1474 } | 1481 } |
1475 | 1482 |
1476 } // namespace installer | 1483 } // namespace installer |
OLD | NEW |