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

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: fix some comments Created 8 years, 4 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 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(
+ 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();
}

Powered by Google App Engine
This is Rietveld 408576698