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

Issue 977473002: downloads: break downloads.js into more classes/files. (Closed)

Created:
5 years, 9 months ago by Dan Beam
Modified:
5 years, 9 months ago
Reviewers:
asanka, Lei Zhang
CC:
chromium-reviews, benjhayden+dwatch_chromium.org, arv+watch_chromium.org, groby-ooo-7-16
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

downloads: break downloads.js into more classes/files. chrome://downloads' code has gotten less flexible than we'd like over the years and needs a little TLC. This CL heavily refactors chrome://downloads code by ripping apart downloads.js into: downloads.{ Item: a light data wrapper that has-an ItemView ItemView: responsible for beautiful downloads Manager: owns and manages all the items } as well as moving large portions of programmatic DOM creation (i.e. tons of document.createElement() calls) into an HTML template that's cloned. The JS refactor loosens the coupling between various layers, more clearly show responsibilities, and makes the code easier to understand, test, and maintain (in theory). The new way C++ => JS communication works is: - if an item will be hidden or shown (e.g. remove, undo, new) - C++ sends a whole new list to the JS - the JS is now much smarter about re-using DOM nodes - this preserves focus and has better performance - if an item is simply updated (e.g. downloading in progress) - C++ sends an update to that specific item R=asanka@chromium.org BUG=446412 Committed: https://crrev.com/85c004102bdcf0e5d741559b2235fdcb9d4aaa19 Cr-Commit-Position: refs/heads/master@{#320204}

Patch Set 1 #

Total comments: 3

Patch Set 2 : fixes #

Patch Set 3 : fix tests #

Patch Set 4 : drag fix #

Patch Set 5 : css tweak #

Patch Set 6 : downloaded by extension #

Patch Set 7 : +owners #

Patch Set 8 : a11y test fixes #

Patch Set 9 : remove NOTREACHED for testing code #

Total comments: 41

Patch Set 10 : asanka@ review #

Total comments: 4

Patch Set 11 : thestig@ review #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1044 lines, -1159 lines) Patch
M chrome/app/generated_resources.grd View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/browser_resources.grd View 1 2 3 4 5 6 7 8 9 10 1 chunk +4 lines, -1 line 0 comments Download
M chrome/browser/download/download_item_model.h View 1 1 chunk +6 lines, -0 lines 0 comments Download
M chrome/browser/download/download_item_model.cc View 1 3 chunks +15 lines, -1 line 0 comments Download
M chrome/browser/resources/downloads/OWNERS View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/resources/downloads/compiled_resources.gyp View 1 2 chunks +8 lines, -2 lines 0 comments Download
M chrome/browser/resources/downloads/downloads.css View 1 2 3 4 2 chunks +3 lines, -2 lines 0 comments Download
M chrome/browser/resources/downloads/downloads.html View 1 2 3 4 5 6 7 8 9 2 chunks +49 lines, -1 line 0 comments Download
M chrome/browser/resources/downloads/downloads.js View 1 1 chunk +0 lines, -1078 lines 0 comments Download
A chrome/browser/resources/downloads/externs.js View 1 2 3 4 5 6 7 8 9 1 chunk +37 lines, -0 lines 0 comments Download
A chrome/browser/resources/downloads/focus_row.js View 1 2 3 4 5 6 7 8 9 1 chunk +100 lines, -0 lines 0 comments Download
A chrome/browser/resources/downloads/item.js View 1 2 3 4 5 6 7 8 9 1 chunk +58 lines, -0 lines 0 comments Download
A chrome/browser/resources/downloads/item_view.js View 1 2 3 4 5 6 7 8 9 1 chunk +428 lines, -0 lines 0 comments Download
A chrome/browser/resources/downloads/manager.js View 1 2 3 4 5 6 7 8 9 1 chunk +211 lines, -0 lines 0 comments Download
M chrome/browser/ui/webui/downloads_dom_handler.h View 1 2 chunks +5 lines, -2 lines 0 comments Download
M chrome/browser/ui/webui/downloads_dom_handler.cc View 1 2 3 4 5 6 7 8 9 10 13 chunks +72 lines, -44 lines 0 comments Download
M chrome/browser/ui/webui/downloads_dom_handler_browsertest.cc View 1 2 6 chunks +19 lines, -13 lines 0 comments Download
M chrome/browser/ui/webui/downloads_ui.cc View 1 1 chunk +4 lines, -1 line 0 comments Download
M chrome/browser/ui/webui/downloads_ui_browsertest.js View 1 2 6 chunks +11 lines, -5 lines 0 comments Download
M chrome/browser/ui/webui/downloads_ui_browsertest_base.js View 1 2 4 chunks +12 lines, -8 lines 0 comments Download

