Repository navigation
Add more download supports in Electron - #2840
Conversation
|
@hokein That looks perfect! One small question - is there a way to detect whether the Content Disposition was inline or attachment? That would let me know if the file that was being downloaded (mostly PDF's in our case) was meant to be viewed in the application or saved for later viewing. I'm not sure if the getMimeType() returns that information or not. Otherwise I think you've got everything I'm after! Thanks for looking at this! |
8f946bf to
997ac91
Compare
* Rename `completed` to `done`, making it align with Chromium's style. * Add 'state' in `done` event's result. It can check the download item final status: cancelled, completed, interrupted.
e881bba to
5ef9c7e
Compare
|
How about fully relying on session.on 'will-download', (event, item) ->
savePath = require('dialog').openSaveDialog()
if savePath
item.setSavePath(savePath)
else
item.cancel()And if user doesn't set a path for download item, we then use the original routine to determine the save path. In this way we no longer need to a bunch of other APIs to control how to show the dialog. |
There was a problem hiding this comment.
Since one content::DownloadItem maps to one api::DownloadItem, I think we no longer need to do the comparison?
|
We need to store the JavaScript |
There was a problem hiding this comment.
I don't think we need to inherit mate::TrackableObject, we don't need to enumerate all items and there is no need to destroy the item on exit.
|
I think calling the Open Save Dialog only when needed would be just fine! |
|
@hokein Any more progress on this? Thanks for looking at it! |
52271a2 to
0861d5d
Compare
Previously, the suggested file name(Always 'empty') returned by 'download_item->GetSuggestedFilename' is not the same with the default one saved in local disk. The patch reimplement this API allowing it to return the default file name, which is more expected from user.
38f57b2 to
1879392
Compare
There was a problem hiding this comment.
We usually hide the constructor under protected: if there is a Create method.
|
Awesome, thanks! |
Add more download supports in Electron
|
The "interrupted" constant has a typo :) |
Fixes #2491.
This patch indroduces:
session.setOpenDownloadDialogdownloadItem.setSavePathAPI for allowing user enable/disable the prompted save dialog.itemreturned inwill-downloadevent as an EventEmitter and add more APIs to control the download item.ToDo
\cc @kjlaw89