Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: chrome/common/extensions/api/downloads.idl

Issue 11574006: Implement chrome.downloads.onDeterminingFilename() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: @r177662 Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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.
Randy Smith (Not in Mondays) 2013/01/22 19:43:08 Should we specify that the filename is considered
benjhayden 2013/01/23 21:30:10 Done.
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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 396
387 // Show the downloaded file in its folder in a file manager. 397 // Show the downloaded file in its folder in a file manager.
388 // |downloadId|: The identifier for the downloaded file. 398 // |downloadId|: The identifier for the downloaded file.
389 static void show(long downloadId); 399 static void show(long downloadId);
390 400
391 // Erase matching $ref:DownloadItem from history. An $ref:onErased event 401 // Erase matching $ref:DownloadItem from history. An $ref:onErased event
392 // will fire for each $ref:DownloadItem that matches <code>query</code>, 402 // will fire for each $ref:DownloadItem that matches <code>query</code>,
393 // then <code>callback</code> will be called. 403 // then <code>callback</code> will be called.
394 static void erase(DownloadQuery query, optional EraseCallback callback); 404 static void erase(DownloadQuery query, optional EraseCallback callback);
395 405
396 // TODO(benjhayden) Comment.
397 [nodoc] static void setDestination(long downloadId, DOMString relativePath);
398
399 // Prompt the user to either accept or cancel a dangerous download. 406 // Prompt the user to either accept or cancel a dangerous download.
400 // <code>acceptDanger()</code> does not automatically accept dangerous 407 // <code>acceptDanger()</code> does not automatically accept dangerous
401 // downloads. 408 // downloads.
402 [nodoc] static void acceptDanger(long downloadId); 409 [nodoc] static void acceptDanger(long downloadId);
403 410
404 // Initiate dragging the downloaded file to another application. 411 // Initiate dragging the downloaded file to another application.
405 static void drag(long downloadId); 412 static void drag(long downloadId);
406 }; 413 };
407 414
408 interface Events { 415 interface Events {
409 // This event fires with the $ref:DownloadItem 416 // This event fires with the $ref:DownloadItem
410 // object when a download begins. 417 // object when a download begins.
411 static void onCreated(DownloadItem downloadItem); 418 static void onCreated(DownloadItem downloadItem);
412 419
413 // Fires with the <code>downloadId</code> when a download is erased from 420 // Fires with the <code>downloadId</code> when a download is erased from
414 // history. 421 // history.
415 // |downloadId|: The <code>id</code> of the $ref:DownloadItem that was erase d. 422 // |downloadId|: The <code>id</code> of the $ref:DownloadItem that was erase d.
416 static void onErased(long downloadId); 423 static void onErased(long downloadId);
417 424
418 // When any of a $ref:DownloadItem's properties 425 // When any of a $ref:DownloadItem's properties
419 // except <code>bytesReceived</code> changes, this event fires with the 426 // except <code>bytesReceived</code> changes, this event fires with the
420 // <code>downloadId</code> and an object containing the properties that chan ged. 427 // <code>downloadId</code> and an object containing the properties that chan ged.
421 static void onChanged(DownloadDelta downloadDelta); 428 static void onChanged(DownloadDelta downloadDelta);
429
430 // During the filename determination process, extensions will be given the
431 // opportunity to override the target filename. Handlers may return null in
432 // order to allow the target filename to be used, or return a
433 // $ref:FilenameDetermination object in order to override the target
434 // filename. If more than one extension overrides the filename, then one
435 // extension will win. There is no way to predict or choose which extension
436 // will win. Users should be careful to not install extensions that may
437 // conflict.
438 static void onDeterminingFilename(DownloadItem downloadItem);
422 }; 439 };
423 }; 440 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698