Messages

Total messages: 37 (14 generated)
Dan Beam
let me know if you like this approach first, then i'll test
5 years, 9 months ago (2015-03-03 04:15:01 UTC) #1
asanka
I'm good with this. You should remove the sorting done at https://code.google.com/p/chromium/codesearch#chromium/src/chrome/browser/ui/webui/downloads_dom_handler.cc&l=577 since order or ...
5 years, 9 months ago (2015-03-03 18:11:39 UTC) #2
Dan Beam
On 2015/03/03 18:11:39, asanka wrote: > I'm good with this. You should remove the sorting ...
5 years, 9 months ago (2015-03-03 18:58:04 UTC) #3
Dan Beam
https://codereview.chromium.org/977473002/diff/1/chrome/browser/resources/downloads/downloads.js File chrome/browser/resources/downloads/downloads.js (right): https://codereview.chromium.org/977473002/diff/1/chrome/browser/resources/downloads/downloads.js#newcode213 chrome/browser/resources/downloads/downloads.js:213: this.node_.insertBefore(this.downloads_[id].node, before && before.node); i could possibly do this: ...
5 years, 9 months ago (2015-03-03 19:31:05 UTC) #4
asanka
On 2015/03/03 18:58:04, Dan Beam wrote: > On 2015/03/03 18:11:39, asanka wrote: > > I'm ...
5 years, 9 months ago (2015-03-03 20:43:46 UTC) #5
asanka
https://codereview.chromium.org/977473002/diff/1/chrome/browser/resources/downloads/downloads.js File chrome/browser/resources/downloads/downloads.js (right): https://codereview.chromium.org/977473002/diff/1/chrome/browser/resources/downloads/downloads.js#newcode213 chrome/browser/resources/downloads/downloads.js:213: this.node_.insertBefore(this.downloads_[id].node, before && before.node); On 2015/03/03 19:31:05, Dan Beam ...
5 years, 9 months ago (2015-03-03 20:45:56 UTC) #6
Dan Beam
https://codereview.chromium.org/977473002/diff/1/chrome/browser/resources/downloads/downloads.js File chrome/browser/resources/downloads/downloads.js (right): https://codereview.chromium.org/977473002/diff/1/chrome/browser/resources/downloads/downloads.js#newcode213 chrome/browser/resources/downloads/downloads.js:213: this.node_.insertBefore(this.downloads_[id].node, before && before.node); On 2015/03/03 20:45:56, asanka wrote: ...
5 years, 9 months ago (2015-03-04 00:46:20 UTC) #7
Dan Beam
ok, things seem to be working OK to the best of my knowledge. i'll try ...
5 years, 9 months ago (2015-03-06 02:47:05 UTC) #16
Dan Beam
ping asanka
5 years, 9 months ago (2015-03-09 16:43:15 UTC) #17
asanka
https://codereview.chromium.org/977473002/diff/310001/chrome/app/generated_resources.grd File chrome/app/generated_resources.grd (right): https://codereview.chromium.org/977473002/diff/310001/chrome/app/generated_resources.grd#newcode2064 chrome/app/generated_resources.grd:2064: + Downloaded by &lt;a href="<ph name="EXTENSION_URL">$1</ph>"&gt;<ph name="EXTENSION">$2<ex>The Best Chrome ...
5 years, 9 months ago (2015-03-10 04:15:51 UTC) #18
Dan Beam
https://codereview.chromium.org/977473002/diff/310001/chrome/app/generated_resources.grd File chrome/app/generated_resources.grd (right): https://codereview.chromium.org/977473002/diff/310001/chrome/app/generated_resources.grd#newcode2064 chrome/app/generated_resources.grd:2064: + Downloaded by &lt;a href="<ph name="EXTENSION_URL">$1</ph>"&gt;<ph name="EXTENSION">$2<ex>The Best Chrome ...
5 years, 9 months ago (2015-03-10 05:41:03 UTC) #20
Dan Beam
ping asanka@
5 years, 9 months ago (2015-03-11 15:20:46 UTC) #21
asanka
LGTM. The comments are minor and can be postponed to follow ups given the size ...
5 years, 9 months ago (2015-03-11 19:57:50 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/977473002/350001
5 years, 9 months ago (2015-03-11 21:51:41 UTC) #24
Dan Beam
addressing the rest in a followup right now https://codereview.chromium.org/977473002/diff/350001/chrome/browser/resources/downloads/downloads.html File chrome/browser/resources/downloads/downloads.html (right): https://codereview.chromium.org/977473002/diff/350001/chrome/browser/resources/downloads/downloads.html#newcode77 chrome/browser/resources/downloads/downloads.html:77: i18n-values=".innerHTML:control_by_extension"></span> ...
5 years, 9 months ago (2015-03-11 21:55:06 UTC) #25
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/49028)
5 years, 9 months ago (2015-03-11 22:28:45 UTC) #27
Dan Beam
+thestig@ for chrome/browser/browser_resources.grd
5 years, 9 months ago (2015-03-11 22:46:12 UTC) #29
Lei Zhang
https://codereview.chromium.org/977473002/diff/350001/chrome/browser/browser_resources.grd File chrome/browser/browser_resources.grd (right): https://codereview.chromium.org/977473002/diff/350001/chrome/browser/browser_resources.grd#newcode134 chrome/browser/browser_resources.grd:134: <include name="IDR_DOWNLOAD_FOCUS_ROW_JS" file="resources\downloads\focus_row.js" type="BINDATA" /> Alphabetical order? What about ...
5 years, 9 months ago (2015-03-11 23:01:38 UTC) #30
Dan Beam
https://codereview.chromium.org/977473002/diff/350001/chrome/browser/browser_resources.grd File chrome/browser/browser_resources.grd (right): https://codereview.chromium.org/977473002/diff/350001/chrome/browser/browser_resources.grd#newcode134 chrome/browser/browser_resources.grd:134: <include name="IDR_DOWNLOAD_FOCUS_ROW_JS" file="resources\downloads\focus_row.js" type="BINDATA" /> On 2015/03/11 23:01:38, Lei ...
5 years, 9 months ago (2015-03-11 23:38:34 UTC) #31
Lei Zhang
lgtm
5 years, 9 months ago (2015-03-11 23:47:44 UTC) #32
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/977473002/370001
5 years, 9 months ago (2015-03-11 23:49:14 UTC) #35
commit-bot: I haz the power
Committed patchset #11 (id:370001)
5 years, 9 months ago (2015-03-12 01:33:46 UTC) #36
commit-bot: I haz the power
5 years, 9 months ago (2015-03-12 01:34:15 UTC) #37
Message was sent while issue was closed.
Patchset 11 (id:??) landed as
https://crrev.com/85c004102bdcf0e5d741559b2235fdcb9d4aaa19
Cr-Commit-Position: refs/heads/master@{#320204}

Powered by Google App Engine
This is Rietveld 408576698