Index: chrome/common/extensions/api/downloads.idl |
diff --git a/chrome/common/extensions/api/downloads.idl b/chrome/common/extensions/api/downloads.idl |
index db7116520a5fc74a55124a2a378bf4446fd3d33f..425080f982390312230be1c014cec94916314d9a 100644 |
--- a/chrome/common/extensions/api/downloads.idl |
+++ b/chrome/common/extensions/api/downloads.idl |
@@ -12,6 +12,19 @@ namespace downloads { |
DOMString value; |
}; |
+ // $ref:onDeterminingFilename handlers may return a FilenameDetermination |
+ // object in order to override a download's target filename. |
mkearney1
2013/02/05 22:00:02
Should this link to filename? I can't see the stag
benjhayden
2013/02/21 22:29:33
Done.
|
+ dictionary FilenameDetermination { |
+ // The download's new target filename, as a path relative to the user's |
+ // default Downloads directory, possibly containing subdirectories. Absolute |
Matt Perry
2013/02/04 22:30:19
How do we handle path separators in a cross-platfo
benjhayden
2013/02/05 15:08:05
FilePath allows either / or \ as a path separator
|
+ // paths, empty paths, and paths containing back-references ".." will be |
+ // ignored. |
+ DOMString filename; |
+ |
+ // Whether to overwrite any existing files. |
+ boolean? overwrite; |
+ }; |
+ |
[inline_doc] enum HttpMethod {GET, POST}; |
[inline_doc] dictionary DownloadOptions { |
@@ -396,9 +409,6 @@ namespace downloads { |
// then <code>callback</code> will be called. |
static void erase(DownloadQuery query, optional EraseCallback callback); |
- // TODO(benjhayden) Comment. |
- [nodoc] static void setDestination(long downloadId, DOMString relativePath); |
- |
// Prompt the user to accept a dangerous download. Does not automatically |
// accept dangerous downloads. If the download is accepted, then an |
// $ref:onChanged event will fire, otherwise nothing will happen. When all |
@@ -427,5 +437,15 @@ namespace downloads { |
// except <code>bytesReceived</code> changes, this event fires with the |
// <code>downloadId</code> and an object containing the properties that changed. |
static void onChanged(DownloadDelta downloadDelta); |
+ |
+ // During the filename determination process, extensions will be given the |
+ // opportunity to override the target filename. Handlers may return null in |
mkearney1
2013/02/05 22:00:02
Should target filename be a link?
benjhayden
2013/02/21 22:29:33
Done.
|
+ // order to allow the target filename to be used, or return a |
+ // $ref:FilenameDetermination object in order to override the target |
+ // filename. If more than one extension overrides the filename, then the |
+ // last handler registered in the last extension installed that returns a |
+ // $ref:FilenameDetermination object wins. Users should not install |
+ // extensions that may conflict. |
+ static void onDeterminingFilename(DownloadItem downloadItem); |
Matt Perry
2013/02/04 22:30:19
Does this really need to be a synchronous API? Wha
benjhayden
2013/02/05 15:08:05
The download system does already start writing to
Randy Smith (Not in Mondays)
2013/02/05 16:40:41
I'd like to second this point--this type of race s
Matt Perry
2013/02/05 20:49:39
OK, sounds like this won't work.
benjhayden
2013/02/05 21:12:19
I am planning on augmenting the onDeterminingFilen
Matt Perry
2013/02/05 21:57:10
I see. In that case, I'd prefer we always use the
benjhayden
2013/02/21 22:29:33
Done.
|
}; |
}; |