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

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

Issue 1780693002: Fix the path of Chrome shortcuts from the installer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 a8660d36716ed36d2fa285ad49c7865422742f9e..2abff153abddea0809f37f00da7f17f35708fb20 100644
--- a/chrome/installer/setup/install.cc
+++ b/chrome/installer/setup/install.cc
@@ -27,6 +27,7 @@
#include "chrome/installer/setup/setup_constants.h"
#include "chrome/installer/setup/setup_util.h"
#include "chrome/installer/setup/update_active_setup_version_work_item.h"
+#include "chrome/installer/setup/update_shortcuts.h"
#include "chrome/installer/util/beacons.h"
#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/create_reg_key_work_item.h"
@@ -37,6 +38,7 @@
#include "chrome/installer/util/master_preferences.h"
#include "chrome/installer/util/master_preferences_constants.h"
#include "chrome/installer/util/set_reg_value_work_item.h"
+#include "chrome/installer/util/shell_util.h"
#include "chrome/installer/util/util_constants.h"
#include "chrome/installer/util/work_item.h"
#include "chrome/installer/util/work_item_list.h"
@@ -418,6 +420,34 @@ void CreateOrUpdateShortcuts(
ExecuteAndLogShortcutOperation(
ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT, dist,
start_menu_properties, shortcut_operation);
+
+ // Update the target path of existing shortcuts.
gab 2016/03/09 20:10:44 s/shortcuts/per-user shortcuts/
fdoray 2016/03/09 22:13:03 Done.
+ if (install_operation == INSTALL_SHORTCUT_REPLACE_EXISTING) {
+ const base::FilePath target_path_prefix = target.DirName();
gab 2016/03/09 20:10:44 If I'm not mistaken, |target_path| here will be so
gab 2016/03/09 20:10:44 How about: s/target_path_prefix/updated_prefix/ s
fdoray 2016/03/09 22:13:03 Done.
fdoray 2016/03/09 22:13:03 Done. I didn't use the path from the bug report to
+ const base::FilePath target_path_suffix = target.BaseName();
+
+ UpdateShortcuts(ShellUtil::SHORTCUT_LOCATION_DESKTOP, shortcut_level, dist,
gab 2016/03/09 20:10:44 s/shortcut_level/ShellUtil::CURRENT_USER/ here an
fdoray 2016/03/09 22:13:02 CURRENT_USER now hard-coded in UpdatePerUserShortc
+ target_path_prefix, target_path_suffix, target);
+ UpdateShortcuts(ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT,
gab 2016/03/09 20:10:43 Don't think we need to touch the Start Menu shortc
fdoray 2016/03/09 22:13:03 Done.
+ shortcut_level, dist, target_path_prefix,
+ target_path_suffix, target);
+
+ // Check that the quick launch directory is a parent of the taskbar pins
gab 2016/03/09 20:10:44 // The next update assumes that the quick launch d
fdoray 2016/03/09 22:13:03 I now have separate calls to UpdatePerUserShortcut
+ // directory.
+ if (DCHECK_IS_ON()) {
+ base::FilePath taskbar_pins_path;
+ ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_TASKBAR_PINS,
+ dist, shortcut_level, &taskbar_pins_path);
+ base::FilePath quick_launch_path;
+ ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH,
+ dist, shortcut_level, &quick_launch_path);
+ DCHECK(quick_launch_path.IsParent(taskbar_pins_path));
+ }
+ // This updates both quick launch and taskbar pins.
gab 2016/03/09 20:10:43 // Update quick launch and taskbar pins.
fdoray 2016/03/09 22:13:02 This comment is no longer applicable.
+ UpdateShortcuts(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH,
+ ShellUtil::CURRENT_USER, dist, target_path_prefix,
+ target_path_suffix, target);
+ }
}
void RegisterChromeOnMachine(const installer::InstallerState& installer_state,

Powered by Google App Engine
This is Rietveld 408576698