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 // $ref:onDeterminingFilename handlers may return a FilenameDetermination |
| 16 // object in order to override a download's target filename. |
| 17 dictionary FilenameDetermination { |
| 18 // The download's new target filename. |
| 19 DOMString? filename; |
| 20 |
| 21 // Whether to overwrite any existing files. |
| 22 boolean? overwrite; |
| 23 }; |
| 24 |
15 [inline_doc] enum HttpMethod {GET, POST}; | 25 [inline_doc] enum HttpMethod {GET, POST}; |
16 | 26 |
17 [inline_doc] dictionary DownloadOptions { | 27 [inline_doc] dictionary DownloadOptions { |
18 // The URL to download. | 28 // The URL to download. |
19 DOMString url; | 29 DOMString url; |
20 | 30 |
21 // A file path relative to the Downloads directory to contain the downloaded | 31 // A file path relative to the Downloads directory to contain the downloaded |
22 // file. | 32 // file. |
23 DOMString? filename; | 33 DOMString? filename; |
24 | 34 |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 | 379 |
370 // Show the downloaded file in its folder in a file manager. | 380 // Show the downloaded file in its folder in a file manager. |
371 // |downloadId|: The identifier for the downloaded file. | 381 // |downloadId|: The identifier for the downloaded file. |
372 static void show(long downloadId); | 382 static void show(long downloadId); |
373 | 383 |
374 // Erase matching $ref:DownloadItem from history. An $ref.onErased event | 384 // Erase matching $ref:DownloadItem from history. An $ref.onErased event |
375 // will fire for each $ref.DownloadItem that matches <code>query</code>, | 385 // will fire for each $ref.DownloadItem that matches <code>query</code>, |
376 // then <code>callback</code> will be called. | 386 // then <code>callback</code> will be called. |
377 static void erase(DownloadQuery query, optional EraseCallback callback); | 387 static void erase(DownloadQuery query, optional EraseCallback callback); |
378 | 388 |
379 // TODO(benjhayden) Comment. | |
380 [nodoc] static void setDestination(long downloadId, DOMString relativePath); | |
381 | |
382 // Prompt the user to either accept or cancel a dangerous download. | 389 // Prompt the user to either accept or cancel a dangerous download. |
383 // <code>acceptDanger()</code> does not automatically accept dangerous | 390 // <code>acceptDanger()</code> does not automatically accept dangerous |
384 // downloads. | 391 // downloads. |
385 [nodoc] static void acceptDanger(long downloadId); | 392 [nodoc] static void acceptDanger(long downloadId); |
386 | 393 |
387 // Initiate dragging the downloaded file to another application. | 394 // Initiate dragging the downloaded file to another application. |
388 static void drag(long downloadId); | 395 static void drag(long downloadId); |
389 }; | 396 }; |
390 | 397 |
391 interface Events { | 398 interface Events { |
392 // This event fires with the $ref:DownloadItem | 399 // This event fires with the $ref:DownloadItem |
393 // object when a download begins. | 400 // object when a download begins. |
394 static void onCreated(DownloadItem downloadItem); | 401 static void onCreated(DownloadItem downloadItem); |
395 | 402 |
396 // Fires with the <code>downloadId</code> when a download is erased from | 403 // Fires with the <code>downloadId</code> when a download is erased from |
397 // history. | 404 // history. |
398 // |downloadId|: The <code>id</code> of the $ref:DownloadItem that was erase
d. | 405 // |downloadId|: The <code>id</code> of the $ref:DownloadItem that was erase
d. |
399 static void onErased(long downloadId); | 406 static void onErased(long downloadId); |
400 | 407 |
401 // When any of a $ref:DownloadItem's properties | 408 // When any of a $ref:DownloadItem's properties |
402 // except <code>bytesReceived</code> changes, this event fires with the | 409 // except <code>bytesReceived</code> changes, this event fires with the |
403 // <code>downloadId</code> and an object containing the properties that chan
ged. | 410 // <code>downloadId</code> and an object containing the properties that chan
ged. |
404 static void onChanged(DownloadDelta downloadDelta); | 411 static void onChanged(DownloadDelta downloadDelta); |
| 412 |
| 413 // During the filename determination process, extensions will be given the |
| 414 // opportunity to override the target filename. Handlers may return null in |
| 415 // order to allow the target filename to be used, or return a |
| 416 // $ref:FilenameDetermination object in order to override the target |
| 417 // filename. |
| 418 static void onDeterminingFilename(DownloadItem downloadItem); |
405 }; | 419 }; |
406 }; | 420 }; |
OLD | NEW |