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

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

Issue 1289333005: Change shortcut install location to non-subdir. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added test for shortcut migration Created 5 years, 3 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/install.cc
diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc
index a076ca3a6efbd8ed4e23c021e2b10544f10d851c..13f954584d32acf6353bfcedd4b00b9d4cd61925 100644
--- a/chrome/installer/setup/install.cc
+++ b/chrome/installer/setup/install.cc
@@ -70,6 +70,9 @@ void LogShortcutOperation(ShellUtil::ShortcutLocation location,
case ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH:
message.append("Quick Launch ");
break;
+ case ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT:
+ message.append("Start menu ");
+ break;
case ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR:
message.append("Start menu/" +
base::UTF16ToUTF8(dist->GetStartMenuShortcutSubfolder(
@@ -116,7 +119,7 @@ void LogShortcutOperation(ShellUtil::ShortcutLocation location,
VLOG(1) << message;
}
-void ExecuteAndLogShortcutOperation(
+bool ExecuteAndLogShortcutOperation(
ShellUtil::ShortcutLocation location,
BrowserDistribution* dist,
const ShellUtil::ShortcutProperties& properties,
@@ -125,7 +128,9 @@ void ExecuteAndLogShortcutOperation(
if (!ShellUtil::CreateOrUpdateShortcut(location, dist, properties,
operation)) {
LogShortcutOperation(location, dist, properties, operation, true);
+ return false;
}
+ return true;
}
void AddChromeToMediaPlayerList() {
@@ -434,9 +439,27 @@ void CreateOrUpdateShortcuts(
// remains disabled long term.
start_menu_properties.set_pin_to_start(false);
}
- ExecuteAndLogShortcutOperation(
- ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, dist,
- start_menu_properties, shortcut_operation);
+ if (!ExecuteAndLogShortcutOperation(
grt (UTC plus 2) 2015/09/22 20:28:53 how does this interact with pins in the start scre
gab 2015/09/28 15:44:51 Taskbar pinning creates a copy of the pinned short
+ ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT, dist,
+ start_menu_properties, shortcut_operation)) {
gab 2015/09/28 15:44:51 If someone runs an over-install (re-install when e
+ // We're migrating from shortcuts in a subdirectory to being directly in
+ // the list of "All Programs" which means the update may fail because it's
+ // not currently in the location we want it to go. In this case, we have
+ // to explicitly remove the old one and force-create the new one.
+ base::FilePath shortcut_path;
+ ShellUtil::GetShortcutPath(
+ ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, dist,
+ shortcut_level, &shortcut_path);
+ if (shortcut_operation == ShellUtil::SHELL_SHORTCUT_REPLACE_EXISTING &&
+ base::PathExists(shortcut_path)) {
+ ShellUtil::RemoveShortcuts(
+ ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, dist,
+ shortcut_level, start_menu_properties.target);
+ ExecuteAndLogShortcutOperation(
+ ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT, dist,
+ start_menu_properties, ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS);
+ }
+ }
}
void RegisterChromeOnMachine(const installer::InstallerState& installer_state,
« no previous file with comments | « no previous file | chrome/installer/setup/install_unittest.cc » ('j') | chrome/installer/setup/install_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698