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

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

Issue 14287008: Refactoring installer shortcut deletion; adding dedicated shortcut update feature. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding tests for cookie migration code; using SHORTCUT_REPLACE_EXISTING now. Created 7 years, 8 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/util/shell_util.h
diff --git a/chrome/installer/util/shell_util.h b/chrome/installer/util/shell_util.h
index bfdb9b953ecfeec05bd2c918e40e8096246a7b16..2981e57a3f7999181f3753602c969990085ed05c 100644
--- a/chrome/installer/util/shell_util.h
+++ b/chrome/installer/util/shell_util.h
@@ -44,6 +44,8 @@ class ShellUtil {
SHORTCUT_LOCATION_DESKTOP,
SHORTCUT_LOCATION_QUICK_LAUNCH,
SHORTCUT_LOCATION_START_MENU,
+ SHORTCUT_LOCATION_TASKBAR_PINS, // base::win::VERSION_WIN7 +
+ SHORTCUT_LOCATION_APP_SHORTCUTS, // base::win::VERSION_WIN8 +
};
enum ShortcutOperation {
@@ -498,22 +500,28 @@ class ShellUtil {
bool elevate_if_not_admin);
// Removes installed shortcut(s) at |location|.
- // |target_exe|: Shortcut target exe; shortcuts will only be deleted when
- // their target is |target_exe|.
// |level|: CURRENT_USER to remove the per-user shortcut and SYSTEM_LEVEL to
// remove the all-users shortcut.
- // |shortcut_name|: If non-null, remove the shortcut named |shortcut_name| at
- // location; otherwise remove all shortcuts to |target_exe| at |location|.
+ // |target_path|: Shortcut target exe; shortcuts will only be deleted when
+ // their target is |target_path|.
+ // |name_filter|: Wildcard filter to specify specific shortcut file(s),
+ // with optional ".lnk" suffix.
// If |location| is SHORTCUT_LOCATION_START_MENU, the shortcut folder specific
// to |dist| is deleted.
// Also attempts to unpin the removed shortcut(s) from the taskbar.
// Returns true if the shortcut(s) were successfully deleted (or there were
- // none at |location| pointing to |target_exe|).
+ // none at |location| pointing to |target_path|).
+ static bool RemoveShortcutWithName(ShellUtil::ShortcutLocation location,
gab 2013/04/29 19:06:36 I think that (once a comment above is adressed), t
huangs 2013/04/30 03:04:16 Done.
+ BrowserDistribution* dist,
+ ShellChange level,
+ const base::FilePath& target_path,
+ const string16& name_filter);
+
+ // Adaptor for RemoveShortcutWithName() with unconstrained |name_filter|.
static bool RemoveShortcut(ShellUtil::ShortcutLocation location,
BrowserDistribution* dist,
- const base::FilePath& target_exe,
ShellChange level,
- const string16* shortcut_name);
+ const base::FilePath& target_path);
gab 2013/04/29 19:06:36 Please keep this named |target_exe|, variables end
huangs 2013/04/30 03:04:16 I wanted to distinguish string16 from FilePath (an
// Enumerates all shortcuts pinned to the taskbar and deletes those pointing
// to |target_exe|.
@@ -526,6 +534,24 @@ class ShellUtil {
static void RemoveStartScreenShortcuts(BrowserDistribution* dist,
const string16& target_exe);
+ // Traverses through installed shortcut(s) in a similar manner as
+ // RemoveShortcut(). For each matched shortcut to |old_target_path|,
+ // update the shortcut so that it points to |new_target_path|.
+ static bool MigrateShortcut(ShellUtil::ShortcutLocation location,
+ BrowserDistribution* dist,
+ ShellChange level,
+ const base::FilePath& old_target_path,
+ const base::FilePath& new_target_path);
+
+ // Similar to RemoveTaskbarShortcuts(), but performs migration.
+ static void MigrateTaskbarShortcuts(const string16& old_target_exe,
+ const string16& new_target_exe);
+
+ // Similar to RemoveStartScreenShortcuts(), but performs migration.
+ static void MigrateStartScreenShortcuts(BrowserDistribution* dist,
+ const string16& old_target_exe,
+ const string16& new_target_exe);
+
// Sets |suffix| to the base 32 encoding of the md5 hash of this user's sid
// preceded by a dot.
// This is guaranteed to be unique on the machine and 27 characters long

Powered by Google App Engine
This is Rietveld 408576698