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

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

Issue 1289333005: Change shortcut install location to non-subdir. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move shortcut instead of delete/create Created 5 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/util/shell_util.cc
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc
index a753f802a160ddf145e294d92f9ec2bf4aed136b..db36e4d7f884ce7b45eaf9746590eec533fb4ff6 100644
--- a/chrome/installer/util/shell_util.cc
+++ b/chrome/installer/util/shell_util.cc
@@ -1728,6 +1728,35 @@ bool ShellUtil::GetShortcutPath(ShellUtil::ShortcutLocation location,
return true;
}
+bool ShellUtil::MoveExistingShortcut(
+ ShellUtil::ShellChange shortcut_level,
+ BrowserDistribution* dist,
+ const ShellUtil::ShortcutProperties& properties,
+ ShellUtil::ShortcutLocation old_location,
+ ShellUtil::ShortcutLocation new_location) {
+ // Explicitly whitelist locations to which this is applicable.
+ if (old_location != SHORTCUT_LOCATION_START_MENU_CHROME_DIR ||
+ new_location != SHORTCUT_LOCATION_START_MENU_ROOT) {
+ NOTREACHED();
+ return false;
+ }
+
+ base::string16 shortcut_name(
+ ExtractShortcutNameFromProperties(dist, properties));
+
+ base::FilePath old_shortcut_path;
+ base::FilePath new_shortcut_path;
+ ShellUtil::GetShortcutPath(
+ old_location, dist, shortcut_level, &old_shortcut_path);
+ ShellUtil::GetShortcutPath(
+ new_location, dist, shortcut_level, &new_shortcut_path);
+ old_shortcut_path = old_shortcut_path.Append(shortcut_name);
+ new_shortcut_path = new_shortcut_path.Append(shortcut_name);
+
+ return !!::MoveFile(old_shortcut_path.value().c_str(),
+ new_shortcut_path.value().c_str());
+}
+
bool ShellUtil::CreateOrUpdateShortcut(
ShellUtil::ShortcutLocation location,
BrowserDistribution* dist,
« chrome/installer/setup/install_unittest.cc ('K') | « chrome/installer/util/shell_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698