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

Issue 7825035: Implement chrome.experimental.downloads.search() (Closed)

Created:
9 years, 3 months ago by benjhayden
Modified:
9 years, 1 month ago
CC:
chromium-reviews, Erik does not do reviews, mihaip+watch_chromium.org, ahendrickson
Visibility:
Public.

Description

DownloadsSearchFunction (DSF) uses a templatized helper method to parse the json options and set up a DownloadQuery. When 'id' is specified, DSF uses DownloadManager.GetDownloadItem() instead of DM.Search(). DownloadQuery uses templatized Field interfaces/classes to sort and filter a vector of DownloadItem*s by a complex set of criteria. Adding a simple field to DownloadItem/DownloadQuery now requires adding 1 line to each of 0. DownloadItemToJson() 1. DSF::ParseArgs to call Parse<> 2. DownloadQuery::DownloadQuery to call SORT_FIELD 3. DownloadItem in extension_api.json 4. DownloadQuery in extension_api.json

Patch Set 1 : " #

Patch Set 2 : " #

Total comments: 20

Patch Set 3 : Templates<>! #

Total comments: 11

Patch Set 4 : comments #

Total comments: 17

Patch Set 5 : enums #

Patch Set 6 : merge #

Total comments: 19

Patch Set 7 : comments #

