Chromium Code Reviews| Index: chrome/installer/setup/uninstall.cc |
| diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc |
| index 3e34d577caa9ae0256c0975b37ca880ee10406ea..ea9f2e4ae2794282c0c27e753e08010ad9322a08 100644 |
| --- a/chrome/installer/setup/uninstall.cc |
| +++ b/chrome/installer/setup/uninstall.cc |
| @@ -256,46 +256,44 @@ void DeleteChromeShortcuts(const InstallerState& installer_state, |
| return; |
| } |
| - FilePath shortcut_path; |
| - if (installer_state.system_install()) { |
| - PathService::Get(base::DIR_COMMON_START_MENU, &shortcut_path); |
| - if (!ShellUtil::RemoveChromeDesktopShortcut( |
| - product.distribution(), |
| - ShellUtil::CURRENT_USER | ShellUtil::SYSTEM_LEVEL, |
| - ShellUtil::SHORTCUT_NO_OPTIONS)) { |
| - ShellUtil::RemoveChromeDesktopShortcut( |
| - product.distribution(), |
| - ShellUtil::CURRENT_USER | ShellUtil::SYSTEM_LEVEL, |
| - ShellUtil::SHORTCUT_ALTERNATE); |
| - } |
| - |
| - ShellUtil::RemoveChromeQuickLaunchShortcut(product.distribution(), |
| - ShellUtil::CURRENT_USER | ShellUtil::SYSTEM_LEVEL); |
| - } else { |
| - PathService::Get(base::DIR_START_MENU, &shortcut_path); |
| - if (!ShellUtil::RemoveChromeDesktopShortcut(product.distribution(), |
| - ShellUtil::CURRENT_USER, ShellUtil::SHORTCUT_NO_OPTIONS)) { |
| - ShellUtil::RemoveChromeDesktopShortcut(product.distribution(), |
| - ShellUtil::CURRENT_USER, ShellUtil::SHORTCUT_ALTERNATE); |
| - } |
| + BrowserDistribution* dist = product.distribution(); |
| + |
| + uint32 options = |
| + installer_state.system_install() ? ShellUtil::SHORTCUT_SYSTEM_LEVEL : |
| + ShellUtil::SHORTCUT_NO_OPTIONS; |
| + |
| + VLOG(1) << "Deleting Desktop shortcut."; |
| + if (!ShellUtil::RemoveChromeShortcut( |
| + ShellUtil::SHORTCUT_DESKTOP, dist, options) && |
| + !ShellUtil::RemoveChromeShortcut( |
|
robertshield
2012/08/22 21:39:07
I suspect this will cause the second call to Remov
|
| + ShellUtil::SHORTCUT_DESKTOP, dist, |
| + options | ShellUtil::SHORTCUT_ALTERNATE)) { |
| + LOG(WARNING) << "Failed to delete Desktop shortcut."; |
| + } |
| - ShellUtil::RemoveChromeQuickLaunchShortcut(product.distribution(), |
| - ShellUtil::CURRENT_USER); |
| + VLOG(1) << "Deleting Quick Launch shortcut."; |
| + if (!ShellUtil::RemoveChromeShortcut( |
| + ShellUtil::SHORTCUT_QUICK_LAUNCH, dist, options)) { |
| + LOG(WARNING) << "Failed to delete Quick Launch shortcut."; |
| } |
| + |
| + FilePath shortcut_path; |
| + ShellUtil::GetShortcutPath( |
| + ShellUtil::SHORTCUT_START_MENU, installer_state.system_install(), |
| + &shortcut_path); |
| + |
| if (shortcut_path.empty()) { |
| - LOG(ERROR) << "Failed to get location for shortcut."; |
| + LOG(ERROR) << "Failed to get location for Start Menu shortcuts."; |
| } else { |
| - const string16 product_name(product.distribution()->GetAppShortCutName()); |
| - shortcut_path = shortcut_path.Append(product_name); |
| - |
| - FilePath shortcut_link(shortcut_path.Append(product_name + L".lnk")); |
| + const FilePath shortcut_link( |
| + shortcut_path.Append(dist->GetAppShortCutName() + L".lnk")); |
| VLOG(1) << "Unpinning shortcut at " << shortcut_link.value() |
| << " from taskbar"; |
| // Ignore return value: keep uninstalling if the unpin fails. |
| file_util::TaskbarUnpinShortcutLink(shortcut_link.value().c_str()); |
| - VLOG(1) << "Deleting shortcut " << shortcut_path.value(); |
| + VLOG(1) << "Deleting Start Menu shortcuts folder " << shortcut_path.value(); |
| if (!file_util::Delete(shortcut_path, true)) |
| LOG(ERROR) << "Failed to delete folder: " << shortcut_path.value(); |
| } |