Chromium Code Reviews| Index: chrome/installer/setup/uninstall.cc |
| diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc |
| index 460c4905ed7ba74bbab4ce8dfa03b752503aa53f..488f6d88953f5a8eb111d1a62b699564e695a532 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) { |
|
gab
2013/11/25 13:05:10
You marked as done, but looks like you only change
calamity
2013/11/26 02:51:17
Done.
|
| + 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; |
| + } |
| } |
| } |