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 |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/file_util.h" | 13 #include "base/file_util.h" |
| 14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
| 15 #include "base/process_util.h" | 15 #include "base/process_util.h" |
| 16 #include "base/string16.h" | 16 #include "base/string16.h" |
| 17 #include "base/string_util.h" | 17 #include "base/string_util.h" |
| 18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
| 19 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
| 20 #include "base/win/registry.h" | 20 #include "base/win/registry.h" |
| 21 #include "base/win/scoped_handle.h" | 21 #include "base/win/scoped_handle.h" |
| 22 #include "base/win/shortcut.h" | 22 #include "base/win/shortcut.h" |
| 23 #include "base/win/windows_version.h" | 23 #include "base/win/windows_version.h" |
| 24 #include "chrome/common/chrome_constants.h" | 24 #include "chrome/common/chrome_constants.h" |
| 25 #include "chrome/common/chrome_paths_internal.h" | 25 #include "chrome/common/chrome_paths_internal.h" |
| 26 #include "chrome/common/chrome_result_codes.h" | 26 #include "chrome/common/chrome_result_codes.h" |
| 27 #include "chrome/installer/launcher_support/chrome_launcher_support.h" | |
| 28 #include "chrome/installer/setup/install.h" | 27 #include "chrome/installer/setup/install.h" |
| 29 #include "chrome/installer/setup/install_worker.h" | 28 #include "chrome/installer/setup/install_worker.h" |
| 30 #include "chrome/installer/setup/setup_constants.h" | 29 #include "chrome/installer/setup/setup_constants.h" |
| 31 #include "chrome/installer/setup/setup_util.h" | 30 #include "chrome/installer/setup/setup_util.h" |
| 32 #include "chrome/installer/util/auto_launch_util.h" | 31 #include "chrome/installer/util/auto_launch_util.h" |
| 33 #include "chrome/installer/util/browser_distribution.h" | 32 #include "chrome/installer/util/browser_distribution.h" |
| 34 #include "chrome/installer/util/channel_info.h" | 33 #include "chrome/installer/util/channel_info.h" |
| 35 #include "chrome/installer/util/delete_after_reboot_helper.h" | 34 #include "chrome/installer/util/delete_after_reboot_helper.h" |
| 36 #include "chrome/installer/util/google_update_constants.h" | 35 #include "chrome/installer/util/google_update_constants.h" |
| 37 #include "chrome/installer/util/google_update_settings.h" | 36 #include "chrome/installer/util/google_update_settings.h" |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 351 dist, install_level, target_exe)) { | 350 dist, install_level, target_exe)) { |
| 352 LOG(WARNING) << "Failed to delete Quick Launch shortcuts."; | 351 LOG(WARNING) << "Failed to delete Quick Launch shortcuts."; |
| 353 } | 352 } |
| 354 | 353 |
| 355 VLOG(1) << "Deleting Start Menu shortcuts."; | 354 VLOG(1) << "Deleting Start Menu shortcuts."; |
| 356 if (!ShellUtil::RemoveShortcuts(ShellUtil::SHORTCUT_LOCATION_START_MENU, dist, | 355 if (!ShellUtil::RemoveShortcuts(ShellUtil::SHORTCUT_LOCATION_START_MENU, dist, |
| 357 install_level, target_exe)) { | 356 install_level, target_exe)) { |
| 358 LOG(WARNING) << "Failed to delete Start Menu shortcuts."; | 357 LOG(WARNING) << "Failed to delete Start Menu shortcuts."; |
| 359 } | 358 } |
| 360 | 359 |
| 360 VLOG(1) << "Deleting Start Menu root shortcuts."; | |
|
gab
2013/05/15 22:42:20
Remove this addition as discussed.
huangs
2013/05/17 20:59:24
Done.
| |
| 361 if (!ShellUtil::RemoveShortcuts(ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT, | |
| 362 dist, install_level, target_exe)) { | |
| 363 LOG(WARNING) << "Failed to delete Start Menu root shortcuts."; | |
| 364 } | |
| 365 | |
| 361 // Unpin all pinned-to-taskbar shortcuts that point to |chrome_exe|. | 366 // Unpin all pinned-to-taskbar shortcuts that point to |chrome_exe|. |
| 362 if (!ShellUtil::RemoveShortcuts(ShellUtil::SHORTCUT_LOCATION_TASKBAR_PINS, | 367 if (!ShellUtil::RemoveShortcuts(ShellUtil::SHORTCUT_LOCATION_TASKBAR_PINS, |
| 363 dist, ShellUtil::CURRENT_USER, target_exe)) { | 368 dist, ShellUtil::CURRENT_USER, target_exe)) { |
| 364 LOG(WARNING) << "Failed to unpin taskbar shortcuts at user-level."; | 369 LOG(WARNING) << "Failed to unpin taskbar shortcuts at user-level."; |
| 365 } | 370 } |
| 366 | 371 |
| 367 // Delete the folder of secondary tiles from the start screen for |dist|. | 372 // Delete the folder of secondary tiles from the start screen for |dist|. |
| 368 if (!ShellUtil::RemoveShortcuts(ShellUtil::SHORTCUT_LOCATION_APP_SHORTCUTS, | 373 if (!ShellUtil::RemoveShortcuts(ShellUtil::SHORTCUT_LOCATION_APP_SHORTCUTS, |
| 369 dist, install_level, target_exe)) { | 374 dist, install_level, target_exe)) { |
| 370 LOG(WARNING) << "Failed to delete start-screen shortcuts."; | 375 LOG(WARNING) << "Failed to delete start-screen shortcuts."; |
| (...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1225 | 1230 |
| 1226 ProcessDelegateExecuteWorkItems(installer_state, product); | 1231 ProcessDelegateExecuteWorkItems(installer_state, product); |
| 1227 | 1232 |
| 1228 ProcessOnOsUpgradeWorkItems(installer_state, product); | 1233 ProcessOnOsUpgradeWorkItems(installer_state, product); |
| 1229 | 1234 |
| 1230 UninstallActiveSetupEntries(installer_state, product); | 1235 UninstallActiveSetupEntries(installer_state, product); |
| 1231 | 1236 |
| 1232 // Notify the shell that associations have changed since Chrome was likely | 1237 // Notify the shell that associations have changed since Chrome was likely |
| 1233 // unregistered. | 1238 // unregistered. |
| 1234 SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL); | 1239 SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL); |
| 1235 | |
| 1236 // TODO(huangs): Implement actual migration code and remove the hack below. | |
| 1237 // Remove the "shadow" App Launcher registry keys. | |
| 1238 if (installer_state.is_multi_install()) { | |
| 1239 // If we're not uninstalling the legacy App Launcher, and if it was | |
| 1240 // not installed in the first place, then delete the "shadow" keys. | |
| 1241 chrome_launcher_support::InstallationState level_to_check = | |
| 1242 installer_state.system_install() ? | |
| 1243 chrome_launcher_support::INSTALLED_AT_SYSTEM_LEVEL : | |
| 1244 chrome_launcher_support::INSTALLED_AT_USER_LEVEL; | |
| 1245 bool has_legacy_app_launcher = level_to_check == | |
| 1246 chrome_launcher_support::GetAppLauncherInstallationState(); | |
| 1247 if (!has_legacy_app_launcher) { | |
| 1248 BrowserDistribution* shadow_app_launcher_dist = | |
| 1249 BrowserDistribution::GetSpecificDistribution( | |
| 1250 BrowserDistribution::CHROME_APP_HOST); | |
| 1251 InstallUtil::DeleteRegistryKey(reg_root, | |
| 1252 shadow_app_launcher_dist->GetVersionKey()); | |
| 1253 } | |
| 1254 } | |
| 1255 } | 1240 } |
| 1256 | 1241 |
| 1257 if (product.is_chrome_frame()) { | 1242 if (product.is_chrome_frame()) { |
| 1258 ProcessChromeFrameWorkItems(original_state, installer_state, setup_path, | 1243 ProcessChromeFrameWorkItems(original_state, installer_state, setup_path, |
| 1259 product); | 1244 product); |
| 1260 } | 1245 } |
| 1261 | 1246 |
| 1262 if (installer_state.is_multi_install()) { | 1247 if (installer_state.is_multi_install()) { |
| 1263 ProcessGoogleUpdateItems(original_state, installer_state, product); | 1248 ProcessGoogleUpdateItems(original_state, installer_state, product); |
| 1264 | 1249 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1430 // deletion unconditionally. If they are not empty, the session manager | 1415 // deletion unconditionally. If they are not empty, the session manager |
| 1431 // will not delete them on reboot. | 1416 // will not delete them on reboot. |
| 1432 ScheduleParentAndGrandparentForDeletion(target_path); | 1417 ScheduleParentAndGrandparentForDeletion(target_path); |
| 1433 } else if (DeleteApplicationProductAndVendorDirectories(target_path) == | 1418 } else if (DeleteApplicationProductAndVendorDirectories(target_path) == |
| 1434 installer::DELETE_FAILED) { | 1419 installer::DELETE_FAILED) { |
| 1435 *uninstall_status = installer::UNINSTALL_FAILED; | 1420 *uninstall_status = installer::UNINSTALL_FAILED; |
| 1436 } | 1421 } |
| 1437 } | 1422 } |
| 1438 | 1423 |
| 1439 } // namespace installer | 1424 } // namespace installer |
| OLD | NEW |