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

Issue 14287008: Refactoring installer shortcut deletion; adding dedicated shortcut update feature. (Closed)

Created:
7 years, 8 months ago by huangs
Modified:
7 years, 7 months ago
Reviewers:
gab, sky, grt (UTC plus 2)
CC:
chromium-reviews, grt+watch_chromium.org
Base URL:
http://chromium.googlesource.com/chromium/src.git@master
Visibility:
Public.

Description

Refactoring installer shortcut deletion; adding dedicated shortcut update feature. In ShellUtil, there were 3 shortcut removal routines. Changes: RemoveShortcut() => Renamed to RemoveShortcuts(), also ridding |shortcut_name| parameter (removed 1 caller that was redundant to start with). RemoveTaskbarShortcuts() => Absorbed by RemoveShortcut() RemoveStartScreenShortcuts() => Absorbed by RemoveShortcut() We want to also add an "update" feature to enable batch shortcut udpate, e.g., change all shortcuts that point to app_host.exe to point to chrome.exe instead, with the proper icon changes. To unify both operations, we create a BatchShortcutAction() that takes callbacks to perform specific operations (removal / update). ShellUtil::GetShortcutPath() is also refactored to accept more locations. The added routine in ShellUtil is: UpdateShortcuts() BUG=234876 R=gab@chromium.org, grt@chromium.org, sky@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=198514

Patch Set 1 : #

Total comments: 28

Patch Set 2 : Code cleanup; restructured BatchShortcutOperation; making RemoveShortcut() remove all by default. #

Patch Set 3 : More refactoring; single visitor BatchShortcutAction(); using callbacks for operations. #

Patch Set 4 : Adding tests for cookie migration code; using SHORTCUT_REPLACE_EXISTING now. #

Total comments: 36

Patch Set 5 : Removed redundant routines; cleaning up interfaces, including fixing callers. #

Total comments: 38

Patch Set 6 : Removing name_filter; removing general directory operations; renaming 'migrate' to 'retarget'; code… #

Total comments: 44

Patch Set 7 : Comment fixes; reduced RemoveShortcuts() to a single interface. #

Total comments: 14

Patch Set 8 : Comment fixes; cleanups. #

Total comments: 16

Patch Set 9 : Adding ShellUtil::ShortcutLocationIsExpected(); clearnup on error checks. #

Total comments: 12

Patch Set 10 : Renaming to ShortcutLocationIsSupported(); cleanups. #

Total comments: 2

Patch Set 11 : Comment fix. #

Patch Set 12 : Removing small change to base_paths_win.cc; save it for later. #

Patch Set 13 : Generaling 'Retarget' to 'Update' via base::win::ShortcutProperties. #

Total comments: 15

Patch Set 14 : Comment fixes; some refactoring in ShellUtil unittest. #

Total comments: 10

Patch Set 15 : Reverting ShellUtil unittest changes; bit more fixing. #

Total comments: 2

Patch Set 16 : Nits. #

Total comments: 3

Patch Set 17 : Sync. #

Total comments: 4

Patch Set 18 : Comment fixes. #

Patch Set 19 : Sync; fixing .git/config to allow CQ to commit. #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+336 lines, -201 lines) Patch
M chrome/browser/chrome_browser_main_win.cc View 1 2 3 4 5 1 chunk +2 lines, -3 lines 0 comments Download
M chrome/installer/setup/install.cc View 1 2 3 4 5 1 chunk +3 lines, -3 lines 0 comments Download
M chrome/installer/setup/uninstall.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +20 lines, -26 lines 0 comments Download
M chrome/installer/util/shell_util.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 4 chunks +28 lines, -23 lines 0 comments Download
M chrome/installer/util/shell_util.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 8 chunks +175 lines, -116 lines 1 comment Download
M chrome/installer/util/shell_util_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 6 chunks +108 lines, -30 lines 1 comment Download

Messages

