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

Unified Diff: chrome/installer/util/shell_util.cc

Issue 11361015: Introduce RemoveChromeTaskbarShortcuts() to delete all pinned-to-taskbar shortcuts owned by the uni… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add comment in uninstall.cc 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
« no previous file with comments | « chrome/installer/util/shell_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/util/shell_util.cc
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc
index 6891fcdfe81c9d5ddc7495ccf77834d1dfe2c580..943a07d189c09107dee23c5c90d29191615a40fa 100644
--- a/chrome/installer/util/shell_util.cc
+++ b/chrome/installer/util/shell_util.cc
@@ -1847,6 +1847,34 @@ bool ShellUtil::RemoveChromeShortcut(
return true;
}
+void ShellUtil::RemoveChromeTaskbarShortcuts(const string16& chrome_exe) {
+ FilePath taskbar_pins_path;
+ if (!PathService::Get(base::DIR_TASKBAR_PINS, &taskbar_pins_path) ||
+ !file_util::PathExists(taskbar_pins_path)) {
+ LOG(ERROR) << "Couldn't find path to taskbar pins.";
+ return;
+ }
+
+ file_util::FileEnumerator shortcuts_enum(
+ taskbar_pins_path, false,
+ file_util::FileEnumerator::FILES, FILE_PATH_LITERAL("*.lnk"));
+
+ FilePath chrome_path(chrome_exe);
+ InstallUtil::ProgramCompare chrome_compare(chrome_path);
+ for (FilePath shortcut_path = shortcuts_enum.Next(); !shortcut_path.empty();
+ shortcut_path = shortcuts_enum.Next()) {
+ FilePath read_target;
+ if (!base::win::ResolveShortcut(shortcut_path, &read_target, NULL)) {
+ NOTREACHED();
+ continue;
+ }
+ if (chrome_compare.Evaluate(read_target.value())) {
+ // Unpin this shortcut if it points to |chrome_exe|.
+ base::win::TaskbarUnpinShortcutLink(shortcut_path.value().c_str());
+ }
+ }
+}
+
void ShellUtil::RemoveChromeStartScreenShortcuts(BrowserDistribution* dist,
const string16& chrome_exe) {
if (base::win::GetVersion() < base::win::VERSION_WIN8)
« no previous file with comments | « chrome/installer/util/shell_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698