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

Issue 108193019: Installer: adding ResolveShortcutProperties(); updating shortcut icons during shortcut migration. (Closed)

Created:
7 years ago by huangs
Modified:
6 years, 2 months ago
CC:
chromium-reviews, grt+watch_chromium.org, erikwright+watch_chromium.org
Visibility:
Public.

Description

During the self-destruct flow (user-level Chrome being replaced by system-level Chrome), existing code to retarget shortcuts failed to update icon executables. This CL fixes this. The heuristics are summarized below: 1. Only considering shortcuts with parameters . 2. Shortcuts whose icon file == old target (user-level chrome.exe) gets updated to new target (system-level chrome.exe). 3. Shortcut index is kept same as before. (1) lets us delete user-level (pure) Chrome shortcut since system-level Chrome shortcut is already present. (2) lets us select migrate App Launcher shortcut (points to chrome.exe), without changing app shortcuts (points to fixed .ico files). (3) prevents App Launcher shortcut from mutating into Chrome shortcut (it assumes icon resources enumeration don't change. To make (2) and (3) possible, we need to read the icon file and icon index. This is done by generalizing ResolveShortcut() to ResolveShortcutProperties(). The new logic requires a new flow in ShellUtils, and no longer uses the UpdateShortcutsWithArgs() flow. BUG=326562 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=243642

Patch Set 1 #

Patch Set 2 : Adding ResolveShortcutProperties() to read thumbnails; requiring old target to matchs icon to for i… #

Total comments: 24

Patch Set 3 : Removing 'shortcut update' flow; adding unit tests for shortcut retargeting; refactoring unittests. #

Total comments: 27

Patch Set 4 : Completing ResolveShortcutProperties() and adding tests; more refactoring for ShellUtilShortcutTest. #

Total comments: 23

Patch Set 5 : Cleanup; adding aggregated ShortcutProperties::PROPERTIES_* masks. #

Patch Set 6 : Removing helper CreateTestDesktopShortcut() in shell_util_unittest.cc; inlining instead. #

Total comments: 32

Patch Set 7 : Nits; fixing test comments and coverage. #

Total comments: 2

Patch Set 8 : Nits. #

Patch Set 9 : Sync. #

Patch Set 10 : Fixing path comparison in ShortcutTest. #

Total comments: 4

Patch Set 11 : Cleanups; adding test code to investigate FilePath compare failure in test. #

Patch Set 12 : Using ValidatePathsAreEqual() to fix tests; removing test code. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+543 lines, -317 lines) Patch
M base/test/test_shortcut_win.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +5 lines, -0 lines 0 comments Download
M base/test/test_shortcut_win.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +155 lines, -161 lines 0 comments Download
M base/win/shortcut.h View 1 2 3 4 5 6 2 chunks +34 lines, -15 lines 0 comments Download
M base/win/shortcut.cc View 1 2 3 4 5 6 7 8 9 10 3 chunks +110 lines, -23 lines 0 comments Download
M base/win/shortcut_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +51 lines, -0 lines 0 comments Download
M chrome/installer/setup/uninstall.cc View 1 2 3 4 5 6 7 8 1 chunk +2 lines, -4 lines 0 comments Download
M chrome/installer/util/shell_util.h View 1 2 3 4 5 6 7 8 1 chunk +8 lines, -6 lines 0 comments Download
M chrome/installer/util/shell_util.cc View 1 2 3 4 5 6 7 8 2 chunks +28 lines, -11 lines 0 comments Download
chrome/installer/util/shell_util_unittest.cc View 1 2 3 4 5 6 7 8 11 chunks +150 lines, -97 lines 0 comments Download

Messages