Total messages: 44 (0 generated)
huangs
This is a preliminary CL, to see if you think the approach is viable. PTAL.
7 years, 8 months ago (2013-04-24 03:00:15 UTC) #1
gab
In general I think it would be cleaner, shorter, and more adaptable if instead of ...
7 years, 8 months ago (2013-04-24 21:41:46 UTC) #2
huangs
Implemented *some* of the suggested changes, since I'm planning some bigger change. Uploading now as ...
7 years, 7 months ago (2013-04-25 16:27:46 UTC) #3
huangs
Also changed interfaces somewhat, and updated callers. PTAL.
7 years, 7 months ago (2013-04-25 19:02:37 UTC) #4
huangs
Before, SHORTCUT_UPDATE_EXISTING creates a weird failure where name change was unsuccessful, BUT if I peer ...
7 years, 7 months ago (2013-04-25 20:57:57 UTC) #5
huangs
Ping.
7 years, 7 months ago (2013-04-29 18:56:57 UTC) #6
gab
Comments below, haven't looked at the tests yet, will wait for this set of comments ...
7 years, 7 months ago (2013-04-29 19:06:36 UTC) #7
huangs
Note that in BatchShortcutAction(), the |name_filter| parameter is now always kAllShortcuts or L"". But since ...
7 years, 7 months ago (2013-04-30 03:04:16 UTC) #8
grt (UTC plus 2)
https://codereview.chromium.org/14287008/diff/23002/chrome/installer/setup/uninstall.cc File chrome/installer/setup/uninstall.cc (right): https://codereview.chromium.org/14287008/diff/23002/chrome/installer/setup/uninstall.cc#newcode367 chrome/installer/setup/uninstall.cc:367: if (base::win::GetVersion() >= base::win::VERSION_WIN7) LOG_IF(WARNING, base::win::GetVersion() >= base::win::VERSION_WIN7) << ...
7 years, 7 months ago (2013-04-30 14:38:07 UTC) #9
huangs
Also updated main description. PTAL. https://chromiumcodereview.appspot.com/14287008/diff/23002/chrome/installer/setup/uninstall.cc File chrome/installer/setup/uninstall.cc (right): https://chromiumcodereview.appspot.com/14287008/diff/23002/chrome/installer/setup/uninstall.cc#newcode367 chrome/installer/setup/uninstall.cc:367: if (base::win::GetVersion() >= base::win::VERSION_WIN7) ...
7 years, 7 months ago (2013-04-30 15:58:38 UTC) #10
gab
This is looking great :)! The new tests duplicate a lot of code though :(, ...
7 years, 7 months ago (2013-04-30 19:20:33 UTC) #11
grt (UTC plus 2)
https://chromiumcodereview.appspot.com/14287008/diff/23002/chrome/installer/util/shell_util.h File chrome/installer/util/shell_util.h (right): https://chromiumcodereview.appspot.com/14287008/diff/23002/chrome/installer/util/shell_util.h#newcode532 chrome/installer/util/shell_util.h:532: static void MigrateStartScreenShortcuts(BrowserDistribution* dist, On 2013/04/30 15:58:38, huangs1 wrote: ...
7 years, 7 months ago (2013-04-30 19:59:53 UTC) #12
huangs
Also added base/base_paths_win.cc (which I think should be a separate cleanup CL; oh well). PTAL. ...
7 years, 7 months ago (2013-04-30 20:52:10 UTC) #13
gab
Very very nice! Do we need all of these LOGs in release builds (they will ...
7 years, 7 months ago (2013-04-30 22:30:21 UTC) #14
huangs
PTAL. https://chromiumcodereview.appspot.com/14287008/diff/44001/chrome/installer/setup/uninstall.cc File chrome/installer/setup/uninstall.cc (right): https://chromiumcodereview.appspot.com/14287008/diff/44001/chrome/installer/setup/uninstall.cc#newcode362 chrome/installer/setup/uninstall.cc:362: // retargeted at some point). On 2013/04/30 22:30:22, ...
7 years, 7 months ago (2013-05-01 04:11:51 UTC) #15
grt (UTC plus 2)
looking good. https://chromiumcodereview.appspot.com/14287008/diff/32001/chrome/installer/util/shell_util.cc File chrome/installer/util/shell_util.cc (right): https://chromiumcodereview.appspot.com/14287008/diff/32001/chrome/installer/util/shell_util.cc#newcode1367 chrome/installer/util/shell_util.cc:1367: if (base::win::GetVersion() < base::win::VERSION_WIN7) On 2013/04/30 20:52:10, ...
7 years, 7 months ago (2013-05-01 13:35:58 UTC) #16
huangs
PTAL. https://chromiumcodereview.appspot.com/14287008/diff/32001/chrome/installer/util/shell_util.cc File chrome/installer/util/shell_util.cc (right): https://chromiumcodereview.appspot.com/14287008/diff/32001/chrome/installer/util/shell_util.cc#newcode1367 chrome/installer/util/shell_util.cc:1367: if (base::win::GetVersion() < base::win::VERSION_WIN7) I was commenting on ...
7 years, 7 months ago (2013-05-01 15:56:28 UTC) #17
grt (UTC plus 2)
https://chromiumcodereview.appspot.com/14287008/diff/51001/chrome/installer/util/shell_util.cc File chrome/installer/util/shell_util.cc (right): https://chromiumcodereview.appspot.com/14287008/diff/51001/chrome/installer/util/shell_util.cc#newcode1264 chrome/installer/util/shell_util.cc:1264: LOG(WARNING) << "Cannot find path at location " << ...
7 years, 7 months ago (2013-05-01 16:33:43 UTC) #18
huangs
PTAL https://chromiumcodereview.appspot.com/14287008/diff/51001/chrome/installer/util/shell_util.cc File chrome/installer/util/shell_util.cc (right): https://chromiumcodereview.appspot.com/14287008/diff/51001/chrome/installer/util/shell_util.cc#newcode1264 chrome/installer/util/shell_util.cc:1264: LOG(WARNING) << "Cannot find path at location " ...
7 years, 7 months ago (2013-05-01 17:42:09 UTC) #19
gab
OOO but quick comment! Cheers, Gab https://chromiumcodereview.appspot.com/14287008/diff/56001/chrome/installer/util/shell_util.cc File chrome/installer/util/shell_util.cc (right): https://chromiumcodereview.appspot.com/14287008/diff/56001/chrome/installer/util/shell_util.cc#newcode1343 chrome/installer/util/shell_util.cc:1343: return base::win::GetVersion() < ...
7 years, 7 months ago (2013-05-01 18:34:41 UTC) #20
huangs
https://chromiumcodereview.appspot.com/14287008/diff/56001/chrome/installer/util/shell_util.cc File chrome/installer/util/shell_util.cc (right): https://chromiumcodereview.appspot.com/14287008/diff/56001/chrome/installer/util/shell_util.cc#newcode1343 chrome/installer/util/shell_util.cc:1343: return base::win::GetVersion() < base::win::VERSION_WIN8; Ah, good to know. Fortunately ...
7 years, 7 months ago (2013-05-01 19:22:22 UTC) #21
grt (UTC plus 2)
lgtm. i think this change merits extensive testing. i doubt we have automated tests that ...
7 years, 7 months ago (2013-05-01 19:53:49 UTC) #22
huangs
OWNER review to darin@ for: base/base_paths_win.cc: PathProviderWin(): adding Windows 7+ check for DIR_TASKBAR_PINS.
7 years, 7 months ago (2013-05-01 20:02:49 UTC) #23
huangs
Uploaded. Also verified proper shortcut deletion in Windows 7 & Windows 8 for basic install ...
7 years, 7 months ago (2013-05-01 20:19:28 UTC) #24
grt (UTC plus 2)
On 2013/05/01 20:19:28, huangs1 wrote: > Uploaded. > > Also verified proper shortcut deletion in ...
7 years, 7 months ago (2013-05-01 20:28:33 UTC) #25
huangs
gab@: I changed "retarget" to "update". Questions: - Would weird side effect arise if we're ...
7 years, 7 months ago (2013-05-02 17:33:34 UTC) #26
gab
Did another full-pass, this CL is awesome and makes the code much better (on top ...
7 years, 7 months ago (2013-05-02 19:20:50 UTC) #27
gab
Also, ping on an earlier comment, can you avoid duplicating code in tests? Cheers, Gab ...
7 years, 7 months ago (2013-05-02 19:24:49 UTC) #28
huangs
PTAL. https://chromiumcodereview.appspot.com/14287008/diff/78001/chrome/installer/util/shell_util.cc File chrome/installer/util/shell_util.cc (left): https://chromiumcodereview.appspot.com/14287008/diff/78001/chrome/installer/util/shell_util.cc#oldcode1304 chrome/installer/util/shell_util.cc:1304: NOTREACHED(); Okay, added back (but without checking for ...
7 years, 7 months ago (2013-05-02 20:48:02 UTC) #29
gab
Almost there! After looking at it again, I'm fine with keeping the code duplication from ...
7 years, 7 months ago (2013-05-02 21:23:59 UTC) #30
huangs
PTAL. https://chromiumcodereview.appspot.com/14287008/diff/60001/chrome/installer/util/shell_util.h File chrome/installer/util/shell_util.h (right): https://chromiumcodereview.appspot.com/14287008/diff/60001/chrome/installer/util/shell_util.h#newcode315 chrome/installer/util/shell_util.h:315: // |dist| gives the type of browser distribution ...
7 years, 7 months ago (2013-05-02 21:59:35 UTC) #31
gab
Awesome, thanks a lot! LGTM w/ slight nit below Cheers! Gab https://codereview.chromium.org/14287008/diff/92001/chrome/installer/util/shell_util_unittest.cc File chrome/installer/util/shell_util_unittest.cc (right): ...
7 years, 7 months ago (2013-05-02 22:05:39 UTC) #32
gab
I agree with Greg that this will need massive testing. There is a detailed plan ...
7 years, 7 months ago (2013-05-02 22:09:48 UTC) #33
huangs
https://chromiumcodereview.appspot.com/14287008/diff/92001/chrome/installer/util/shell_util_unittest.cc File chrome/installer/util/shell_util_unittest.cc (right): https://chromiumcodereview.appspot.com/14287008/diff/92001/chrome/installer/util/shell_util_unittest.cc#newcode430 chrome/installer/util/shell_util_unittest.cc:430: ShellUtil::ShortcutProperties properties(ShellUtil::CURRENT_USER); On 2013/05/02 22:05:40, gab wrote: > nit: ...
7 years, 7 months ago (2013-05-02 22:11:40 UTC) #34
huangs
OWNER review for sky@ for chrome/browser/chrome_browser_main_win.cc: Fixing caller due to changed interface (and rename) of ...
7 years, 7 months ago (2013-05-02 23:10:41 UTC) #35
gab
See below, LGTM++! Thanks! Gab https://chromiumcodereview.appspot.com/14287008/diff/97002/chrome/browser/chrome_browser_main_win.cc File chrome/browser/chrome_browser_main_win.cc (right): https://chromiumcodereview.appspot.com/14287008/diff/97002/chrome/browser/chrome_browser_main_win.cc#newcode148 chrome/browser/chrome_browser_main_win.cc:148: ShellUtil::CURRENT_USER, chrome_exe)) { You ...
7 years, 7 months ago (2013-05-03 00:17:35 UTC) #36
huangs
https://chromiumcodereview.appspot.com/14287008/diff/97002/chrome/browser/chrome_browser_main_win.cc File chrome/browser/chrome_browser_main_win.cc (right): https://chromiumcodereview.appspot.com/14287008/diff/97002/chrome/browser/chrome_browser_main_win.cc#newcode148 chrome/browser/chrome_browser_main_win.cc:148: ShellUtil::CURRENT_USER, chrome_exe)) { SGTM. :)
7 years, 7 months ago (2013-05-03 02:28:22 UTC) #37
grt (UTC plus 2)
still lgtm from me. two nits below. https://chromiumcodereview.appspot.com/14287008/diff/24008/chrome/installer/util/shell_util.h File chrome/installer/util/shell_util.h (right): https://chromiumcodereview.appspot.com/14287008/diff/24008/chrome/installer/util/shell_util.h#newcode49 chrome/installer/util/shell_util.h:49: SHORTCUT_LOCATION_APP_SHORTCUTS, // ...
7 years, 7 months ago (2013-05-03 15:28:32 UTC) #38
huangs
Done. For some reason commit queue is not working for me now. https://chromiumcodereview.appspot.com/14287008/diff/24008/chrome/installer/util/shell_util.h File chrome/installer/util/shell_util.h ...
7 years, 7 months ago (2013-05-03 15:50:02 UTC) #39
sky
chrome_browser_main_win.cc LGTM
7 years, 7 months ago (2013-05-03 16:05:02 UTC) #40
gab
Committed patchset #19 manually as r198514 (presubmit successful).
7 years, 7 months ago (2013-05-06 19:59:32 UTC) #41
huangs
Asked gab@ to dcommit for me, as this is blocking time-critical task -- can sort ...
7 years, 7 months ago (2013-05-06 20:03:10 UTC) #42
gab
https://chromiumcodereview.appspot.com/14287008/diff/22002/chrome/installer/util/shell_util.cc File chrome/installer/util/shell_util.cc (right): https://chromiumcodereview.appspot.com/14287008/diff/22002/chrome/installer/util/shell_util.cc#newcode1210 chrome/installer/util/shell_util.cc:1210: shortcut_path, shortcut_properties, base::win::SHORTCUT_REPLACE_EXISTING); Arg... my bad, this should be ...
7 years, 7 months ago (2013-05-13 03:48:51 UTC) #43
gab
7 years, 7 months ago (2013-05-13 04:12:15 UTC) #44
Message was sent while issue was closed.
https://chromiumcodereview.appspot.com/14287008/diff/22002/chrome/installer/u...
File chrome/installer/util/shell_util_unittest.cc (right):

https://chromiumcodereview.appspot.com/14287008/diff/22002/chrome/installer/u...
chrome/installer/util/shell_util_unittest.cc:463: // TODO(huangs): Fix
ValidateChromeShortcut() and use it.
And the fact that we checked it in with SHORTCUT_REPLACE_EXISTING instead of
SHORTCUT_UPDATE_EXISTING just proves my point here that this test should really
test that the update only affected the desired properties and that all other
properties remained the same (as all other tests in this file do) -- I was
originally satisfied with this for now because it at least tested one unmodified
property (arguments), but I forgot arguments are special cased and ported over
when overwriting shortcuts to avoid overwriting custom arguments some people add
on their shortcuts....

Please fix this as well, it would have catched this issue prior to checking it
in :(.

Powered by Google App Engine
This is Rietveld 408576698