Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3772)

Unified Diff: chrome/installer/setup/uninstall.cc

Issue 10836247: Refactor ShellUtil shortcut code -- single multi-purpose methods as opposed to many slighlty diffe… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: brand new shell_util shortcut API + TESTS :)! Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/installer/setup/uninstall.cc
diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc
index 4171ea884928999f68995156db65183de38b0105..31715d7b8e9ccdfe436b4796644175fddb5f7eac 100644
--- a/chrome/installer/setup/uninstall.cc
+++ b/chrome/installer/setup/uninstall.cc
@@ -272,51 +272,38 @@ 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);
- }
+ BrowserDistribution* dist = product.distribution();
- 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);
- }
+ ShellUtil::ChromeShortcutProperties properties;
+ // The per-user shortcut for this user, if present on a system-level install,
+ // has already been deleted in chrome_browser_main_win.cc::DoUninstallTasks().
+ properties.set_system_level(installer_state.system_install());
- ShellUtil::RemoveChromeQuickLaunchShortcut(
- product.distribution(), ShellUtil::CURRENT_USER);
+ VLOG(1) << "Deleting Desktop shortcut.";
+ if (!ShellUtil::RemoveChromeShortcut(
+ ShellUtil::SHORTCUT_DESKTOP, dist, properties)) {
+ LOG(WARNING) << "Failed to delete Desktop shortcut.";
+ }
+ // Also try to delete the alternate desktop shortcut. It is not sufficient
+ // to do so upon failure of the above call as ERROR_FILE_NOT_FOUND on
+ // delete is considered success.
+ ShellUtil::ChromeShortcutProperties alternate_properties(properties);
+ alternate_properties.set_shortcut_name(dist->GetAlternateApplicationName());
+ if (!ShellUtil::RemoveChromeShortcut(
+ ShellUtil::SHORTCUT_DESKTOP, dist, alternate_properties)) {
+ LOG(WARNING) << "Failed to delete alternate Desktop shortcut.";
}
- if (shortcut_path.empty()) {
- LOG(ERROR) << "Failed to get location for shortcut.";
- } 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"));
- VLOG(1) << "Unpinning shortcut at " << shortcut_link.value()
- << " from taskbar";
- // Ignore return value: keep uninstalling if the unpin fails.
- base::win::TaskbarUnpinShortcutLink(shortcut_link.value().c_str());
+ VLOG(1) << "Deleting Quick Launch shortcut.";
+ if (!ShellUtil::RemoveChromeShortcut(
+ ShellUtil::SHORTCUT_QUICK_LAUNCH, dist, properties)) {
+ LOG(WARNING) << "Failed to delete Quick Launch shortcut.";
+ }
- VLOG(1) << "Deleting shortcut " << shortcut_path.value();
- if (!file_util::Delete(shortcut_path, true))
- LOG(ERROR) << "Failed to delete folder: " << shortcut_path.value();
+ VLOG(1) << "Deleting Start Menu shortcuts.";
+ if (!ShellUtil::RemoveChromeShortcut(
+ ShellUtil::SHORTCUT_START_MENU, dist, properties)) {
+ LOG(WARNING) << "Failed to delete Start Menu shortcuts.";
}
ShellUtil::RemoveChromeStartScreenShortcuts(product.distribution(),

Powered by Google App Engine
This is Rietveld 408576698