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

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

Issue 16924017: A few minor changes to the chrome.downloads extension API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: @r212092 Created 7 years, 5 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 // Use the <code>chrome.downloads</code> API to programmatically initiate, 5 // Use the <code>chrome.downloads</code> API to programmatically initiate,
6 // monitor, manipulate, and search for downloads. 6 // monitor, manipulate, and search for downloads.
7 [permissions=downloads] 7 [permissions=downloads]
8 namespace downloads { 8 namespace downloads {
9 [inline_doc] dictionary HeaderNameValuePair { 9 [inline_doc] dictionary HeaderNameValuePair {
10 // Name of the HTTP header. 10 // Name of the HTTP header.
11 DOMString name; 11 DOMString name;
12 12
13 // Value of the HTTP header. 13 // Value of the HTTP header.
14 DOMString value; 14 DOMString value;
15 }; 15 };
16 16
17 // <dl><dt>uniquify</dt> 17 // <dl><dt>uniquify</dt>
18 // <dd>To avoid duplication, the <code>filename</code> is changed to 18 // <dd>To avoid duplication, the <code>filename</code> is changed to
19 // include a counter before the filename extension.</dd> 19 // include a counter before the filename extension.</dd>
20 // <dt>overwrite</dt> 20 // <dt>overwrite</dt>
21 // <dd>The existing file will be overwritten with the new file.</dd> 21 // <dd>The existing file will be overwritten with the new file.</dd>
22 // <dt>prompt</dt> 22 // <dt>prompt</dt>
23 // <dd>The user will be prompted with a file chooser dialog.</dd> 23 // <dd>The user will be prompted with a file chooser dialog.</dd>
24 // </dl> 24 // </dl>
25 [inline_doc] enum FilenameConflictAction {uniquify, overwrite, prompt}; 25 enum FilenameConflictAction {uniquify, overwrite, prompt};
26 26
27 [inline_doc] dictionary FilenameSuggestion { 27 [inline_doc] dictionary FilenameSuggestion {
28 // The $ref:DownloadItem's new target $ref:DownloadItem.filename, as a path 28 // The $ref:DownloadItem's new target $ref:DownloadItem.filename, as a path
29 // relative to the user's default Downloads directory, possibly containing 29 // relative to the user's default Downloads directory, possibly containing
30 // subdirectories. Absolute paths, empty paths, and paths containing 30 // subdirectories. Absolute paths, empty paths, and paths containing
31 // back-references ".." will be ignored. 31 // back-references ".." will be ignored.
32 DOMString filename; 32 DOMString filename;
33 33
34 // The action to take if <code>filename</code> already exists. 34 // The action to take if <code>filename</code> already exists.
35 FilenameConflictAction? conflict_action; 35 FilenameConflictAction? conflictAction;
36 }; 36 };
37 37
38 [inline_doc] enum HttpMethod {GET, POST}; 38 [inline_doc] enum HttpMethod {GET, POST};
39 39
40 [inline_doc] dictionary DownloadOptions { 40 [inline_doc] dictionary DownloadOptions {
41 // The URL to download. 41 // The URL to download.
42 DOMString url; 42 DOMString url;
43 43
44 // A file path relative to the Downloads directory to contain the downloaded 44 // A file path relative to the Downloads directory to contain the downloaded
45 // file. Cannot yet contain subdirectories; support for subdirectories will 45 // file, possibly containing subdirectories. Absolute paths, empty paths,
46 // be implemented before this API is released to the stable channel. See 46 // and paths containing back-references ".." will cause an error.
47 // $ref:onDeterminingFilename for how to dynamically suggest a filename 47 // $ref:onDeterminingFilename allows suggesting a filename after the file's
48 // after the file's MIME type and a tentative filename have been determined. 48 // MIME type and a tentative filename have been determined.
49 DOMString? filename; 49 DOMString? filename;
50 50
51 // Use a file-chooser to allow the user to select a filename. 51 // The action to take if <code>filename</code> already exists.
52 FilenameConflictAction? conflictAction;
53
54 // Use a file-chooser to allow the user to select a filename regardless of
55 // whether <code>filename</code> is set or already exists.
52 boolean? saveAs; 56 boolean? saveAs;
53 57
54 // The HTTP method to use if the URL uses the HTTP[S] protocol. 58 // The HTTP method to use if the URL uses the HTTP[S] protocol.
55 HttpMethod? method; 59 HttpMethod? method;
56 60
57 // Extra HTTP headers to send with the request if the URL uses the HTTP[s] 61 // Extra HTTP headers to send with the request if the URL uses the HTTP[s]
58 // protocol. Each header is represented as a dictionary containing the keys 62 // protocol. Each header is represented as a dictionary containing the keys
59 // <code>name</code> and either <code>value</code> or 63 // <code>name</code> and either <code>value</code> or
60 // <code>binaryValue</code>, restricted to those allowed by XMLHttpRequest. 64 // <code>binaryValue</code>, restricted to those allowed by XMLHttpRequest.
61 HeaderNameValuePair[]? headers; 65 HeaderNameValuePair[]? headers;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 enum State {in_progress, interrupted, complete}; 97 enum State {in_progress, interrupted, complete};
94 98
95 // The state of the process of downloading a file. 99 // The state of the process of downloading a file.
96 dictionary DownloadItem { 100 dictionary DownloadItem {
97 // An identifier that is persistent across browser sessions. 101 // An identifier that is persistent across browser sessions.
98 long id; 102 long id;
99 103
100 // Absolute URL. 104 // Absolute URL.
101 DOMString url; 105 DOMString url;
102 106
107 // Absolute URL.
108 DOMString referrer;
asargent_no_longer_on_chrome 2013/07/17 22:36:57 I forget, do we tend to have the convention elsewh
benjhayden 2013/07/19 15:53:55 chrome.privacy.websites.referrersEnabled chrome.hi
asargent_no_longer_on_chrome 2013/07/22 19:15:53 Ok, let's keep it as you have it here then.
109
103 // Absolute local path. 110 // Absolute local path.
104 DOMString filename; 111 DOMString filename;
105 112
106 // False if this download is recorded in the history, true if it is not 113 // False if this download is recorded in the history, true if it is not
107 // recorded. 114 // recorded.
108 boolean incognito; 115 boolean incognito;
109 116
110 // Indication of whether this download is thought to be safe or known to be 117 // Indication of whether this download is thought to be safe or known to be
111 // suspicious. 118 // suspicious.
112 DangerType danger; 119 DangerType danger;
113 120
114 // True if the user has accepted the download's danger.
115 boolean? dangerAccepted;
116
117 // The file's MIME type. 121 // The file's MIME type.
118 DOMString mime; 122 DOMString mime;
119 123
120 // The time when the download began in ISO 8601 format. May be passed 124 // The time when the download began in ISO 8601 format. May be passed
121 // directly to the Date constructor: <code>chrome.downloads.search({}, 125 // directly to the Date constructor: <code>chrome.downloads.search({},
122 // function(items){items.forEach(function(item){console.log(new 126 // function(items){items.forEach(function(item){console.log(new
123 // Date(item.startTime))})})</code> 127 // Date(item.startTime))})})</code>
124 DOMString startTime; 128 DOMString startTime;
125 129
126 // The time when the download ended in ISO 8601 format. May be passed 130 // The time when the download ended in ISO 8601 format. May be passed
127 // directly to the Date constructor: <code>chrome.downloads.search({}, 131 // directly to the Date constructor: <code>chrome.downloads.search({},
128 // function(items){items.forEach(function(item){if (item.endTime) 132 // function(items){items.forEach(function(item){if (item.endTime)
129 // console.log(new Date(item.endTime))})})</code> 133 // console.log(new Date(item.endTime))})})</code>
130 DOMString? endTime; 134 DOMString? endTime;
131 135
136 // Estimated time when the download will complete in ISO 8601 format.
asargent_no_longer_on_chrome 2013/07/17 22:36:57 Is it worth mentioning in this comment that develo
benjhayden 2013/07/19 15:53:55 Done.
137 DOMString? estimatedEndTime;
138
132 // Indicates whether the download is progressing, interrupted, or complete. 139 // Indicates whether the download is progressing, interrupted, or complete.
133 State state; 140 State state;
134 141
135 // True if the download has stopped reading data from the host, but kept the 142 // True if the download has stopped reading data from the host, but kept the
136 // connection open. 143 // connection open.
137 boolean paused; 144 boolean paused;
138 145
139 // Number indicating why a download was interrupted. 146 // True if the download is in progress and paused, or else if it is
140 long? error; 147 // interrupted and can be resumed starting from where it was interrupted.
148 boolean canResume;
149
150 // Why the download was interrupted. Several kinds of HTTP errors may be
151 // grouped under one of the errors beginning with <code>SERVER_</code>.
152 // Errors relating to the network begin with <code>NETWORK_</code>, errors
153 // relating to the process of writing the file to the file system begin with
154 // <code>FILE_</code>, and interruptions initiated by the user begin with
155 // <code>USER_</code>.
156 DOMString? error;
asargent_no_longer_on_chrome 2013/07/17 22:36:57 It's sort of a bummer to take a presumably strongl
benjhayden 2013/07/19 15:53:55 I did it because it was easiest, but you're right,
141 157
142 // Number of bytes received so far from the host, without considering file 158 // Number of bytes received so far from the host, without considering file
143 // compression. 159 // compression.
144 long bytesReceived; 160 long bytesReceived;
145 161
146 // Number of bytes in the whole file, without considering file compression, 162 // Number of bytes in the whole file, without considering file compression,
147 // or -1 if unknown. 163 // or -1 if unknown.
148 long totalBytes; 164 long totalBytes;
149 165
150 // Number of bytes in the whole file post-decompression, or -1 if unknown. 166 // Number of bytes in the whole file post-decompression, or -1 if unknown.
151 long fileSize; 167 long fileSize;
152 168
153 // Whether the downloaded file still exists. This information may be out of 169 // Whether the downloaded file still exists. This information may be out of
154 // date because Chrome does not automatically watch for file removal. Call 170 // date because Chrome does not automatically watch for file removal. Call
155 // $ref:search() in order to trigger the check for file existence. When the 171 // $ref:search() in order to trigger the check for file existence. When the
156 // existence check completes, if the file has been deleted, then an 172 // existence check completes, if the file has been deleted, then an
157 // $ref:onChanged event will fire. Note that $ref:search() does not wait 173 // $ref:onChanged event will fire. Note that $ref:search() does not wait
158 // for the existence check to finish before returning, so results from 174 // for the existence check to finish before returning, so results from
159 // $ref:search() may not accurately reflect the file system. Also, 175 // $ref:search() may not accurately reflect the file system. Also,
160 // $ref:search() may be called as often as necessary, but will not check for 176 // $ref:search() may be called as often as necessary, but will not check for
161 // file existence any more frequently than once every 10 seconds. 177 // file existence any more frequently than once every 10 seconds.
162 boolean exists; 178 boolean exists;
163 }; 179 };
164 180
165 [inline_doc] dictionary DownloadQuery { 181 [inline_doc] dictionary DownloadQuery {
166 // This space-separated string of search terms that may be grouped using 182 // This array of search terms limits results to $ref:DownloadItem whose
167 // quotation marks limits results to 183 // <code>filename</code> or <code>url</code> contain all of the search terms
168 // $ref:DownloadItem whose <code>filename</code> 184 // that do not begin with a dash '-' and none of the search terms that do
169 // or <code>url</code> contain all of the search terms that do not begin wit h a dash '-' 185 // begin with a dash.
170 // and none of the search terms that do begin with a dash. 186 DOMString[]? query;
171 DOMString? query;
172 187
173 // Limits results to $ref:DownloadItem that 188 // Limits results to $ref:DownloadItem that
174 // started before the given ms since the epoch. 189 // started before the given ms since the epoch.
175 DOMString? startedBefore; 190 DOMString? startedBefore;
176 191
177 // Limits results to $ref:DownloadItem that 192 // Limits results to $ref:DownloadItem that
178 // started after the given ms since the epoch. 193 // started after the given ms since the epoch.
179 DOMString? startedAfter; 194 DOMString? startedAfter;
180 195
181 // Limits results to $ref:DownloadItem that ended before the given ms since the 196 // Limits results to $ref:DownloadItem that ended before the given ms since the
(...skipping 13 matching lines...) Expand all
195 long? totalBytesLess; 210 long? totalBytesLess;
196 211
197 // Limits results to $ref:DownloadItem whose 212 // Limits results to $ref:DownloadItem whose
198 // <code>filename</code> matches the given regular expression. 213 // <code>filename</code> matches the given regular expression.
199 DOMString? filenameRegex; 214 DOMString? filenameRegex;
200 215
201 // Limits results to $ref:DownloadItem whose 216 // Limits results to $ref:DownloadItem whose
202 // <code>url</code> matches the given regular expression. 217 // <code>url</code> matches the given regular expression.
203 DOMString? urlRegex; 218 DOMString? urlRegex;
204 219
205 // Setting this integer limits the number of results. Otherwise, all 220 // The maximum number of matching $ref:DownloadItem returned. Defaults to
206 // matching $ref:DownloadItem will be returned. 221 // 1000. Set to 0 in order to return all matching $ref:DownloadItem. See
222 // $ref:search for how to page through results.
207 long? limit; 223 long? limit;
208 224
209 // Setting this string to a $ref:DownloadItem 225 // Set elements of this array to $ref:DownloadItem properties in order to
210 // property sorts the $ref:DownloadItem prior 226 // sort search results. For example, setting
211 // to applying the above filters. For example, setting 227 // <code>orderBy=['startTime']</code> sorts the $ref:DownloadItem by their
212 // <code>orderBy='startTime'</code> sorts the 228 // start time in ascending order. To specify descending order, prefix with a
213 // $ref:DownloadItem by their start time in 229 // hyphen: '-startTime'.
214 // ascending order. To specify descending order, prefix <code>orderBy</code> 230 DOMString[]? orderBy;
215 // with a hyphen: '-startTime'.
216 DOMString? orderBy;
217 231
218 // The <code>id</code> of the $ref:DownloadItem to query. 232 // The <code>id</code> of the $ref:DownloadItem to query.
219 long? id; 233 long? id;
220 234
221 // Absolute URL. 235 // Absolute URL.
222 DOMString? url; 236 DOMString? url;
223 237
224 // Absolute local path. 238 // Absolute local path.
225 DOMString? filename; 239 DOMString? filename;
226 240
227 // Indication of whether this download is thought to be safe or known to be 241 // Indication of whether this download is thought to be safe or known to be
228 // suspicious. 242 // suspicious.
229 DangerType? danger; 243 DangerType? danger;
230 244
231 // True if the user has accepted the download's danger.
232 boolean? dangerAccepted;
233
234 // The file's MIME type. 245 // The file's MIME type.
235 DOMString? mime; 246 DOMString? mime;
236 247
237 // The time when the download began in ISO 8601 format. 248 // The time when the download began in ISO 8601 format.
238 DOMString? startTime; 249 DOMString? startTime;
239 250
240 // The time when the download ended in ISO 8601 format. 251 // The time when the download ended in ISO 8601 format.
241 DOMString? endTime; 252 DOMString? endTime;
242 253
243 // Indicates whether the download is progressing, interrupted, or complete. 254 // Indicates whether the download is progressing, interrupted, or complete.
244 State? state; 255 State? state;
245 256
246 // True if the download has stopped reading data from the host, but kept the 257 // True if the download has stopped reading data from the host, but kept the
247 // connection open. 258 // connection open.
248 boolean? paused; 259 boolean? paused;
249 260
250 // Number indicating why a download was interrupted. 261 // Why a download was interrupted.
251 long? error; 262 DOMString? error;
252 263
253 // Number of bytes received so far from the host, without considering file 264 // Number of bytes received so far from the host, without considering file
254 // compression. 265 // compression.
255 long? bytesReceived; 266 long? bytesReceived;
256 267
257 // Number of bytes in the whole file, without considering file compression, 268 // Number of bytes in the whole file, without considering file compression,
258 // or -1 if unknown. 269 // or -1 if unknown.
259 long? totalBytes; 270 long? totalBytes;
260 271
261 // Number of bytes in the whole file post-decompression, or -1 if unknown. 272 // Number of bytes in the whole file post-decompression, or -1 if unknown.
(...skipping 26 matching lines...) Expand all
288 299
289 // The change in <code>url</code>, if any. 300 // The change in <code>url</code>, if any.
290 StringDelta? url; 301 StringDelta? url;
291 302
292 // The change in <code>filename</code>, if any. 303 // The change in <code>filename</code>, if any.
293 StringDelta? filename; 304 StringDelta? filename;
294 305
295 // The change in <code>danger</code>, if any. 306 // The change in <code>danger</code>, if any.
296 StringDelta? danger; 307 StringDelta? danger;
297 308
298 // The change in <code>dangerAccepted</code>, if any.
299 BooleanDelta? dangerAccepted;
300
301 // The change in <code>mime</code>, if any. 309 // The change in <code>mime</code>, if any.
302 StringDelta? mime; 310 StringDelta? mime;
303 311
304 // The change in <code>startTime</code>, if any. 312 // The change in <code>startTime</code>, if any.
305 StringDelta? startTime; 313 StringDelta? startTime;
306 314
307 // The change in <code>endTime</code>, if any. 315 // The change in <code>endTime</code>, if any.
308 StringDelta? endTime; 316 StringDelta? endTime;
309 317
310 // The change in <code>state</code>, if any. 318 // The change in <code>state</code>, if any.
311 StringDelta? state; 319 StringDelta? state;
312 320
321 // The change in <code>canResume</code>, if any.
322 BooleanDelta? canResume;
323
313 // The change in <code>paused</code>, if any. 324 // The change in <code>paused</code>, if any.
314 BooleanDelta? paused; 325 BooleanDelta? paused;
315 326
316 // The change in <code>error</code>, if any. 327 // The change in <code>error</code>, if any.
317 LongDelta? error; 328 StringDelta? error;
318 329
319 // The change in <code>totalBytes</code>, if any. 330 // The change in <code>totalBytes</code>, if any.
320 LongDelta? totalBytes; 331 LongDelta? totalBytes;
321 332
322 // The change in <code>fileSize</code>, if any. 333 // The change in <code>fileSize</code>, if any.
323 LongDelta? fileSize; 334 LongDelta? fileSize;
324 335
325 // The change in <code>exists</code>, if any. 336 // The change in <code>exists</code>, if any.
326 BooleanDelta? exists; 337 BooleanDelta? exists;
327 }; 338 };
(...skipping 26 matching lines...) Expand all
354 // backwards compatible between releases. Extensions must not parse it. 365 // backwards compatible between releases. Extensions must not parse it.
355 // |options|: What to download and how. 366 // |options|: What to download and how.
356 // |callback|: Called with the id of the new $ref:DownloadItem. 367 // |callback|: Called with the id of the new $ref:DownloadItem.
357 static void download(DownloadOptions options, 368 static void download(DownloadOptions options,
358 optional DownloadCallback callback); 369 optional DownloadCallback callback);
359 370
360 // Find $ref:DownloadItem. Set 371 // Find $ref:DownloadItem. Set
361 // <code>query</code> to the empty object to get all 372 // <code>query</code> to the empty object to get all
362 // $ref:DownloadItem. To get a specific 373 // $ref:DownloadItem. To get a specific
363 // $ref:DownloadItem, set only the <code>id</code> 374 // $ref:DownloadItem, set only the <code>id</code>
364 // field. 375 // field. To page through a large number of items, set
376 // <code>orderBy: ['-startTime']</code>, set <code>limit</code> to
377 // the number of items per page, and set <code>startedAfter</code> to the
378 // <code>startTime</code> of the last item from the last page.
365 static void search(DownloadQuery query, SearchCallback callback); 379 static void search(DownloadQuery query, SearchCallback callback);
366 380
367 // Pause the download. If the request was successful the download is in a 381 // Pause the download. If the request was successful the download is in a
368 // paused state. Otherwise 382 // paused state. Otherwise
369 // $ref:runtime.lastError 383 // $ref:runtime.lastError
370 // contains an error message. The request will fail if the download is not 384 // contains an error message. The request will fail if the download is not
371 // active. 385 // active.
372 // |downloadId|: The id of the download to pause. 386 // |downloadId|: The id of the download to pause.
373 // |callback|: Called when the pause request is completed. 387 // |callback|: Called when the pause request is completed.
374 static void pause(long downloadId, optional NullCallback callback); 388 static void pause(long downloadId, optional NullCallback callback);
(...skipping 24 matching lines...) Expand all
399 // visual theme. If a file icon cannot be determined, 413 // visual theme. If a file icon cannot be determined,
400 // $ref:runtime.lastError 414 // $ref:runtime.lastError
401 // will contain an error message. 415 // will contain an error message.
402 // |downloadId|: The identifier for the download. 416 // |downloadId|: The identifier for the download.
403 // |callback|: A URL to an image that represents the download. 417 // |callback|: A URL to an image that represents the download.
404 static void getFileIcon(long downloadId, 418 static void getFileIcon(long downloadId,
405 optional GetFileIconOptions options, 419 optional GetFileIconOptions options,
406 GetFileIconCallback callback); 420 GetFileIconCallback callback);
407 421
408 // Open the downloaded file now if the $ref:DownloadItem is complete; 422 // Open the downloaded file now if the $ref:DownloadItem is complete;
409 // returns an error through $ref:runtime.lastError otherwise. An 423 // otherwise return an error through $ref:runtime.lastError. An
410 // $ref:onChanged event will fire when the item is opened for the first 424 // $ref:onChanged event will fire when the item is opened for the first
411 // time. 425 // time.
412 // |downloadId|: The identifier for the downloaded file. 426 // |downloadId|: The identifier for the downloaded file.
413 static void open(long downloadId); 427 static void open(long downloadId);
414 428
415 // Show the downloaded file in its folder in a file manager. 429 // Show the downloaded file in its folder in a file manager. If
430 // <code>downloadId</code> is not specified, opens the default Downloads
431 // folder in a file manager.
416 // |downloadId|: The identifier for the downloaded file. 432 // |downloadId|: The identifier for the downloaded file.
417 static void show(long downloadId); 433 static void show(optional long downloadId);
asargent_no_longer_on_chrome 2013/07/17 22:36:57 Another option instead of making this argument opt
benjhayden 2013/07/19 15:53:55 It is a little strange that this one function does
asargent_no_longer_on_chrome 2013/07/22 19:15:53 That doesn't seem all that long to me. But here ar
418 434
419 // Erase matching $ref:DownloadItem from history. An $ref:onErased event 435 // Erase matching $ref:DownloadItem from history without deleting the
420 // will fire for each $ref:DownloadItem that matches <code>query</code>, 436 // downloaded file. An $ref:onErased event will fire for each
421 // then <code>callback</code> will be called. 437 // $ref:DownloadItem that matches <code>query</code>, then
438 // <code>callback</code> will be called.
422 static void erase(DownloadQuery query, optional EraseCallback callback); 439 static void erase(DownloadQuery query, optional EraseCallback callback);
423 440
441 // Delete the downloaded file if it exists and the $ref:DownloadItem is
442 // complete; otherwise return an error through $ref:runtime.lastError.
443 static void deleteFile(long downloadId, optional NullCallback callback);
444
424 // Prompt the user to accept a dangerous download. Does not automatically 445 // Prompt the user to accept a dangerous download. Does not automatically
425 // accept dangerous downloads. If the download is accepted, then an 446 // accept dangerous downloads. If the download is accepted, then an
426 // $ref:onChanged event will fire, otherwise nothing will happen. When all 447 // $ref:onChanged event will fire, otherwise nothing will happen. When all
427 // the data is fetched into a temporary file and either the download is not 448 // the data is fetched into a temporary file and either the download is not
428 // dangerous or the danger has been accepted, then the temporary file is 449 // dangerous or the danger has been accepted, then the temporary file is
429 // renamed to the target filename, the |state| changes to 'complete', and 450 // renamed to the target filename, the |state| changes to 'complete', and
430 // $ref:onChanged fires. 451 // $ref:onChanged fires.
431 // |downloadId|: The identifier for the $ref:DownloadItem. 452 // |downloadId|: The identifier for the $ref:DownloadItem.
432 static void acceptDanger(long downloadId); 453 // |callback|: Called when the danger prompt dialog closes.
454 static void acceptDanger(long downloadId, optional NullCallback callback);
433 455
434 // Initiate dragging the downloaded file to another application. 456 // Initiate dragging the downloaded file to another application. Call in a
457 // javascript <code>ondragstart</code> handler.
435 static void drag(long downloadId); 458 static void drag(long downloadId);
459
460 // Set <code>visible</code> to true to show the download shelf, false to
461 // hide it.
462 static void setShelfVisible(boolean visible);
436 }; 463 };
437 464
438 interface Events { 465 interface Events {
439 // This event fires with the $ref:DownloadItem 466 // This event fires with the $ref:DownloadItem
440 // object when a download begins. 467 // object when a download begins.
441 static void onCreated(DownloadItem downloadItem); 468 static void onCreated(DownloadItem downloadItem);
442 469
443 // Fires with the <code>downloadId</code> when a download is erased from 470 // Fires with the <code>downloadId</code> when a download is erased from
444 // history. 471 // history.
445 // |downloadId|: The <code>id</code> of the $ref:DownloadItem that was 472 // |downloadId|: The <code>id</code> of the $ref:DownloadItem that was
446 // erased. 473 // erased.
447 static void onErased(long downloadId); 474 static void onErased(long downloadId);
448 475
449 // When any of a $ref:DownloadItem's properties except 476 // When any of a $ref:DownloadItem's properties except
450 // <code>bytesReceived</code> changes, this event fires with the 477 // <code>bytesReceived</code> and <code>estimatedEndTime</code> changes,
451 // <code>downloadId</code> and an object containing the properties that 478 // this event fires with the <code>downloadId</code> and an object
452 // changed. 479 // containing the properties that changed.
453 static void onChanged(DownloadDelta downloadDelta); 480 static void onChanged(DownloadDelta downloadDelta);
454 481
455 // During the filename determination process, extensions will be given the 482 // During the filename determination process, extensions will be given the
456 // opportunity to override the target $ref:DownloadItem.filename. Each 483 // opportunity to override the target $ref:DownloadItem.filename. Each
457 // extension may not register more than one listener for this event. Each 484 // extension may not register more than one listener for this event. Each
458 // listener must call <code>suggest</code> exactly once, either 485 // listener must call <code>suggest</code> exactly once, either
459 // synchronously or asynchronously. If the listener calls 486 // synchronously or asynchronously. If the listener calls
460 // <code>suggest</code> asynchronously, then it must return 487 // <code>suggest</code> asynchronously, then it must return
461 // <code>true</code>. If the listener neither calls <code>suggest</code> 488 // <code>true</code>. If the listener neither calls <code>suggest</code>
462 // synchronously nor returns <code>true</code>, then <code>suggest</code> 489 // synchronously nor returns <code>true</code>, then <code>suggest</code>
463 // will be called automatically. The $ref:DownloadItem will not complete 490 // will be called automatically. The $ref:DownloadItem will not complete
464 // until all listeners have called <code>suggest</code>. Listeners may call 491 // until all listeners have called <code>suggest</code>. Listeners may call
465 // <code>suggest</code> without any arguments in order to allow the download 492 // <code>suggest</code> without any arguments in order to allow the download
466 // to use <code>downloadItem.filename</code> for its filename, or pass a 493 // to use <code>downloadItem.filename</code> for its filename, or pass a
467 // <code>suggestion</code> object to <code>suggest</code> in order to 494 // <code>suggestion</code> object to <code>suggest</code> in order to
468 // override the target filename. If more than one extension overrides the 495 // override the target filename. If more than one extension overrides the
469 // filename, then the last extension installed whose listener passes a 496 // filename, then the last extension installed whose listener passes a
470 // <code>suggestion</code> object to <code>suggest</code> wins. In order to 497 // <code>suggestion</code> object to <code>suggest</code> wins. In order to
471 // avoid confusion regarding which extension will win, users should not 498 // avoid confusion regarding which extension will win, users should not
472 // install extensions that may conflict. If the download is initiated by 499 // install extensions that may conflict. If the download is initiated by
473 // $ref:download and the target filename is known before the MIME type and 500 // $ref:download and the target filename is known before the MIME type and
474 // tentative filename have been determined, pass <code>filename</code> to 501 // tentative filename have been determined, pass <code>filename</code> to
475 // $ref:download instead. 502 // $ref:download instead.
476 [maxListeners=1] static void onDeterminingFilename( 503 [maxListeners=1] static void onDeterminingFilename(
477 DownloadItem downloadItem, SuggestFilenameCallback suggest); 504 DownloadItem downloadItem, SuggestFilenameCallback suggest);
478 }; 505 };
479 }; 506 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698