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 |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 // including state of the download, platform, registered file types and | 351 // including state of the download, platform, registered file types and |
352 // visual theme. If a file icon cannot be determined, <a | 352 // visual theme. If a file icon cannot be determined, <a |
353 // href='extension.html#property-lastError'>chrome.extension.lastError</a> | 353 // href='extension.html#property-lastError'>chrome.extension.lastError</a> |
354 // will contain an error message. | 354 // will contain an error message. |
355 // |downloadId|: The identifier for the download. | 355 // |downloadId|: The identifier for the download. |
356 // |callback|: A URL to an image that represents the download. | 356 // |callback|: A URL to an image that represents the download. |
357 static void getFileIcon(long downloadId, | 357 static void getFileIcon(long downloadId, |
358 optional GetFileIconOptions options, | 358 optional GetFileIconOptions options, |
359 GetFileIconCallback callback); | 359 GetFileIconCallback callback); |
360 | 360 |
| 361 // Open the downloaded file now if the <a |
| 362 // href='#type-DownloadItem'>DownloadItem</a> is complete, or when it |
| 363 // completes if it's still in progress. An <a |
| 364 // href='#event-onChanged'>onChanged</a> event will fire when the item is |
| 365 // opened for the first time. |
| 366 // |downloadId|: The identifier for the download. |
| 367 static void open(long downloadId); |
| 368 |
361 // Erase matching <a href='#type-DownloadItem'>DownloadItems</a> from | 369 // Erase matching <a href='#type-DownloadItem'>DownloadItems</a> from |
362 // history | 370 // history |
363 [nodoc] static void erase(DownloadQuery query, | 371 [nodoc] static void erase(DownloadQuery query, |
364 optional EraseCallback callback); | 372 optional EraseCallback callback); |
365 | 373 |
366 // TODO(benjhayden) Comment. | 374 // TODO(benjhayden) Comment. |
367 [nodoc] static void setDestination(long downloadId, DOMString relativePath); | 375 [nodoc] static void setDestination(long downloadId, DOMString relativePath); |
368 | 376 |
369 // Prompt the user to either accept or cancel a dangerous download. | 377 // Prompt the user to either accept or cancel a dangerous download. |
370 // <code>acceptDanger()</code> does not automatically accept dangerous | 378 // <code>acceptDanger()</code> does not automatically accept dangerous |
371 // downloads. | 379 // downloads. |
372 [nodoc] static void acceptDanger(long downloadId); | 380 [nodoc] static void acceptDanger(long downloadId); |
373 | 381 |
374 // Show the downloaded file in its folder in a file manager. | 382 // Show the downloaded file in its folder in a file manager. |
375 [nodoc] static void show(long downloadId); | 383 [nodoc] static void show(long downloadId); |
376 | 384 |
377 // Open the downloaded file. | |
378 [nodoc] static void open(long downloadId); | |
379 | |
380 // Initiate dragging the file to another application. | 385 // Initiate dragging the file to another application. |
381 [nodoc] static void drag(long downloadId); | 386 [nodoc] static void drag(long downloadId); |
382 }; | 387 }; |
383 | 388 |
384 interface Events { | 389 interface Events { |
385 // This event fires with the <a href='#type-DownloadItem'>DownloadItem</a> | 390 // This event fires with the <a href='#type-DownloadItem'>DownloadItem</a> |
386 // object when a download begins. | 391 // object when a download begins. |
387 static void onCreated(DownloadItem downloadItem); | 392 static void onCreated(DownloadItem downloadItem); |
388 | 393 |
389 // Fires with the <code>downloadId</code> when a download is erased from | 394 // Fires with the <code>downloadId</code> when a download is erased from |
390 // history. | 395 // history. |
391 // |downloadId|: The <code>id</code> of the <a href='#type-DownloadItem'>Dow
nloadItem</a> that was erased. | 396 // |downloadId|: The <code>id</code> of the <a href='#type-DownloadItem'>Dow
nloadItem</a> that was erased. |
392 static void onErased(long downloadId); | 397 static void onErased(long downloadId); |
393 | 398 |
394 // When any of a <a href='#type-DownloadItem'>DownloadItem</a>'s properties | 399 // When any of a <a href='#type-DownloadItem'>DownloadItem</a>'s properties |
395 // except <code>bytesReceived</code> changes, this event fires with the | 400 // except <code>bytesReceived</code> changes, this event fires with the |
396 // <code>downloadId</code> and an object containing the properties that chan
ged. | 401 // <code>downloadId</code> and an object containing the properties that chan
ged. |
397 static void onChanged(DownloadDelta downloadDelta); | 402 static void onChanged(DownloadDelta downloadDelta); |
398 }; | 403 }; |
399 }; | 404 }; |
OLD | NEW |