OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 [permissions=downloads] | 5 [permissions=downloads] |
6 namespace downloads { | 6 namespace downloads { |
7 [inline_doc] dictionary HeaderNameValuePair { | 7 [inline_doc] dictionary HeaderNameValuePair { |
8 // Name of the HTTP header. | 8 // Name of the HTTP header. |
9 DOMString name; | 9 DOMString name; |
10 | 10 |
11 // Value of the HTTP header. | 11 // Value of the HTTP header. |
12 DOMString value; | 12 DOMString value; |
13 }; | 13 }; |
14 | 14 |
15 // <dl><dt>uniquify</dt> | 15 // <dl><dt>uniquify</dt> |
16 // <dd>To avoid duplication, the <code>filename</code> is changed to | 16 // <dd>To avoid duplication, the <code>filename</code> is changed to |
17 // include a counter before the filename extension.</dd> | 17 // include a counter before the filename extension.</dd> |
18 // <dt>overwrite</dt> | 18 // <dt>overwrite</dt> |
19 // <dd>The existing file will be overwritten with the new file.</dd> | 19 // <dd>The existing file will be overwritten with the new file.</dd> |
20 // <dt>prompt</dt> | 20 // <dt>prompt</dt> |
21 // <dd>The user will be prompted with a file chooser dialog.</dd> | 21 // <dd>The user will be prompted with a file chooser dialog.</dd> |
22 // </dl> | 22 // </dl> |
23 [inline_doc] enum FilenameConflictAction {uniquify, overwrite, prompt}; | 23 [inline_doc] enum FilenameConflictAction {uniquify, overwrite, prompt}; |
24 | 24 |
25 // $ref:onDeterminingFilename listeners may pass a $ref:FilenameSuggestion | 25 // $ref:onDeterminingFilename listeners may pass a |
26 // object to <code>suggest()</code> in order to override a download's target | 26 // <code>FilenameSuggestion</code> object to <code>suggest()</code> in order |
27 // filename. | 27 // to override a download's target filename. |
28 [inline_doc] dictionary FilenameSuggestion { | 28 [inline_doc] dictionary FilenameSuggestion { |
29 // The $ref:DownloadItem's new target $ref:DownloadItem.filename, as a path | 29 // The $ref:DownloadItem's new target $ref:DownloadItem.filename, as a path |
30 // relative to the user's default Downloads directory, possibly containing | 30 // relative to the user's default Downloads directory, possibly containing |
31 // subdirectories. Absolute paths, empty paths, and paths containing | 31 // subdirectories. Absolute paths, empty paths, and paths containing |
32 // back-references ".." will be ignored. | 32 // back-references ".." will be ignored. |
33 DOMString filename; | 33 DOMString filename; |
34 | 34 |
35 // The action to take if $ref:FilenameSuggestion.filename already exists. | 35 // The action to take if <code>FilenameSuggestion.filename</code> already |
| 36 // exists. |
36 FilenameConflictAction? conflict_action; | 37 FilenameConflictAction? conflict_action; |
37 }; | 38 }; |
38 | 39 |
39 [inline_doc] enum HttpMethod {GET, POST}; | 40 [inline_doc] enum HttpMethod {GET, POST}; |
40 | 41 |
41 [inline_doc] dictionary DownloadOptions { | 42 [inline_doc] dictionary DownloadOptions { |
42 // The URL to download. | 43 // The URL to download. |
43 DOMString url; | 44 DOMString url; |
44 | 45 |
45 // A file path relative to the Downloads directory to contain the downloaded | 46 // A file path relative to the Downloads directory to contain the downloaded |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 // extension may not register more than one listener for this event. Each | 459 // extension may not register more than one listener for this event. Each |
459 // listener must call <code>suggest</code> exactly once, either | 460 // listener must call <code>suggest</code> exactly once, either |
460 // synchronously or asynchronously. If the listener calls | 461 // synchronously or asynchronously. If the listener calls |
461 // <code>suggest</code> asynchronously, then it must return | 462 // <code>suggest</code> asynchronously, then it must return |
462 // <code>true</code>. If the listener neither calls <code>suggest</code> | 463 // <code>true</code>. If the listener neither calls <code>suggest</code> |
463 // synchronously nor returns <code>true</code>, then <code>suggest</code> | 464 // synchronously nor returns <code>true</code>, then <code>suggest</code> |
464 // will be called automatically. The $ref:DownloadItem will not complete | 465 // will be called automatically. The $ref:DownloadItem will not complete |
465 // until all listeners have called <code>suggest</code>. Listeners may call | 466 // until all listeners have called <code>suggest</code>. Listeners may call |
466 // <code>suggest</code> without any arguments in order to allow the download | 467 // <code>suggest</code> without any arguments in order to allow the download |
467 // to use <code>downloadItem.filename</code> for its filename, or pass a | 468 // to use <code>downloadItem.filename</code> for its filename, or pass a |
468 // $ref:FilenameSuggestion object to <code>suggest</code> in order to | 469 // <code>FilenameSuggestion</code> object to <code>suggest</code> in order |
469 // override the target filename. If more than one extension overrides the | 470 // to override the target filename. If more than one extension overrides the |
470 // filename, then the last extension installed whose listener passes a | 471 // filename, then the last extension installed whose listener passes a |
471 // $ref:FilenameSuggestion object to <code>suggest</code> wins. In order to | 472 // <code>FilenameSuggestion</code> object to <code>suggest</code> wins. In |
472 // avoid confusion regarding which extension will win, users should not | 473 // order to avoid confusion regarding which extension will win, users should |
473 // install extensions that may conflict. If the download is initiated by | 474 // not install extensions that may conflict. If the download is initiated by |
474 // $ref:download and the target filename is known before the MIME type and | 475 // $ref:download and the target filename is known before the MIME type and |
475 // tentative filename have been determined, use | 476 // tentative filename have been determined, use |
476 // $ref:DownloadOptions.filename instead. | 477 // <code>DownloadOptions.filename</code> instead. |
477 [maxListeners=1] static void onDeterminingFilename( | 478 [maxListeners=1] static void onDeterminingFilename( |
478 DownloadItem downloadItem, SuggestFilenameCallback suggest); | 479 DownloadItem downloadItem, SuggestFilenameCallback suggest); |
479 }; | 480 }; |
480 }; | 481 }; |
OLD | NEW |