Patch Set 8 : rewrite #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1626 lines, -1073 lines) Patch
A + chrome/browser/download/downloads_extension_api.h View 1 2 3 4 5 6 7 4 chunks +14 lines, -3 lines 0 comments Download
A chrome/browser/download/downloads_extension_api.cc View 1 2 3 4 5 6 7 1 chunk +773 lines, -0 lines 0 comments Download
A + chrome/browser/download/downloads_extension_apitest.cc View 1 2 3 4 5 6 7 0 chunks +-1 lines, --1 lines 0 comments Download
D chrome/browser/extensions/extension_downloads_api.h View 1 2 3 4 5 6 7 1 chunk +0 lines, -277 lines 0 comments Download
D chrome/browser/extensions/extension_downloads_api.cc View 1 2 3 4 5 6 7 1 chunk +0 lines, -497 lines 0 comments Download
D chrome/browser/extensions/extension_downloads_api_constants.h View 1 2 1 chunk +0 lines, -52 lines 0 comments Download
D chrome/browser/extensions/extension_downloads_api_constants.cc View 1 2 1 chunk +0 lines, -65 lines 0 comments Download
D chrome/browser/extensions/extension_downloads_apitest.cc View 1 2 3 4 5 6 7 1 chunk +0 lines, -33 lines 0 comments Download
M chrome/browser/extensions/extension_function_dispatcher.cc View 1 2 3 4 5 6 7 2 chunks +3 lines, -3 lines 0 comments Download
M chrome/browser/extensions/extension_service.cc View 1 2 3 4 5 6 7 2 chunks +1 line, -1 line 0 comments Download
M chrome/chrome_browser.gypi View 1 2 3 4 5 6 7 3 chunks +6 lines, -8 lines 0 comments Download
M chrome/chrome_tests.gypi View 1 2 3 4 5 6 7 2 chunks +1 line, -1 line 0 comments Download
M chrome/test/data/extensions/api_test/downloads/test.js View 1 2 3 4 5 6 7 1 chunk +41 lines, -0 lines 0 comments Download
M content/browser/download/download_item.h View 1 2 3 4 5 6 7 6 chunks +67 lines, -86 lines 0 comments Download
M content/browser/download/download_item.cc View 1 2 3 4 5 6 7 22 chunks +49 lines, -47 lines 0 comments Download
A content/browser/download/download_item_interface.h View 1 2 3 4 1 chunk +108 lines, -0 lines 0 comments Download
M content/browser/download/download_manager.h View 1 2 3 4 5 6 7 2 chunks +9 lines, -1 line 0 comments Download
M content/browser/download/download_manager.cc View 1 2 3 4 5 6 7 2 chunks +6 lines, -0 lines 0 comments Download
A content/browser/download/download_query.h View 1 2 3 4 5 6 7 1 chunk +137 lines, -0 lines 0 comments Download
A content/browser/download/download_query.cc View 1 2 3 4 5 6 7 1 chunk +355 lines, -0 lines 0 comments Download
A content/browser/download/download_query_unittest.cc View 1 2 3 4 5 6 7 1 chunk +53 lines, -0 lines 0 comments Download
M content/content_browser.gypi View 1 2 3 4 5 6 7 1 chunk +3 lines, -0 lines 0 comments Download
M content/content_tests.gypi View 1 2 3 4 5 6 7 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 28 (0 generated)
benjhayden
9 years, 2 months ago (2011-09-29 21:17:41 UTC) #1
benjhayden
Sorry, Asanka, feel free to weigh in here.
9 years, 2 months ago (2011-09-30 15:21:35 UTC) #2
Randy Smith (Not in Mondays)
This is a fascinating top-level approach question. I personally find myself leaning towards the x-macros ...
9 years, 2 months ago (2011-09-30 17:37:34 UTC) #3
benjhayden
On 2011/09/30 17:37:34, rdsmith wrote: > This is a fascinating top-level approach question. I personally ...
9 years, 2 months ago (2011-09-30 18:14:50 UTC) #4
asanka
On 2011/09/30 18:14:50, b s h wrote: > On 2011/09/30 17:37:34, rdsmith wrote: > > ...
9 years, 2 months ago (2011-09-30 18:31:45 UTC) #5
cbentzel
Sorry to not comment on the X-Macro's approach: my general tendency is to avoid macros ...
9 years, 2 months ago (2011-09-30 19:11:12 UTC) #6
cbentzel
On Fri, Sep 30, 2011 at 3:11 PM, <cbentzel@chromium.org> wrote: > Sorry to not comment ...
9 years, 2 months ago (2011-09-30 19:13:04 UTC) #7
benjhayden
On 2011/09/30 19:13:04, cbentzel wrote: > On Fri, Sep 30, 2011 at 3:11 PM, <mailto:cbentzel@chromium.org> ...
9 years, 2 months ago (2011-09-30 19:23:03 UTC) #8
cbentzel
That much of a line savings may make it worth it. Have you investigated inline ...
9 years, 2 months ago (2011-09-30 19:30:22 UTC) #9
benjhayden
I hadn't considered encapsulating each field in an object. template<typename T> class SearchField { SearchField(const ...
9 years, 2 months ago (2011-09-30 20:18:56 UTC) #10
benjhayden
PTAL: x-macros! The LoC savings aren't quite what I thought they'd be since there are ...
9 years, 2 months ago (2011-10-06 21:23:13 UTC) #11
cbentzel
The x-macro stuff is clever and reduces code lines, so in that regards may be ...
9 years, 2 months ago (2011-10-10 14:35:30 UTC) #12
Randy Smith (Not in Mondays)
On 2011/10/10 14:35:30, cbentzel wrote: > The x-macro stuff is clever and reduces code lines, ...
9 years, 2 months ago (2011-10-10 18:04:49 UTC) #13
cbentzel
On Mon, Oct 10, 2011 at 2:04 PM, <rdsmith@chromium.org> wrote: > On 2011/10/10 14:35:30, cbentzel ...
9 years, 2 months ago (2011-10-10 18:07:55 UTC) #14
Randy Smith (Not in Mondays)
A couple of high level comments. http://codereview.chromium.org/7825035/diff/11001/chrome/browser/extensions/extension_downloads_api.cc File chrome/browser/extensions/extension_downloads_api.cc (right): http://codereview.chromium.org/7825035/diff/11001/chrome/browser/extensions/extension_downloads_api.cc#newcode264 chrome/browser/extensions/extension_downloads_api.cc:264: constants::kIdKey, &get_id_)); What ...
9 years, 2 months ago (2011-10-10 18:09:42 UTC) #15
Aaron Boodman
http://codereview.chromium.org/7825035/diff/11001/chrome/browser/extensions/extension_downloads_api.cc File chrome/browser/extensions/extension_downloads_api.cc (right): http://codereview.chromium.org/7825035/diff/11001/chrome/browser/extensions/extension_downloads_api.cc#newcode276 chrome/browser/extensions/extension_downloads_api.cc:276: #include "content/browser/download/download_query_fields.h" whoa. http://codereview.chromium.org/7825035/diff/11001/chrome/browser/extensions/extension_downloads_api.cc#newcode290 chrome/browser/extensions/extension_downloads_api.cc:290: query_, &error_, NULL/*c++ results*/, ...
9 years, 2 months ago (2011-10-12 08:26:08 UTC) #16
cbentzel
http://codereview.chromium.org/7825035/diff/11001/chrome/browser/extensions/extension_downloads_api.cc File chrome/browser/extensions/extension_downloads_api.cc (right): http://codereview.chromium.org/7825035/diff/11001/chrome/browser/extensions/extension_downloads_api.cc#newcode276 chrome/browser/extensions/extension_downloads_api.cc:276: #include "content/browser/download/download_query_fields.h" On 2011/10/12 08:26:08, Aaron Boodman wrote: > ...
9 years, 2 months ago (2011-10-12 09:26:37 UTC) #17
benjhayden
PTAL http://codereview.chromium.org/7825035/diff/11001/chrome/browser/extensions/extension_downloads_api.cc File chrome/browser/extensions/extension_downloads_api.cc (right): http://codereview.chromium.org/7825035/diff/11001/chrome/browser/extensions/extension_downloads_api.cc#newcode264 chrome/browser/extensions/extension_downloads_api.cc:264: constants::kIdKey, &get_id_)); On 2011/10/10 18:09:42, rdsmith wrote: > ...
9 years, 2 months ago (2011-10-13 14:07:34 UTC) #18
cbentzel
I haven't done a thorough review here, but mainly wanted to send a quick response ...
9 years, 2 months ago (2011-10-13 15:22:23 UTC) #19
benjhayden
On 2011/10/13 15:22:23, cbentzel wrote: > I haven't done a thorough review here, but mainly ...
9 years, 2 months ago (2011-10-13 17:08:56 UTC) #20
benjhayden
PTAL http://codereview.chromium.org/7825035/diff/34001/content/browser/download/download_query.cc File content/browser/download/download_query.cc (right): http://codereview.chromium.org/7825035/diff/34001/content/browser/download/download_query.cc#newcode241 content/browser/download/download_query.cc:241: #define SORT_FIELD(name, type, expr) \ On 2011/10/13 15:22:24, ...
9 years, 2 months ago (2011-10-13 17:19:47 UTC) #21
Randy Smith (Not in Mondays)
I like this general pathway, but I do have one high level question. It seems ...
9 years, 2 months ago (2011-10-13 23:23:10 UTC) #22
benjhayden
Before the nitty gritty, WDYT of the DownloadItemInterface for testing? http://codereview.chromium.org/7825035/diff/36008/chrome/browser/extensions/extension_downloads_api.cc File chrome/browser/extensions/extension_downloads_api.cc (right): http://codereview.chromium.org/7825035/diff/36008/chrome/browser/extensions/extension_downloads_api.cc#newcode142 ...
9 years, 2 months ago (2011-10-14 19:31:02 UTC) #23
benjhayden
+Andy
9 years, 2 months ago (2011-10-18 19:11:09 UTC) #24
Randy Smith (Not in Mondays)
Here's another round of comments with more detail. The primary top-level thing to think about ...
9 years, 2 months ago (2011-10-18 23:58:45 UTC) #25
cbentzel
I like that more of the parsing/validation is happening in the extension functions instead of ...
9 years, 2 months ago (2011-10-20 18:18:53 UTC) #26
asanka
http://codereview.chromium.org/7825035/diff/44001/chrome/browser/extensions/extension_downloads_api.cc File chrome/browser/extensions/extension_downloads_api.cc (right): http://codereview.chromium.org/7825035/diff/44001/chrome/browser/extensions/extension_downloads_api.cc#newcode456 chrome/browser/extensions/extension_downloads_api.cc:456: if (query_json->HasKey(constants::kOrderByKey)) { The extensions API doc should be ...
9 years, 2 months ago (2011-10-20 19:29:16 UTC) #27
Aaron Boodman
9 years, 2 months ago (2011-10-24 05:07:47 UTC) #28
Can you please put this in chrome/browser/download/downloads_extension_api.*

Also: You don't need the separate constants file. That precedent was set ages
ago because of a certain Chrome project that needed it. That project no longer
needs it, so we can stop.

Powered by Google App Engine
This is Rietveld 408576698