summaryrefslogtreecommitdiffstats
path: root/chrome/installer/setup/uninstall.cc
diff options
context:
space:
mode:
authorcalamity@chromium.org <calamity@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-04 08:58:15 +0000
committercalamity@chromium.org <calamity@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-04 08:58:15 +0000
commit2f5bc32acdb7d8ebe657a4c5a2ce5b98e2c389a4 (patch)
tree395d94e3a49e609769d53bf65f78340c66fe1285 /chrome/installer/setup/uninstall.cc
parentf8e54f8688e8c23d6992884fdbbc177c169c2e3c (diff)
downloadchromium_src-2f5bc32acdb7d8ebe657a4c5a2ce5b98e2c389a4.zip
chromium_src-2f5bc32acdb7d8ebe657a4c5a2ce5b98e2c389a4.tar.gz
chromium_src-2f5bc32acdb7d8ebe657a4c5a2ce5b98e2c389a4.tar.bz2
We want the Applications Menu shortcut paths to be managed by shell_util.cc as
this will allow the uninstaller to clean up shortcuts. BrowserDistribution now provides the name of a distribution-specific Chrome app subfolder, and ShellUtil's utility functions can now create, update, and remove shortcuts therein. This CL introduces some structural changes: -ShellIntegration::ShortcutLocations now uses an enum to specify the Applications Menu location rather than a string. The enum consists of the root of the applications menu, the "Google Chrome" subdirectory and the "Chrome Apps" subdirectory. -ShellUtil::ShortcutLocation has the equivalent locations which are implemented by ShellUtil::GetShortcutPath(). -BrowserDistribution::GetStartMenuShortcutSubfolder() now supports SUBFOLDER_APPS. This CL can be supplementally tested by running setup_unittests. This began a rework of https://codereview.chromium.org/13940006/ for gab@'s post-commit comments. BUG=233434,238895 TEST=setup_unittests.exe, installer_util_unittests.exe Review URL: https://codereview.chromium.org/13864015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238648 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/setup/uninstall.cc')
-rw-r--r--chrome/installer/setup/uninstall.cc86
1 files changed, 23 insertions, 63 deletions
diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc
index c713834..d5a1bde 100644
--- a/chrome/installer/setup/uninstall.cc
+++ b/chrome/installer/setup/uninstall.cc
@@ -345,40 +345,17 @@ void RetargetUserShortcutsWithArgs(const InstallerState& installer_state,
ShellUtil::ShortcutProperties updated_properties(install_level);
updated_properties.set_target(new_target_exe);
- // TODO(huangs): Make this data-driven, along with DeleteShortcuts().
- VLOG(1) << "Retargeting Desktop shortcuts.";
- if (!ShellUtil::UpdateShortcutsWithArgs(
- ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist, install_level,
- old_target_exe, updated_properties)) {
- LOG(WARNING) << "Failed to retarget Desktop shortcuts.";
- }
-
- VLOG(1) << "Retargeting Quick Launch shortcuts.";
- if (!ShellUtil::UpdateShortcutsWithArgs(
- ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist, install_level,
- old_target_exe, updated_properties)) {
- LOG(WARNING) << "Failed to retarget Quick Launch shortcuts.";
- }
-
- VLOG(1) << "Retargeting Start Menu shortcuts.";
- if (!ShellUtil::UpdateShortcutsWithArgs(
- ShellUtil::SHORTCUT_LOCATION_START_MENU, dist, install_level,
- old_target_exe, updated_properties)) {
- LOG(WARNING) << "Failed to retarget Start Menu shortcuts.";
- }
-
- // Retarget pinned-to-taskbar shortcuts that point to |chrome_exe|.
- if (!ShellUtil::UpdateShortcutsWithArgs(
- ShellUtil::SHORTCUT_LOCATION_TASKBAR_PINS, dist,
- ShellUtil::CURRENT_USER, old_target_exe, updated_properties)) {
- LOG(WARNING) << "Failed to retarget taskbar shortcuts at user-level.";
- }
-
- // Retarget the folder of secondary tiles from the start screen for |dist|.
- if (!ShellUtil::UpdateShortcutsWithArgs(
- ShellUtil::SHORTCUT_LOCATION_APP_SHORTCUTS, dist, install_level,
- old_target_exe, updated_properties)) {
- LOG(WARNING) << "Failed to retarget start-screen shortcuts.";
+ // Retarget all shortcuts that point to |old_target_exe| from all
+ // ShellUtil::ShortcutLocations.
+ VLOG(1) << "Retargeting shortcuts.";
+ for (int location = ShellUtil::SHORTCUT_LOCATION_FIRST;
+ location < ShellUtil::NUM_SHORTCUT_LOCATIONS; ++location) {
+ if (!ShellUtil::UpdateShortcutsWithArgs(
+ static_cast<ShellUtil::ShortcutLocation>(location), dist,
+ install_level, old_target_exe, updated_properties)) {
+ LOG(WARNING) << "Failed to retarget shortcuts in ShortcutLocation: "
+ << location;
+ }
}
}
@@ -395,34 +372,17 @@ void DeleteShortcuts(const InstallerState& installer_state,
ShellUtil::ShellChange install_level = installer_state.system_install() ?
ShellUtil::SYSTEM_LEVEL : ShellUtil::CURRENT_USER;
- VLOG(1) << "Deleting Desktop shortcuts.";
- if (!ShellUtil::RemoveShortcuts(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist,
- install_level, target_exe)) {
- LOG(WARNING) << "Failed to delete Desktop shortcuts.";
- }
-
- VLOG(1) << "Deleting Quick Launch shortcuts.";
- if (!ShellUtil::RemoveShortcuts(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH,
- dist, install_level, target_exe)) {
- LOG(WARNING) << "Failed to delete Quick Launch shortcuts.";
- }
-
- VLOG(1) << "Deleting Start Menu shortcuts.";
- if (!ShellUtil::RemoveShortcuts(ShellUtil::SHORTCUT_LOCATION_START_MENU, dist,
- install_level, target_exe)) {
- LOG(WARNING) << "Failed to delete Start Menu shortcuts.";
- }
-
- // Unpin all pinned-to-taskbar shortcuts that point to |chrome_exe|.
- if (!ShellUtil::RemoveShortcuts(ShellUtil::SHORTCUT_LOCATION_TASKBAR_PINS,
- dist, ShellUtil::CURRENT_USER, target_exe)) {
- LOG(WARNING) << "Failed to unpin taskbar shortcuts at user-level.";
- }
-
- // Delete the folder of secondary tiles from the start screen for |dist|.
- if (!ShellUtil::RemoveShortcuts(ShellUtil::SHORTCUT_LOCATION_APP_SHORTCUTS,
- dist, install_level, target_exe)) {
- LOG(WARNING) << "Failed to delete start-screen shortcuts.";
+ // Delete and unpin all shortcuts that point to |target_exe| from all
+ // ShellUtil::ShortcutLocations.
+ VLOG(1) << "Deleting shortcuts.";
+ for (int location = ShellUtil::SHORTCUT_LOCATION_FIRST;
+ location < ShellUtil::NUM_SHORTCUT_LOCATIONS; ++location) {
+ if (!ShellUtil::RemoveShortcuts(
+ static_cast<ShellUtil::ShortcutLocation>(location), dist,
+ install_level, target_exe)) {
+ LOG(WARNING) << "Failed to delete shortcuts in ShortcutLocation:"
+ << location;
+ }
}
}
@@ -1441,7 +1401,7 @@ void CleanUpInstallationDirectoryAfterUninstall(
}
base::FilePath setup_exe(base::MakeAbsoluteFilePath(cmd_line.GetProgram()));
if (!target_path.IsParent(setup_exe)) {
- LOG(INFO) << "setup.exe is not in target path. Skipping installer cleanup.";
+ VLOG(1) << "setup.exe is not in target path. Skipping installer cleanup.";
return;
}
base::FilePath install_directory(setup_exe.DirName());