Total messages: 33 (0 generated)
huangs
The issue is NOT ready for review; the current code tramples over user-created app icons, ...
7 years ago (2013-12-19 08:24:25 UTC) #1
gab
On 2013/12/19 08:24:25, huangs1 wrote: > The issue is NOT ready for review; the current ...
7 years ago (2013-12-19 16:31:48 UTC) #2
huangs
PTAL.
7 years ago (2013-12-23 08:55:59 UTC) #3
gab
Looks great, thanks! https://codereview.chromium.org/108193019/diff/20001/base/win/shortcut.cc File base/win/shortcut.cc (right): https://codereview.chromium.org/108193019/diff/20001/base/win/shortcut.cc#newcode177 base/win/shortcut.cc:177: ShortcutProperties* p) { s/p/properties Chromium doesn't ...
7 years ago (2013-12-23 14:25:01 UTC) #4
huangs
PTAL. shell_util_unittest.cc was refactored to reduce boilerplate code to create a test shortcut. The number ...
6 years, 11 months ago (2013-12-30 20:15:09 UTC) #5
huangs
https://codereview.chromium.org/108193019/diff/110001/chrome/installer/util/shell_util_unittest.cc File chrome/installer/util/shell_util_unittest.cc (right): https://codereview.chromium.org/108193019/diff/110001/chrome/installer/util/shell_util_unittest.cc#newcode92 chrome/installer/util/shell_util_unittest.cc:92: void CreateTestDesktopShortcut(base::FilePath* shortcut_path_out) { Cannot simply return base::FilePath, because ...
6 years, 11 months ago (2013-12-30 20:19:32 UTC) #6
gab
lg, mostly comments about test. Cheers! Gab https://codereview.chromium.org/108193019/diff/110001/base/win/shortcut.cc File base/win/shortcut.cc (right): https://codereview.chromium.org/108193019/diff/110001/base/win/shortcut.cc#newcode179 base/win/shortcut.cc:179: DCHECK(options); Switch ...
6 years, 11 months ago (2014-01-02 15:51:45 UTC) #7
huangs
PTAL. https://codereview.chromium.org/108193019/diff/110001/base/win/shortcut.cc File base/win/shortcut.cc (right): https://codereview.chromium.org/108193019/diff/110001/base/win/shortcut.cc#newcode179 base/win/shortcut.cc:179: DCHECK(options); Going with && for implicit cast to ...
6 years, 11 months ago (2014-01-02 19:58:22 UTC) #8
huangs
https://codereview.chromium.org/108193019/diff/230001/base/win/shortcut_unittest.cc File base/win/shortcut_unittest.cc (right): https://codereview.chromium.org/108193019/diff/230001/base/win/shortcut_unittest.cc#newcode91 base/win/shortcut_unittest.cc:91: TEST_F(ShortcutTest, CreateAndResolveShortcutProperties) { This test takes 160 ms to ...
6 years, 11 months ago (2014-01-02 20:00:00 UTC) #9
gab
Some comments below; looks good, I really like fixing ResolveShortcut to handle all options :)! ...
6 years, 11 months ago (2014-01-02 21:01:46 UTC) #10
huangs
Thanks! PTAL. +grt@: gab@ and I have conflicting views regarding need of helper function CreateTestDesktopShortcut() ...
6 years, 11 months ago (2014-01-02 23:22:37 UTC) #11
grt (UTC plus 2)
although i dislike repeated code, i think that a test failure will be easier to ...
6 years, 11 months ago (2014-01-03 16:39:11 UTC) #12
huangs
PTAL.
6 years, 11 months ago (2014-01-03 17:17:17 UTC) #13
gab
looks great, last nits I think. Cheers! Gab https://codereview.chromium.org/108193019/diff/410001/base/win/shortcut.cc File base/win/shortcut.cc (right): https://codereview.chromium.org/108193019/diff/410001/base/win/shortcut.cc#newcode184 base/win/shortcut.cc:184: } ...
6 years, 11 months ago (2014-01-03 18:25:51 UTC) #14
huangs
Thanks! PTAL (esp. changes to tests). https://codereview.chromium.org/108193019/diff/410001/base/win/shortcut.cc File base/win/shortcut.cc (right): https://codereview.chromium.org/108193019/diff/410001/base/win/shortcut.cc#newcode184 base/win/shortcut.cc:184: } On 2014/01/03 ...
6 years, 11 months ago (2014-01-03 20:19:34 UTC) #15
huangs
Thanks! PTAL (esp. changes to tests).
6 years, 11 months ago (2014-01-03 20:19:37 UTC) #16
huangs
Thanks! PTAL (esp. changes to tests).
6 years, 11 months ago (2014-01-03 20:19:37 UTC) #17
gab
Awesome, lgtm :)! Did you confirm that this works locally (i.e., doesn't turn taskbar pinned ...
6 years, 11 months ago (2014-01-03 21:01:13 UTC) #18
huangs
Of course; it's been working since Patch Set 1 on VM! Though I now need ...
6 years, 11 months ago (2014-01-03 22:30:38 UTC) #19
huangs
OWNER review to cpu@ for base/win/shortcut* . Key changes: - Added ResolveShortcutProperties() to read subset ...
6 years, 11 months ago (2014-01-03 22:36:02 UTC) #20
huangs
Ping cpu@ for review. Thanks!
6 years, 11 months ago (2014-01-07 23:00:07 UTC) #21
cpu_(ooo_6.6-7.5)
lgtm https://codereview.chromium.org/108193019/diff/760001/base/win/shortcut.cc File base/win/shortcut.cc (right): https://codereview.chromium.org/108193019/diff/760001/base/win/shortcut.cc#newcode205 base/win/shortcut.cc:205: WCHAR temp[MAX_PATH]; use wchar_t like the rest of ...
6 years, 11 months ago (2014-01-08 02:11:59 UTC) #22
huangs
Thanks! Still need to investigate failure in FilePath comparison in unit tests (cannot be reproduced ...
6 years, 11 months ago (2014-01-08 03:26:30 UTC) #23
huangs
The test fails due to difference between: C:\Users\CHROME~2\AppData\Local\Temp\scoped_dir29796_13440\Target 1.txt C:\Users\chrome-bot\AppData\Local\Temp\scoped_dir29796_13440\Target 1.txt Alternatives to address this: ...
6 years, 11 months ago (2014-01-08 06:14:01 UTC) #24
gab
On 2014/01/08 06:14:01, huangs1 wrote: > The test fails due to difference between: > C:\Users\CHROME~2\AppData\Local\Temp\scoped_dir29796_13440\Target ...
6 years, 11 months ago (2014-01-08 14:24:53 UTC) #25
huangs
gab@, I'm exposing ValidatePathsAreEqual() from test_shortcut_win.cc. PTAL.
6 years, 11 months ago (2014-01-08 15:23:16 UTC) #26
gab
lgtm, thanks!
6 years, 11 months ago (2014-01-08 15:38:31 UTC) #27
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/huangs@chromium.org/108193019/960001
6 years, 11 months ago (2014-01-08 16:07:42 UTC) #28
commit-bot: I haz the power
Retried try job too often on chromium_presubmit for step(s) presubmit http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=chromium_presubmit&number=43806
6 years, 11 months ago (2014-01-08 16:29:54 UTC) #29
huangs
OWNER review for phajdan.jr@: base/test/test_shortcut_win.h base/test/test_shortcut_win.cc I'm exposing ValidatePathsAreEqual(). Thanks!.
6 years, 11 months ago (2014-01-08 16:56:22 UTC) #30
Paweł Hajdan Jr.
base/test LGTM
6 years, 11 months ago (2014-01-08 17:14:29 UTC) #31
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/huangs@chromium.org/108193019/960001
6 years, 11 months ago (2014-01-08 17:44:17 UTC) #32
commit-bot: I haz the power
6 years, 11 months ago (2014-01-08 21:05:29 UTC) #33
Message was sent while issue was closed.
Change committed as 243642

Powered by Google App Engine
This is Rietveld 408576698