Project: chromium Issues People Development process History Sign in
New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 238 users

Comments by non-members will not trigger notification emails to users who starred this issue.
Status: Fixed
Owner:
Closed: May 2013
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Feature

Blocking:
issue 68201



Sign in to add a comment
Implement downloads API for extensions
Project Member Reported by aa@chromium.org, May 17 2009 Back to list
It should be possible to script Chrome's download manager from extensions. 
See this design doc:

http://dev.chromium.org/developers/design-documents/extensions/downloads-api
 
Comment 1 by aa@chromium.org, May 17 2009
Labels: -Pri-2 Pri-3
Comment 2 by aa@chromium.org, May 21 2009
Comment 3 by aa@chromium.org, Jun 9 2009
Labels: -Pri-3 Mstone-X
I have a project that I would like to implement as a Chrome extension but it needs an API into the Download Manager.  I 
have a copy of the Chromium source and was going to modify it to create an extension Download API.  Is the download API document linked above the preferred API that folks would like to see implemented?  I figured I would write an API that 
matches it and submit it for review and inclusion if it meets with the relevant Chromium folks approval (I am assuming 
since the status was marked "Available" that to the best of your knowledge someone else wasn't already working on this).  

My thoughts were to just model the implementation after the other event API's but I would be happy to write up a more 
detailed document with what I think might be your preferred way to extend the source with an event API (prior to going in 
and adding code).  I appreciate any and all criticism and suggestions.  I have a copy of the style guidelines and I'll make 
sure they comply with the guidelines.  I'll also be extremely careful to model the code structure after the existing code 
structure that is in place.
Hi Rene,

Sorry for not replying earlier. By all means, feel free to start implementing the
downloads API, I'm sure other developers will want to use it as well!

We may end up changing the API slightly, but no need to worry about that for now.
Also a heads up that we will be slower with code reviews for the next few weeks,
since we're trying to get everything ready for our beta launch.

Cheers,

-Nick
Adding Paul, who may want to contribute to this as well.
Comment 7 by aa@chromium.org, Nov 16 2009
Labels: Feature-Extensions
Comment 8 by aa@chromium.org, Nov 19 2009
Labels: -Area-Extensions
Anyone working on an extension or an update to the download manager, I'd love an option 
to schedule downloads for a certain time rather than having to download immediately.
Preferably one where I can specify additional headers for the GET request so that I 
can interface with S3/CloudFiles like services.

I just want to be able to initiate a download and use something like 
xhr.setRequestHeader(label, blah).
I would like to see the ability to control the save path, so I can 
direct files to a new folder each day, based on date. 
Comment 12 by Deleted ...@, Dec 28 2009
Yes. A way to have multiple download folders would be nice, like a list to choose from. 
Right now I can't find out how to make it happen with the current API state.
I have a FF extension that does most of what is described above (although it is for a
specialized purpose, not a general-purpose download manager).  On FF I just start an
nsIObserverService that watches for http-on-examine-response that then modifies the
nsIHttpChannel to insert a Content-Disposition header (to rewrite filename) and
redirect the channel to my custom download manager:
  https://developer.mozilla.org/en/nsIObserverService
  https://developer.mozilla.org/en/Observer_Notifications#HTTP_requests
  https://developer.mozilla.org/en/NsIHttpChannel

When it comes to managing the download, I implement an nsIMultiplexInputStream that
watches for onDataAvailable from the channel.

My download manager is a bit non-standard in that it is actually making a copy of the
file as it downloads but also passing the data through to the browser as normal. This
means that I take in an nsIBinaryInputStream and create an nsIStorageStream and an
nsIBinaryOutputStream to make the copy.  Then, when it's done, I use an XHR to send
the copy off to a server.

Anyway, I thought this might be useful context for how a download API might be
implemented.  I like the FF model where rather than trying to predict the use cases,
they just open up hooks wherever possible.
Labels: Area-Feature
I also want to push this request. For Firefox I have an extension called FireSnarl 
which sends notifications using Snarl (http://www.fullphat.net/) which triggers on 
the events
 - download started
 - download progress changed
 - download finshed
 (and some more special onces like being scanned).

Would like to build such an extension for Chromium too (as it is my default browser 
now :))
Comment 16 by sawe...@gmail.com, Feb 2 2010
I would like to use the gnu WGet with chrome, so what i really need is a way to catch 
the downloads and redirect them to another program...
Cheers and keep up with the good work!!!

Comment 17 by shik...@gmail.com, Feb 2 2010
I too, want to write an extension that uses the Downloads API
I would like to have a way to query how many downloads are active (to show the number 
on a button badge on the toolbar) as well as events I can use to modify the download 
count each time a new download is added or one finishes. Bonus point for access to 
downloading filenames, percentages and remaining time.

Will this API addition cover my use case?
I support comment #13 , as I'd like an extension that can move downloaded files in 
different folders according to the mime, extension, and eventually the url.
Labels: -Area-Feature Area-UI
Comment 21 by casp...@gmail.com, Mar 22 2010
I want to push this request as well.
Comment 22 by sche...@gmail.com, Mar 31 2010
Request this to push want I well as.
Comment 23 by Deleted ...@, Apr 1 2010
hi! 
there a way to download files from web through an extension?
Thanks
Comment 24 by mega...@gmail.com, Apr 1 2010
Currently you can open the file in a tab.  If the browser cannot handle the type it 
will download.

In theory you can also load the file using XMLHTTPRequest and then generate a data url 
from it, so you can specify your own mime type and force it to download.  Not sure if 
this works though.
Comment 25 by galm...@gmail.com, Apr 1 2010
I would like to know, how to distinguish between link that opens another page and one 
that going to download file
Comment 26 by Deleted ...@, Apr 13 2010
still no news ? :(
Hi.  We understand this is a popular request, but we're swamped by other priorities so 
it's not currently on the schedule.  There's no need to add more me-too comments to 
this bug though.  We definitely haven't forgotten it. :)  Just star the bug to be 
notified of changes.
I would like to control whether or not the download bar is shown when a download is 
started. Maybe this is possible using the "showInShelf" variable mentioned in the 
design document.

I would like to create an extension that just shows an icon with the current number of 
(active) downloads and, when clicked, shows a simple popup with simple controls to 
pause, open, etc. This seems to be possible using the proposed functions. I am looking 
forward to the Downloads API. Thanks.
+1

I had the exactly same idea few months ago. :)

Current UI consumes too much real state, IMO.
Comment 30 by mega...@gmail.com, May 31 2010
I don't think that's such a good idea.  The last thing I'd want is an extension 
downloading questionable files in the background to my hard disk.  With an initial 
delay of a few days or weeks it would also make it difficult to determine which 
extension is downloading files!  Assuming the user figures out it's an extension.

If extensions can do this there either needs to be a mandatory notification of some 
sort, or a permission switch so the user can be notified when they install the 
extension.
I only wanted to create an extension to do that because I hate current
download UI.

Developers have put so much energy in making UI as little obtrusive as
possible but delivered this download bar which bigger than URL bar. It does
not make sense IMO.
Also, when you download 10 different big files - the downloads choke each other. A 
queue would fix the problem:
you could get 1 small "downloading" indicator for current file, and the other 9 files 
would be queued. So that I can leave my PC, go make a cup of coffe, get back and see 
that 4 files are done, 5th is currently being downloaded, and another 5 are still 
queued.
It would be necesary to remember the queue if I need to close Chrome for some reason 
and return to browsing later.
Comment 33 by galm...@gmail.com, Jun 1 2010
I need an extension API to move the download to third party process, so download itself 
will be issued outside of Chrome
Comment 34 by Deleted ...@, Jun 15 2010
I was looking for an extension that can re-route specific filetype/extensions to a specfific folder instead of the standard-folder. Especially for my torrentfiles to be downloaded in the Load-folder of my torrentclient. Haven't found it still, I decided to make my own but need to wait for the downloads-API. Anyone thought of this idea? (I hate to do things someone else has done/will do...!) Any indication on when this API will be released?
Comment 35 by Deleted ...@, Jun 16 2010
can someone provide me with an api for uploading and downloading .mp3 file.
Thanks in advance....!!!

Comment 36 by Deleted ...@, Jun 16 2010
Hi! I would liket to write an extension that puts downloads into 2 seperate folders.

One of them is a Temp folder, which emptys automatically every time or i can do that manually. This folder contains files that i just want to open from the internet.

The other folder is the "Downloads" folder where my "downloaded" files (like mp3s, videos etc) is archived.

The etension have a popup question every time when i want to download a file from the internet. I can choose from 2 options: "open" or "save" the file.

I thin i need the Dowloads API.
Comment 37 by sky@chromium.org, Aug 26 2010
Aaron, folks also want the ability to control the download shelf from extensions. See 27797 for specifics. It could be as allowing extensions to toggle whether the shelf is ever shown, or we could let developers completely replace the shelf by way of some html in which case they would have complete control over it (see 9845 for folks that want this ability).
Issue 53542 has been merged into this issue.
Comment 39 by aa@chromium.org, Sep 10 2010
Labels: Pri-2
Comment 40 by katok...@gmail.com, Sep 13 2010
Use case: reorganizing downloaded files into subfolders of the root download folder e.g. by date or type.
Comment 41 by aa@chromium.org, Sep 13 2010
I think there are a few different facets here:

1. An API to automate the built-in download manager -- eg start/stop downloads, schedule new ones, etc. People could create new, fancier front-ends to the dm this way. That is what this bug represents.

2. A way to replace the downloads tab UI. I'm not crazy about any APIs that only one extension can implement, but we've already gone down the path of allowing people to replace built-in pages of Chrome with extensions, so we might as well be consistent. I don't think there is a bug for this yet, but if people want it, I guess I'd go along.

3. A way to *be* the download manager -- eg with native code, or with a web-based solution. Again, I'm not crazy about this because only one extension could play this role at a time. I think I would prefer that people just use the context menu API to add "download with AwesomeDownloader" option. This isn't as pure an integration, but it scales better. This is represented by bug 1685. My opinion is that that bug should go away.

To the specific issue of people wanting the download shelf to go away after some time, I think a good solution is here: crbug.com/28084. 
Comment 42 by alyst...@gmail.com, Sep 13 2010
Use case: reorganizing download files into subfolders named after domains
Comment 43 by aa@chromium.org, Sep 15 2010
Issue 35444 has been merged into this issue.
Comment 44 Deleted
Download option in context menu is good solution only as an extra. Most files today can be downloaded in multiple streams. Same is say for Microsoft download center. They have download button there, so I cannot right-click on it and tell "Download with CoolDownloader". No context menu is possible if download is started with JavaScript or so.
One of the solutions is to implement your own multistream download manager (upgrade current Chrome download manager). It may allow restricted scripting (say through some API), auto change folder to which to save files (say restricted to subfolders in Download folder), download start/stop, custom UI, bandwidth management, scheduler or so.
Right now I'm forced to use Download Manager on Windows, and no solution for Linux yet.
Download Manager is updated quite often and always trying to install Yandex Bar as addon by default with every update (hate this).
Comment 46 by aa@chromium.org, Sep 15 2010
Sergei: I hadn't thought about the JavaScript-initiated download case, thanks for bringing it up. It seems possible to use a DM automation API to know when a download has started, then offer the user to download instead using CoolDownloader. But that's awkward UI and also getting into territory of APIs only one extension can implement.

I would still prefer to start with the most scalable APIs and see how they do. I'll add some notes to 1685 so we don't lose them.
There are other cases where the user doesn't see a link beforehand.  Consider for example HTML-generated redirects (meta refresh or perhaps javascript based).  The other case I'm dealing with is that there is a PDF embedded in an iframe that I want to download with my downloader rather than try to display inline (I want to special-case it for only certain sites, so a blanket mimetype rule won't do).

In any case, even in cases where a link appears beforehand, requiring the user to context-click is suboptimal from a usability perspective.
Comment 48 by dkapa...@gmail.com, Sep 21 2010
Similar to the requests above to adjust download location of files, I have a FF extension that changes the filename of downloads from autogenerated random numbers to something more user friendly. Ideally, this adjustment would be done when users are prompted to open or save a file in the browser, so that a user would only see the user friendly filename.

In FF, I'm able to do this by modifying response headers, so bug 50943 is potentially a solution for this use case, but only if the proposal to include blocking requests is implemented. Otherwise a rename() function in the Downloads API could serve the same function.
Status: Assigned
Hi,

I'm interested in downloads API
http://dev.chromium.org/developers/design-documents/extensions/downloads-api
because I'd like to help fixing the issue
http://code.google.com/p/chromium/issues/detail?id=1751

Would it be possible to add API to resume download?
The method signature will looks like this:

void resume(int id, string url)

This method resumes stopped(or interrupted, see below) download whose
ID is id with URL url.
(I omitted various bool flags such as paused, showInShelf because I
have no idea what they mean)

Also, it would be good to know when download is failed:

event onDownloadInterrupted(Download interrupted)

In issue1751, we would like to add Metalink support. Metalink contains
several URIs and if one URI fails(connection refused or interrupted or
painfully slow), then we can fall back to another URI.
So resuming download is critical for Metalink support.
Using above mentioned API, we can resume download using another URI
when we get onDownloadInterrupted event.

Status: Available
Labels: Feature-Downloads
So would the API provide a mechanism for an "Event" that calls a function (listener) that allows me to get info about the download before the user would normally be prompted to save?

Whether the user left-clicks a link, is redirected X times until the download is suppose to start, or right clicks and selects Save As.  This includes JavaScript that triggers a window.location(url) call that is a download.

So the event would let me grab the following information that I could hand to my own download manager:
    the full download URL
    the HTTP request method used (GET or POST)
    the HTTP request cookies (which might have auth info that some sites require for downloads)
    the HTTP response header with the content-disposition and filename

So the event triggers on download and has the opportunity to pass it along to Chrome's default download handler or to cancel it and manage itself.

My own manager could restart the download request itself (after cancelling the download in the event call) or the extension could prompt the user for info and change settings like the save location in the download that is about to start.
Re comment 55: We haven't really started to engage with what this API would look like, but those sound like reasonable requests, and we'll try to include your use case in our design.

Comment 57 by clemw@chromium.org, Feb 18 2011
Labels: ConOps
Excuse me, I seem to have accidentally included on this mailing list and I
would like to be removed if possible.
Comment 59 by mega...@gmail.com, Feb 19 2011
If you Star a bug you will be e-mailed any updates to the bug.  That is the whole purpose of the Star.  You will have to click the Star again to unsubscribe.
Comment 60 by bcha...@gmail.com, Feb 20 2011
How do I prevent the download shelf from hiding when I click to open a file?

I don't want the download shelf to disappear.

Usually:

1. I click to open the file and check it out.
2. Then, in most cases I'd click "Open File Location" in the download bar to move or delete the file.

I can't do this anymore since the download bar disappears. Yes, I know I can go the downloads tab, but it was WAY more convenient to have the previous behavior that did not "auto hide" the download bar.

How do I change this?


I agree with the comment above, I used to the two-steps as bcha wrote.
Comment 62 by mega...@gmail.com, Feb 20 2011
@bcha... You should look for or file a separate bug for that, this thread isn't really about that.  Right now you can't stop the download bar from hiding, workaround is to manage stuff from the downloads page using Ctrl+J.
Labels: -ConOps Hotlist-ConOps
I would very much like an API to start a download. But I would like the downloads.create method to have an parameter "suggested_filename". Actually I would be very happy if there would be just this function and nothing else:

downloads.create(string url, [string suggested_filename])
Comment 65 by riofr...@gmail.com, Mar 18 2011
I am trying to have all PPTs and DOCs open using Google Docs Viewer-generated PDFs, but I cannot, because I cannot detect all downloads, such as those made by Javascript--which are surprisingly common.

It'd be very useful.
Comment 66 by mega...@gmail.com, Mar 18 2011
The experimental webNavigation and webRequest APIs may be more useful, though I don't know if they can redirect or cancel navigation:

http://code.google.com/chrome/extensions/experimental.html

Of course you could always just write a NPAPI plugin to handle the appropriate filetypes and trigger a redirection (if that is possible).
Comment 67 by riofr...@gmail.com, Mar 18 2011
I thought of NPAPI---seemed overkill, but I might do it.

And the webNavigation and webRequest API actually seems really useful.
How do you cancel a Navigate or a Request?

Andres Riofrio
<riofrios@gmail.com>
Comment 68 by mega...@gmail.com, Mar 18 2011
As I said, not sure if they can.  They seem to hook into a bunch of stuff that's probably tied to the way webkit works... not too sure when some of those events would fire, or if you could block them with standard event stuff.

It's something to keep an eye on though, but as the page says they're experimental and may change or even be removed at any time.
Comment 69 by riofr...@gmail.com, Mar 18 2011
Right. I'll be watching this thread.

Andres Riofrio
<riofrios@gmail.com>
Labels: -mstone-x
Reply to Comment #64 >>

I think the prototype  might be closer to something like this:
>> chrome.downloadApi.start(str url, [str toLocation], [str toFilename]);
Or maybe the possibilty to move files out of the HTML 5 FileSystem API to a specified location.

Reply to Comment #66 >>

That idea would be fine for single downloads and wouldn't need anything to do with the background workings of Chrome. But if the user is optioned the idea of downloading, say 2 or more files at without the constant dialogs, this idea wouldn't work.

...
But yea it would be nice is this API would be able to give updates as to status, which file is being downloaded ( maybe through HTML 5 workers as to separate certain downloads from others if possible ), and what have you.

Just my 2 cents.
Cc: benjhayden@chromium.org
Labels: -Size-Large
I would like to make an extension that automatically closes the download bar 30 seconds after the last download finishes. Obviously this requires an API to be in place.
I need the download api, i want to specify the save location of specified url.
eg:
www.company.com:8080/*    "My Downloads\company"
*.xdownload.com/*         "My Downloads\xdownload"
*.(zip|rar)               "My Downloads\archieve" 

What's the status of this issue?
What's the status/labels mean?
Status: Available
Labels: -ConOps Hotlist-ConOps
Labels: -mstone-x
Labels: -Size-Large
Labels: Pri-2



The downloads extensions API will probably be very similar to that outlined at http://goo.gl/6hO1n
It will facilitate downloading files, moving downloaded files based on almost any criteria including mime, filename, and url, and replacing the shelf with a complete UI based on UI elements available to extensions including browser actions, page actions, tabs, notifications, and panels.

We don't know when it will be ready for use, even from the experimental namespace.
Mergedinto: 87436
Status: Duplicate
Even though this was entered earlier, marking this as a duplicate of 87436 which is the meta bug for the downloads extension API.
@cbentzel, if you merge this issue into 87436, it would be nice if we could star that issue, or at least look at it
however, issue 87436 gives me a 403 forbidden error
Exactly. For the people that want to follow this, we should be able to follow the 'new' issue. 403 for me too.
Mergedinto:
Owner: benjhayden@chromium.org
Status: Assigned
Reopening for purposes of external discussion; issue 87436 is just for tracking/administration.  
Sorry about the dup - didn't realize that the other issue was restricted.
Project Member Comment 81 by bugdroid1@chromium.org, Dec 14 2011
The following revision refers to this bug:
    http://src.chromium.org/viewvc/chrome?view=rev&revision=114460

------------------------------------------------------------------------
r114460 | benjhayden@chromium.org | Wed Dec 14 10:40:40 PST 2011

Changed paths:
 A http://src.chromium.org/viewvc/chrome/trunk/src/content/browser/download/download_query.h?r1=114460&r2=114459&pathrev=114460
 M http://src.chromium.org/viewvc/chrome/trunk/src/content/content_browser.gypi?r1=114460&r2=114459&pathrev=114460
 A http://src.chromium.org/viewvc/chrome/trunk/src/content/browser/download/download_query.cc?r1=114460&r2=114459&pathrev=114460
 M http://src.chromium.org/viewvc/chrome/trunk/src/content/content_tests.gypi?r1=114460&r2=114459&pathrev=114460
 A http://src.chromium.org/viewvc/chrome/trunk/src/content/browser/download/download_query_unittest.cc?r1=114460&r2=114459&pathrev=114460

DownloadQuery filters and sorts DownloadItems

DownloadQuery will be used first by the DownloadsSearchFunction in download_extension_api.h/cc to implement the chrome.experimental.downloads.search() function outlined in http://goo.gl/6hO1n

BUG=12133
TEST=content_unittests DownloadQueryTest

Review URL: http://codereview.chromium.org/8601012
------------------------------------------------------------------------
Unfortunately, I'm unable to access the proposal API which has now been moved here - http://goo.gl/6hO1n.

Apparently, I require permission to view it, which I've requested.

Thanks.
Try again? The permissions are set so that anyone on the web can find and
view. I just confirmed by opening it in an incognito window without logging
in.
It still fails for me (logged in a Google Apps for Business), but opening the same url in incognito works correctly. Not sure if anyone else with Google Apps can see/replicate this?

Thanks.
Comment 85 by Deleted ...@, Dec 15 2011
My public Google account and Google Apps (free) account can both view the document. Still not confirmed with a Google Apps for Business/Education/Government/Nonprofit.
Project Member Comment 86 by bugdroid1@chromium.org, Dec 16 2011
The following revision refers to this bug:
    http://src.chromium.org/viewvc/chrome?view=rev&revision=114734

------------------------------------------------------------------------
r114734 | asanka@chromium.org | Thu Dec 15 17:14:36 PST 2011

Changed paths:
 A http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/download/download_extension_test.cc?r1=114734&r2=114733&pathrev=114734
 M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/api/extension_api.json?r1=114734&r2=114733&pathrev=114734
 M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/download/download_extension_apitest.cc?r1=114734&r2=114733&pathrev=114734
 M http://src.chromium.org/viewvc/chrome/trunk/src/content/browser/download/download_manager_impl.cc?r1=114734&r2=114733&pathrev=114734
 M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/download/download_extension_api.cc?r1=114734&r2=114733&pathrev=114734
 M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/test/data/extensions/api_test/downloads/test.js?r1=114734&r2=114733&pathrev=114734
 M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/download/download_extension_api.h?r1=114734&r2=114733&pathrev=114734
 M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/chrome_tests.gypi?r1=114734&r2=114733&pathrev=114734

Implement chrome.experimental.downloads.pause(), cancel() and resume().

BUG=12133
TEST=browser_tests --gtest_filter=DownloadsApiTest.*


Review URL: http://codereview.chromium.org/8517010
------------------------------------------------------------------------
Cc: asanka@chromium.org
Project Member Comment 88 by bugdroid1@chromium.org, Jan 9 2012
The following revision refers to this bug:
    http://src.chromium.org/viewvc/chrome?view=rev&revision=116898

------------------------------------------------------------------------
r116898 | asanka@chromium.org | Mon Jan 09 11:38:02 PST 2012

Changed paths:
 A http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/download/download_file_icon_extractor.h?r1=116898&r2=116897&pathrev=116898
 M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/extension_function_dispatcher.cc?r1=116898&r2=116897&pathrev=116898
 M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/api/experimental.downloads.json?r1=116898&r2=116897&pathrev=116898
 M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/download/download_extension_test.cc?r1=116898&r2=116897&pathrev=116898
 M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/download/download_extension_api.cc?r1=116898&r2=116897&pathrev=116898
 M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/test/data/extensions/api_test/downloads/test.js?r1=116898&r2=116897&pathrev=116898
 M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/download/download_extension_api.h?r1=116898&r2=116897&pathrev=116898

Implement chrome.experimental.downloads.getFileIcon().

BUG=12133
TEST=browser_tests --gtest_filter=DownloadExtensionTest.*:DownloadsApiTest.*

Review URL: http://codereview.chromium.org/8519004
------------------------------------------------------------------------
Project Member Comment 89 by bugdroid1@chromium.org, Jan 25 2012
The following revision refers to this bug:
    http://src.chromium.org/viewvc/chrome?view=rev&revision=119085

------------------------------------------------------------------------
r119085 | benjhayden@chromium.org | Wed Jan 25 09:46:53 PST 2012

Changed paths:
 D http://src.chromium.org/viewvc/chrome/trunk/src/content/browser/download/download_query.h?r1=119085&r2=119084&pathrev=119085
 M http://src.chromium.org/viewvc/chrome/trunk/src/content/browser/download/mock_download_manager.h?r1=119085&r2=119084&pathrev=119085
 M http://src.chromium.org/viewvc/chrome/trunk/src/content/content_browser.gypi?r1=119085&r2=119084&pathrev=119085
 M http://src.chromium.org/viewvc/chrome/trunk/src/content/public/browser/download_manager.h?r1=119085&r2=119084&pathrev=119085
 M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/api/experimental.downloads.json?r1=119085&r2=119084&pathrev=119085
 M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/download/download_extension_test.cc?r1=119085&r2=119084&pathrev=119085
 D http://src.chromium.org/viewvc/chrome/trunk/src/content/browser/download/download_query.cc?r1=119085&r2=119084&pathrev=119085
 M http://src.chromium.org/viewvc/chrome/trunk/src/content/browser/download/download_manager_impl.cc?r1=119085&r2=119084&pathrev=119085
 M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/download/download_extension_api.cc?r1=119085&r2=119084&pathrev=119085
 A http://src.chromium.org/viewvc/chrome/trunk/src/content/public/browser/download_query.cc?r1=119085&r2=119084&pathrev=119085
 M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/download/download_extension_api.h?r1=119085&r2=119084&pathrev=119085
 A http://src.chromium.org/viewvc/chrome/trunk/src/content/public/browser/download_query.h?r1=119085&r2=119084&pathrev=119085
 M http://src.chromium.org/viewvc/chrome/trunk/src/content/browser/download/download_manager_impl.h?r1=119085&r2=119084&pathrev=119085
 M http://src.chromium.org/viewvc/chrome/trunk/src/content/browser/download/download_query_unittest.cc?r1=119085&r2=119084&pathrev=119085

DownloadsSearchFunction implements chrome.experimental.downloads.search() using DownloadQuery.

BUG=12133


Review URL: http://codereview.chromium.org/8917019
------------------------------------------------------------------------
Project Member Comment 90 by bugdroid1@chromium.org, Feb 14 2012
The following revision refers to this bug:
    http://src.chromium.org/viewvc/chrome?view=rev&revision=121912

------------------------------------------------------------------------
r121912 | benjhayden@chromium.org | Tue Feb 14 11:14:50 PST 2012

Changed paths:
 M http://src.chromium.org/viewvc/chrome/trunk/src/net/tools/testserver/testserver.py?r1=121912&r2=121911&pathrev=121912
 M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/download/download_extension_api.cc?r1=121912&r2=121911&pathrev=121912
 M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/test/data/extensions/api_test/downloads/test.js?r1=121912&r2=121911&pathrev=121912
 M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/download/download_extension_api.h?r1=121912&r2=121911&pathrev=121912

Implement chrome.experimental.downloads.onChanged

ExtensionDownloadsEventRouter now also observes all DownloadItems and dispatches onChanged events.

Download.OnChanged records the percentage of OnDownloadUpdated() calls that are propagated as onChanged events instead of being suppressed.

BUG=12133

Review URL: http://codereview.chromium.org/8203005
------------------------------------------------------------------------
Project Member Comment 91 by bugdroid1@chromium.org, Feb 14 2012
The following revision refers to this bug:
    http://src.chromium.org/viewvc/chrome?view=rev&revision=121915

------------------------------------------------------------------------
r121915 | vollick@google.com | Tue Feb 14 11:49:14 PST 2012

Changed paths:
 M http://src.chromium.org/viewvc/chrome/trunk/src/net/tools/testserver/testserver.py?r1=121915&r2=121914&pathrev=121915
 M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/download/download_extension_api.cc?r1=121915&r2=121914&pathrev=121915
 M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/test/data/extensions/api_test/downloads/test.js?r1=121915&r2=121914&pathrev=121915
 M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/download/download_extension_api.h?r1=121915&r2=121914&pathrev=121915

Revert 121912 - Implement chrome.experimental.downloads.onChanged

Attempting to fix leak in DownloadProtectionServiceTest.CheckClientDownloadValidateRequest

ExtensionDownloadsEventRouter now also observes all DownloadItems and dispatches onChanged events.

Download.OnChanged records the percentage of OnDownloadUpdated() calls that are propagated as onChanged events instead of being suppressed.

BUG=12133

Review URL: http://codereview.chromium.org/8203005

TBR=benjhayden@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9360051
------------------------------------------------------------------------
Project Member Comment 92 by bugdroid1@chromium.org, Mar 14 2012
The following revision refers to this bug:
    http://src.chromium.org/viewvc/chrome?view=rev&revision=126688

------------------------------------------------------------------------
r126688 | benjhayden@chromium.org | Wed Mar 14 11:32:06 PDT 2012

Changed paths:
 M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/experimental.managedMode.html?r1=126688&r2=126687&pathrev=126688
 A http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/static/experimental.downloads.html?r1=126688&r2=126687&pathrev=126688
 M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/ttsEngine.html?r1=126688&r2=126687&pathrev=126688
 M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/template/api_template.html?r1=126688&r2=126687&pathrev=126688
 M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/tts.html?r1=126688&r2=126687&pathrev=126688
 M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/experimental.html?r1=126688&r2=126687&pathrev=126688
 M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/api/experimental.downloads.json?r1=126688&r2=126687&pathrev=126688
 M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/js/api_page_generator.js?r1=126688&r2=126687&pathrev=126688
 A http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/experimental.downloads.html?r1=126688&r2=126687&pathrev=126688
 M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/samples.json?r1=126688&r2=126687&pathrev=126688
 M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/samples.html?r1=126688&r2=126687&pathrev=126688

experimental.downloads extension api docs
staged: http://goto.google.com/jojso
BUG=12133

Review URL: http://codereview.chromium.org/9452019
------------------------------------------------------------------------
Since Chrome 14 anchor elements support the download attribute. For me this is all I need. With Blobs and object URLs I can even download any data generated with JavaScript.

function download (url, filename) {
	var link = document.createElement('a');
	link.setAttribute('href',url);
	link.setAttribute('download',filename);
	var event = document.createEvent('MouseEvents');
	event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
	link.dispatchEvent(event);
}
Blocking: -68201 chromium:68201 chromium:68201
Comment 95 by vdsa...@gmail.com, Jul 10 2012
What bloody.albatross mentioned in comment #93 worked for me for some time - my extension could download multiple images using this exact trick - triggering the click event on multiple anchor elements that have the "download" attribute:
function startDownload() {
  for (var i = 0; i < visibleImages.length; i++) {
    if (document.getElementById('checkbox' + i).checked) {
      document.getElementById('anchor' + i).click();
    }
  }
}

However, this stopped working in Chrome dev v21 a few weeks ago, and now doesn't work in Chrome beta since it's gone to v21 today as well.

I would love to use the experimental download APIs, but AFAIK extensions that have experimental permissions can't be published to the web store. I'm not really sure what to do, the extension has several thousand users and it would be very disappointing if it suddenly stopped working for everyone using Chrome stable when it hits v21.
@95, vdsabev, is that code running in a tab, a background page, or a popup/bubble? Can it download the first file but not subsequent files?
Automatic downloads after the first require user gesture for security purposes. Tabs get a butter-bar (yellow prompt bar) to allow the user to accept subsequent automatic downloads, but butter-bars cannot be applied to background pages or popups/bubbles.
See https://chromiumcodereview.appspot.com/10412061

The chrome.downloads API is now available in the dev channel >=22.0.1201.0 without the --enable-experimental-extension-apis flag. Note that the api will only work on the dev channel. The webstore should accept extensions that use chrome.downloads; LMK if it doesn't.

Comment 97 by vdsa...@gmail.com, Jul 10 2012
The code runs in a popup bubble... I understand now, thank you very much for the clarifications!
It seems I'm going to have to somehow refactor the extension to work in a separate tab instead. At least until v22 becomes mainstream, which I suppose should be in about 12 weeks?

Thanks again for your help :)
I have experienced a problem similar to what vdsabev mentions. What i've seen since Chrome V21 is that it randomly stops working. I can't pinpoint the exact problem and i can't always reproduce it, but it happens frequently on photobucket images embedded on twitter.

Like this one:
http://twitter.com/L2012PoolCam/status/231149919027748864/photo/1

If i create an anchor with the download attribute with a href that points to the url of the image, and click it (programmatically or with an actual mouse click) sometimes the file gets downloaded and sometimes it doesn't.

If we try the same in the image location itself, like:
http://p.twimg.com/AzU1oG3CYAA3T_-.jpg:large

And do the same (create a special anchor and click it), when it doesn't work i can actually see in the network tab of the dev tools how it fetches the image, but it doesn't actually save it to the filesystem.
Comment 99 Deleted
It's good to see some features in the dev channel, but there are a couple of problems.

1) 'filename' is inconsistent with all the other properties being camel case

2) There is no 'erase' function, although there is an 'onErased' event. History API provides this remove-one-item functionality. Again, it seems inconsistent. Only thing you can do is to clear a specific time period with the BrowsingData API.

3) 'paused' should be merged into 'state'. State should be: 'in_progress' | 'interrupted' | 'complete' | 'paused'

4) Is there any API reference for the  'error' property? I didn't find one. I guess this helps to distinguish between server interruption and when the user cancels the download.

5) No way to alter the download shelf or at lease disable it.

6) No way to open a downloaded file or a downloads (sub)folder on computer. At least the latter is a must have for any alternative downloads UI.
@galambalazs #100

Thank you for the feedback!

1) 'filename' is sometimes two words and sometimes one. There doesn't appear to be a clear consensus. I went with 'filename' primarily because it's easier to type and more consistent with our code.
http://en.wikipedia.org/wiki/Filename

2) erase() is on the way. http://codereview.chromium.org/10834129/

3) We debated making |paused| a state. We debated for a very long time. That doesn't mean that we're positive that we made the right decision, it just means that we didn't not think about it. It is possible that we could decide to make it a state before promoting the api to the beta channel. If you feel strongly that |paused| should be a state, please file a separate bug and we can discuss it there at some point before promotion to beta. We don't have time right now to consider making |paused| a state, but we will consider before promoting the api to the beta channel if there's an open bug about it. Please use the 'Feature-Downloads' and 'Area-UI' tags and mention the downloads extension API.

4) No, there is no api reference for the error property. We've thought a little about this property, but not much. Computing it is far more complicated than it may appear. At one point, there was a small amount of documentation for |error|, but it was deemed too complicated, and we saw other APIs that exposed a similar concept, and they documented their |error| fields in the way that you see for |DownloadItem.error|. Again, feel free to file a separate bug and we'll see what we can do.

5) There used to be a --new-downloads-ui flag that disabled the shelf, but it caused too many bug reports. ("Where did my downloads go?" :-) We are planning on replacing the shelf with a new ui at some point, but other projects have been prioritized. Again, feel free to file a separate bug for --disable-downloads-shelf, and I'll be happy to resurrect the functionality once the bug has a sufficient number of stars. To be honest, I miss the flag, too. It's more a matter of figuring out the schedule for the new ui and how to document the flag so that it doesn't generate too many bug reports, as well as user demand (bug stars).

6) open() and show() are on the way. http://codereview.chromium.org/10836003/ http://codereview.chromium.org/10828120/

Thanks again for the feedback!
Comment 102 by mega...@gmail.com, Aug 10 2012
I believe pieman was asking for a way to PROGRAMMATICALLY disable the downloads shelf, so an extension could completely take over the functionality.
Cc: -rafaelw@chromium.org
Ah, thanks for the clarification.

The downloads ui is a very sensitive part of chrome from a security perspective, so it is unlikely that we will ever be able to allow extensions to completely replace chrome's downloads ui. We have plans to allow extensions to *extend* chrome://downloads in a limited and safe way, and extensions may *add* browser action buttons, but replacing the downloads ui entirely is not likely in the foreseeable future. Witness the search engine hijacking security issues.
With the --disable-downloads-shelf flag, extensions could suggest that users set that flag.

Please also feel free to write a download manager extension as a browser action to demonstrate a better ui. If a download manager extension gains sufficient popularity, we may consider adopting something like it as chrome's native downloads ui. That's a more likely way that extensions could replace the ui, but slower and safer.
Comment 105 by Deleted ...@, Aug 22 2012
chrome download interrupted and unable to resume ????
Cc: glen@chromium.org
Issue 3771 has been merged into this issue.
Project Member Comment 107 by bugdroid1@chromium.org, Dec 8 2012
Blocking: -chromium:68201
The following revision refers to this bug:
    http://src.chromium.org/viewvc/chrome?view=rev&revision=171886

------------------------------------------------------------------------
r171886 | benjhayden@chromium.org | 2012-12-07T23:56:05.214342Z

Changed paths:
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc?r1=171886&r2=171885&pathrev=171886
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/api/downloads/downloads_api.cc?r1=171886&r2=171885&pathrev=171886
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/api/downloads/downloads_api.h?r1=171886&r2=171885&pathrev=171886
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/api/downloads.idl?r1=171886&r2=171885&pathrev=171886

Implement chrome.downloads.open()
BUG=12133

Review URL: https://chromiumcodereview.appspot.com/10836003
------------------------------------------------------------------------
Project Member Comment 108 by bugdroid1@chromium.org, Dec 14 2012
The following revision refers to this bug:
    http://src.chromium.org/viewvc/chrome?view=rev&revision=173027

------------------------------------------------------------------------
r173027 | benjhayden@chromium.org | 2012-12-14T00:58:09.861034Z

Changed paths:
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/api/downloads/downloads_api.cc?r1=173027&r2=173026&pathrev=173027
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/api/downloads.idl?r1=173027&r2=173026&pathrev=173027

Implement chrome.downloads.show()
BUG=12133


Review URL: https://chromiumcodereview.appspot.com/10828120
------------------------------------------------------------------------
Project Member Comment 109 by bugdroid1@chromium.org, Dec 14 2012
The following revision refers to this bug:
    http://src.chromium.org/viewvc/chrome?view=rev&revision=173078

------------------------------------------------------------------------
r173078 | benjhayden@chromium.org | 2012-12-14T04:13:03.008256Z

Changed paths:
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc?r1=173078&r2=173077&pathrev=173078
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/api/downloads/downloads_api.cc?r1=173078&r2=173077&pathrev=173078
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/api/downloads/downloads_api.h?r1=173078&r2=173077&pathrev=173078
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/api/downloads.idl?r1=173078&r2=173077&pathrev=173078

Implement chrome.downloads.erase()
BUG=12133

Review URL: https://chromiumcodereview.appspot.com/10834129
------------------------------------------------------------------------
Nice to see the progress on this. 
Is it possible to detect "removed" files like the built-in downloads page does?
Project Member Comment 111 by bugdroid1@chromium.org, Jan 3 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/chrome?view=rev&revision=175043

------------------------------------------------------------------------
r175043 | benjhayden@chromium.org | 2013-01-03T23:17:35.357630Z

Changed paths:
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/api/downloads/downloads_api.cc?r1=175043&r2=175042&pathrev=175043
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/api/downloads.idl?r1=175043&r2=175042&pathrev=175043

Implement chrome.downloads.drag()
PS1@r172879
BUG=12133


Review URL: https://chromiumcodereview.appspot.com/11566012
------------------------------------------------------------------------
Project Member Comment 112 by bugdroid1@chromium.org, Jan 4 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/chrome?view=rev&revision=175062

------------------------------------------------------------------------
r175062 | benjhayden@chromium.org | 2013-01-04T00:09:50.223567Z

Changed paths:
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/download/download_query_unittest.cc?r1=175062&r2=175061&pathrev=175062
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/download/download_query.cc?r1=175062&r2=175061&pathrev=175062
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/download/download_query.h?r1=175062&r2=175061&pathrev=175062
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/api/downloads/downloads_api.cc?r1=175062&r2=175061&pathrev=175062
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/api/downloads.idl?r1=175062&r2=175061&pathrev=175062
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/chrome_tests_unit.gypi?r1=175062&r2=175061&pathrev=175062
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/chrome_tests.gypi?r1=175062&r2=175061&pathrev=175062

Fix times in chrome.downloads extension API to use ISO8601 instead of int32s, which are too small.
Also implement DownloadItem.endTime, DownloadQuery.endTime/endedBefore/endedAfter, DownloadQuery.orderBy='endTime'.
BUG=12133


Review URL: https://chromiumcodereview.appspot.com/11593010
------------------------------------------------------------------------
Project Member Comment 113 by bugdroid1@chromium.org, Jan 14 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/chrome?view=rev&revision=176614

------------------------------------------------------------------------
r176614 | benjhayden@chromium.org | 2013-01-14T00:58:52.150944Z

Changed paths:
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/download/download_query_unittest.cc?r1=176614&r2=176613&pathrev=176614
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/download/download_query.cc?r1=176614&r2=176613&pathrev=176614
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/download/download_query.h?r1=176614&r2=176613&pathrev=176614
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/api/downloads/downloads_api.cc?r1=176614&r2=176613&pathrev=176614
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/api/downloads/downloads_api.h?r1=176614&r2=176613&pathrev=176614
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/api/downloads.idl?r1=176614&r2=176613&pathrev=176614

chrome.downloads.DownloadItem.exists indicates to extensions whether a downloaded file still exists on the file system.
Make chrome.downloads.search() check for file existence no more frequently than once every 10 seconds.
BUG=12133


Review URL: https://chromiumcodereview.appspot.com/11637020
------------------------------------------------------------------------
Project Member Comment 114 by bugdroid1@chromium.org, Jan 18 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/chrome?view=rev&revision=177726

------------------------------------------------------------------------
r177726 | benjhayden@chromium.org | 2013-01-18T19:19:03.488316Z

Changed paths:
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/download/download_danger_prompt.h?r1=177726&r2=177725&pathrev=177726
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/download/download_danger_prompt_browsertest.cc?r1=177726&r2=177725&pathrev=177726
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/api/downloads/downloads_api.cc?r1=177726&r2=177725&pathrev=177726
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/api/downloads/downloads_api.h?r1=177726&r2=177725&pathrev=177726
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/api/downloads.idl?r1=177726&r2=177725&pathrev=177726
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/ui/webui/downloads_dom_handler.cc?r1=177726&r2=177725&pathrev=177726
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/download/download_danger_prompt.cc?r1=177726&r2=177725&pathrev=177726

Implement chrome.downloads.acceptDanger()
BUG=12133
TBR=mkearney

Review URL: https://chromiumcodereview.appspot.com/10850004
------------------------------------------------------------------------
+benjhayden downloads.idl:406: $ref: instead of $ref.
Project Member Comment 116 by bugdroid1@chromium.org, Jan 22 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/chrome?view=rev&revision=178025

------------------------------------------------------------------------
r178025 | benjhayden@chromium.org | 2013-01-22T17:27:45.209773Z

Changed paths:
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/api/downloads.idl?r1=178025&r2=178024&pathrev=178025

Fix typo in downloads.idl.
PS1@r177850
BUG=12133
TBR=mkearney

Review URL: https://chromiumcodereview.appspot.com/11926034
------------------------------------------------------------------------
Project Member Comment 117 by bugdroid1@chromium.org, Mar 3 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/chrome?view=rev&revision=185811

------------------------------------------------------------------------
r185811 | benjhayden@chromium.org | 2013-03-03T21:57:57.449192Z

Changed paths:
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/permissions/permission_set_unittest.cc?r1=185811&r2=185810&pathrev=185811
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/renderer/resources/renderer_resources.grd?r1=185811&r2=185810&pathrev=185811
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc?r1=185811&r2=185810&pathrev=185811
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/api/downloads/downloads_api.cc?r1=185811&r2=185810&pathrev=185811
   A http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/api/downloads_internal.idl?r1=185811&r2=185810&pathrev=185811
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/extension_function_histogram_value.h?r1=185811&r2=185810&pathrev=185811
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/download/download_service.cc?r1=185811&r2=185810&pathrev=185811
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/permissions/api_permission.cc?r1=185811&r2=185810&pathrev=185811
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/api/api.gyp?r1=185811&r2=185810&pathrev=185811
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/download/download_service.h?r1=185811&r2=185810&pathrev=185811
   M http://src.chromium.org/viewvc/chrome/trunk/src/WATCHLISTS?r1=185811&r2=185810&pathrev=185811
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/download/chrome_download_manager_delegate.h?r1=185811&r2=185810&pathrev=185811
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/permissions/api_permission.h?r1=185811&r2=185810&pathrev=185811
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/event_names.cc?r1=185811&r2=185810&pathrev=185811
   A http://src.chromium.org/viewvc/chrome/trunk/src/chrome/test/data/extensions/api_test/downloads_spanning?r1=185811&r2=185810&pathrev=185811
   A http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/api/downloads_internal/downloads_internal_api.h?r1=185811&r2=185810&pathrev=185811
   A http://src.chromium.org/viewvc/chrome/trunk/src/chrome/test/data/extensions/api_test/downloads_spanning/empty.html?r1=185811&r2=185810&pathrev=185811
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/permissions/permission_set.cc?r1=185811&r2=185810&pathrev=185811
   A http://src.chromium.org/viewvc/chrome/trunk/src/chrome/renderer/resources/extensions/downloads_custom_bindings.js?r1=185811&r2=185810&pathrev=185811
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/api/downloads/downloads_api.h?r1=185811&r2=185810&pathrev=185811
   A http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/downloads/downloads_overwrite?r1=185811&r2=185810&pathrev=185811
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/api/downloads.idl?r1=185811&r2=185810&pathrev=185811
   A http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/downloads/downloads_overwrite/bg.js?r1=185811&r2=185810&pathrev=185811
   A http://src.chromium.org/viewvc/chrome/trunk/src/chrome/test/data/extensions/api_test/downloads_spanning/manifest.json?r1=185811&r2=185810&pathrev=185811
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/chrome_browser_extensions.gypi?r1=185811&r2=185810&pathrev=185811
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/download/chrome_download_manager_delegate.cc?r1=185811&r2=185810&pathrev=185811
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/renderer/resources/extensions/event.js?r1=185811&r2=185810&pathrev=185811
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/event_names.h?r1=185811&r2=185810&pathrev=185811
   A http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/downloads/downloads_overwrite/manifest.json?r1=185811&r2=185810&pathrev=185811
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/renderer/extensions/dispatcher.cc?r1=185811&r2=185810&pathrev=185811
   A http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/api/downloads_internal?r1=185811&r2=185810&pathrev=185811
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/test/data/extensions/api_test/downloads_split/manifest.json?r1=185811&r2=185810&pathrev=185811
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/api/web_request/web_request_api.cc?r1=185811&r2=185810&pathrev=185811
   A http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/api/downloads_internal/downloads_internal_api.cc?r1=185811&r2=185810&pathrev=185811
   M http://src.chromium.org/viewvc/chrome/trunk/src/tools/json_schema_compiler/idl_schema.py?r1=185811&r2=185810&pathrev=185811
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/renderer/resources/extensions/web_request_custom_bindings.js?r1=185811&r2=185810&pathrev=185811

Implement chrome.downloads.onDeterminingFilename() to allow extensions to participate in the download filename determination process.

Docs staged: http://basho.cam.corp.google.com:8000/extensions/downloads.html#event-onDeterminingFilename

Example:
chrome.downloads.onDeterminingFilename.addListener(function(item, suggest) {
  suggest({filename: item.filename, overwrite: true});
});
chrome.downloads.onDeterminingFilename.addListener(function(item, suggest) {
  window.setTimeout(function() {
    suggest({filename: item.mime.split('/')[0] + '/' + item.filename, overwrite: false});
  }, 1);
  return true;  // handling asynchronously
});

BUG=12133
BUG=68108

Review URL: https://chromiumcodereview.appspot.com/11574006
------------------------------------------------------------------------
Project Member Comment 118 by bugdroid1@chromium.org, Mar 5 2013
The following revision refers to this bug:
    http://src.chromium.org/viewvc/chrome?view=rev&revision=186038

------------------------------------------------------------------------
r186038 | rafaelw@google.com | 2013-03-05T00:10:37.803392Z

Changed paths:
   M http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc?r1=186038&r2=186037&pathrev=186038

use DISABLED_ instead of FAILS_

From Pawel: "FAILS_ has no longer any special meaning. Please use DISABLED_ if needed."

TBR=benjhayden_chromium, rdsmith
BUG=12133

Review URL: https://codereview.chromium.org/12379088
------------------------------------------------------------------------
Project Member Comment 119 by bugdroid1@chromium.org, Mar 10 2013
Labels: -Feature-Extensions -Area-UI -Feature-Downloads Cr-Platform-Extensions Cr-UI Cr-UI-Browser-Downloads
when downloading how to make the browser save files to different pathes accroding to the filename extension?  I can only set one path for all files so far
#120: http://developer.chrome.com/dev/extensions/downloads.html#event-onDeterminingFilename

chrome.downloads.onDeterminingFilename.addListener(function (item, suggest) {
  if (item.filename.lastIndexOf('.') > 0) {
    var ext = item.filename.substr(item.filename.lastIndexOf('.')).substr(1);
    item.filename = ext + '/' + item.filename;
  }
  suggest({filename: item.filename});
});
Status: Fixed
The api is complete and on the beta channel now, and could hit the stable channel for M29, so I'm going to close this bug now. I'll file a launch issue in a few weeks. If there are features/uses that the api doesn't address, please file a new separate issue for them at http://crbug.com/new
Sign in to add a comment