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

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: 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/setup/install.cc
diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc
index a076ca3a6efbd8ed4e23c021e2b10544f10d851c..1b1494eccd1d8acd01813ee718181fd719bf41f6 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,8 +439,24 @@ void CreateOrUpdateShortcuts(
// remains disabled long term.
start_menu_properties.set_pin_to_start(false);
}
- ExecuteAndLogShortcutOperation(
+
+ // 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.
gab 2015/10/13 19:35:09 Suggest changing this whole paragraph with somethi
bcwhite 2015/10/15 18:29:35 Done.
+ base::FilePath old_shortcut_path;
+ ShellUtil::GetShortcutPath(
ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, dist,
+ shortcut_level, &old_shortcut_path);
+ if (base::PathExists(old_shortcut_path)) {
+ ShellUtil::MoveExistingShortcut(
+ shortcut_level, dist, start_menu_properties,
+ ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR,
gab 2015/10/13 19:35:09 Rename SHORTCUT_LOCATION_START_MENU_CHROME_DIR to
bcwhite 2015/10/15 18:29:35 Done.
+ ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT);
+ }
gab 2015/10/13 19:35:09 Also need to delete the subfolder on success. I s
bcwhite 2015/10/15 18:29:35 Generally there is only the one but should there b
gab 2015/10/15 18:55:06 I really think we should aim to delete the subfold
grt (UTC plus 2) 2015/10/19 17:28:44 Hmm. I think leaving old custom shortcuts in the d
+
+ ExecuteAndLogShortcutOperation(
+ ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT, dist,
start_menu_properties, shortcut_operation);
}
« 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