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

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: @r176347 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.
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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 380
370 // Show the downloaded file in its folder in a file manager. 381 // Show the downloaded file in its folder in a file manager.
371 // |downloadId|: The identifier for the downloaded file. 382 // |downloadId|: The identifier for the downloaded file.
372 static void show(long downloadId); 383 static void show(long downloadId);
373 384
374 // Erase matching $ref:DownloadItem from history. An $ref.onErased event 385 // Erase matching $ref:DownloadItem from history. An $ref.onErased event
375 // will fire for each $ref.DownloadItem that matches <code>query</code>, 386 // will fire for each $ref.DownloadItem that matches <code>query</code>,
376 // then <code>callback</code> will be called. 387 // then <code>callback</code> will be called.
377 static void erase(DownloadQuery query, optional EraseCallback callback); 388 static void erase(DownloadQuery query, optional EraseCallback callback);
378 389
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. 390 // Prompt the user to either accept or cancel a dangerous download.
383 // <code>acceptDanger()</code> does not automatically accept dangerous 391 // <code>acceptDanger()</code> does not automatically accept dangerous
384 // downloads. 392 // downloads.
385 [nodoc] static void acceptDanger(long downloadId); 393 [nodoc] static void acceptDanger(long downloadId);
386 394
387 // Initiate dragging the downloaded file to another application. 395 // Initiate dragging the downloaded file to another application.
388 static void drag(long downloadId); 396 static void drag(long downloadId);
389 }; 397 };
390 398
391 interface Events { 399 interface Events {
392 // This event fires with the $ref:DownloadItem 400 // This event fires with the $ref:DownloadItem
393 // object when a download begins. 401 // object when a download begins.
394 static void onCreated(DownloadItem downloadItem); 402 static void onCreated(DownloadItem downloadItem);
395 403
396 // Fires with the <code>downloadId</code> when a download is erased from 404 // Fires with the <code>downloadId</code> when a download is erased from
397 // history. 405 // history.
398 // |downloadId|: The <code>id</code> of the $ref:DownloadItem that was erase d. 406 // |downloadId|: The <code>id</code> of the $ref:DownloadItem that was erase d.
399 static void onErased(long downloadId); 407 static void onErased(long downloadId);
400 408
401 // When any of a $ref:DownloadItem's properties 409 // When any of a $ref:DownloadItem's properties
402 // except <code>bytesReceived</code> changes, this event fires with the 410 // except <code>bytesReceived</code> changes, this event fires with the
403 // <code>downloadId</code> and an object containing the properties that chan ged. 411 // <code>downloadId</code> and an object containing the properties that chan ged.
404 static void onChanged(DownloadDelta downloadDelta); 412 static void onChanged(DownloadDelta downloadDelta);
413
414 // During the filename determination process, extensions will be given the
415 // opportunity to override the target filename. Handlers may return null in
416 // order to allow the target filename to be used, or return a
417 // $ref:FilenameDetermination object in order to override the target
418 // filename. If more than one extension overrides the filename, then one
419 // extension will win. There is no way to predict or choose which extension
420 // will win. Users should be careful to not install extensions that may
421 // conflict.
422 static void onDeterminingFilename(DownloadItem downloadItem);
405 }; 423 };
406 }; 424 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698