Index: chrome/common/extensions/api/downloads.idl |
diff --git a/chrome/common/extensions/api/downloads.idl b/chrome/common/extensions/api/downloads.idl |
index d5f87be56a3a4a17f5a685245ec8d6c721a56a27..48d9262c2e36b30986aaf54d48f96cb87d78037e 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. |
+ dictionary FilenameDetermination { |
+ // The download's new target filename, as a path relative to the user's |
+ // default Downloads directory, possibly containing subdirectories. Absolute |
+ // 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 { |
@@ -393,9 +406,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 |
@@ -424,5 +434,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 |
+ // 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 one |
+ // extension will win. There is no way to predict or choose which extension |
+ // will win. Users should be careful to not install extensions that may |
+ // conflict. |
+ static void onDeterminingFilename(DownloadItem downloadItem); |
}; |
}; |