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

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: @r176665 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.
19 DOMString filename;
20
21 // Whether to overwrite any existing files. Ignored if <code>filename</code>
22 // is unset.
Randy Smith (Not in Mondays) 2013/01/14 21:02:29 Sorry, probably still confused about syntax, but d
benjhayden 2013/01/17 02:52:05 Done.
Randy Smith (Not in Mondays) 2013/01/17 19:15:42 Still confused, Milo. Does this mean that the ext
benjhayden 2013/01/18 20:59:50 Not quite. See about L60 in https://codereview.chr
Randy Smith (Not in Mondays) 2013/01/22 19:43:07 Ok.
23 boolean? overwrite;
24 };
25
15 [inline_doc] enum HttpMethod {GET, POST}; 26 [inline_doc] enum HttpMethod {GET, POST};
16 27
17 [inline_doc] dictionary DownloadOptions { 28 [inline_doc] dictionary DownloadOptions {
18 // The URL to download. 29 // The URL to download.
19 DOMString url; 30 DOMString url;
20 31
21 // A file path relative to the Downloads directory to contain the downloaded 32 // A file path relative to the Downloads directory to contain the downloaded
22 // file. 33 // file.
23 DOMString? filename; 34 DOMString? filename;
24 35
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 397
387 // Show the downloaded file in its folder in a file manager. 398 // Show the downloaded file in its folder in a file manager.
388 // |downloadId|: The identifier for the downloaded file. 399 // |downloadId|: The identifier for the downloaded file.
389 static void show(long downloadId); 400 static void show(long downloadId);
390 401
391 // Erase matching $ref:DownloadItem from history. An $ref:onErased event 402 // Erase matching $ref:DownloadItem from history. An $ref:onErased event
392 // will fire for each $ref:DownloadItem that matches <code>query</code>, 403 // will fire for each $ref:DownloadItem that matches <code>query</code>,
393 // then <code>callback</code> will be called. 404 // then <code>callback</code> will be called.
394 static void erase(DownloadQuery query, optional EraseCallback callback); 405 static void erase(DownloadQuery query, optional EraseCallback callback);
395 406
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. 407 // Prompt the user to either accept or cancel a dangerous download.
400 // <code>acceptDanger()</code> does not automatically accept dangerous 408 // <code>acceptDanger()</code> does not automatically accept dangerous
401 // downloads. 409 // downloads.
402 [nodoc] static void acceptDanger(long downloadId); 410 [nodoc] static void acceptDanger(long downloadId);
403 411
404 // Initiate dragging the downloaded file to another application. 412 // Initiate dragging the downloaded file to another application.
405 static void drag(long downloadId); 413 static void drag(long downloadId);
406 }; 414 };
407 415
408 interface Events { 416 interface Events {
409 // This event fires with the $ref:DownloadItem 417 // This event fires with the $ref:DownloadItem
410 // object when a download begins. 418 // object when a download begins.
411 static void onCreated(DownloadItem downloadItem); 419 static void onCreated(DownloadItem downloadItem);
412 420
413 // Fires with the <code>downloadId</code> when a download is erased from 421 // Fires with the <code>downloadId</code> when a download is erased from
414 // history. 422 // history.
415 // |downloadId|: The <code>id</code> of the $ref:DownloadItem that was erase d. 423 // |downloadId|: The <code>id</code> of the $ref:DownloadItem that was erase d.
416 static void onErased(long downloadId); 424 static void onErased(long downloadId);
417 425
418 // When any of a $ref:DownloadItem's properties 426 // When any of a $ref:DownloadItem's properties
419 // except <code>bytesReceived</code> changes, this event fires with the 427 // except <code>bytesReceived</code> changes, this event fires with the
420 // <code>downloadId</code> and an object containing the properties that chan ged. 428 // <code>downloadId</code> and an object containing the properties that chan ged.
421 static void onChanged(DownloadDelta downloadDelta); 429 static void onChanged(DownloadDelta downloadDelta);
430
431 // During the filename determination process, extensions will be given the
432 // opportunity to override the target filename. Handlers may return null in
433 // order to allow the target filename to be used, or return a
434 // $ref:FilenameDetermination object in order to override the target
435 // filename. If more than one extension overrides the filename, then one
436 // extension will win. There is no way to predict or choose which extension
437 // will win. Users should be careful to not install extensions that may
438 // conflict.
439 static void onDeterminingFilename(DownloadItem downloadItem);
Randy Smith (Not in Mondays) 2013/01/14 21:02:29 This is solidly and definitely me not understandin
benjhayden 2013/01/17 02:52:05 The return values are always ignored in IDL.
422 }; 440 };
423 }; 441 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698