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 // 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. |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 // Why the download was interrupted. Several kinds of HTTP errors may be | 182 // Why the download was interrupted. Several kinds of HTTP errors may be |
183 // grouped under one of the errors beginning with <code>SERVER_</code>. | 183 // grouped under one of the errors beginning with <code>SERVER_</code>. |
184 // Errors relating to the network begin with <code>NETWORK_</code>, errors | 184 // Errors relating to the network begin with <code>NETWORK_</code>, errors |
185 // relating to the process of writing the file to the file system begin with | 185 // relating to the process of writing the file to the file system begin with |
186 // <code>FILE_</code>, and interruptions initiated by the user begin with | 186 // <code>FILE_</code>, and interruptions initiated by the user begin with |
187 // <code>USER_</code>. | 187 // <code>USER_</code>. |
188 InterruptReason? error; | 188 InterruptReason? error; |
189 | 189 |
190 // Number of bytes received so far from the host, without considering file | 190 // Number of bytes received so far from the host, without considering file |
191 // compression. | 191 // compression. |
192 long bytesReceived; | 192 double bytesReceived; |
193 | 193 |
194 // Number of bytes in the whole file, without considering file compression, | 194 // Number of bytes in the whole file, without considering file compression, |
195 // or -1 if unknown. | 195 // or -1 if unknown. |
196 long totalBytes; | 196 double totalBytes; |
197 | 197 |
198 // Number of bytes in the whole file post-decompression, or -1 if unknown. | 198 // Number of bytes in the whole file post-decompression, or -1 if unknown. |
199 long fileSize; | 199 double fileSize; |
200 | 200 |
201 // Whether the downloaded file still exists. This information may be out of | 201 // Whether the downloaded file still exists. This information may be out of |
202 // date because Chrome does not automatically watch for file removal. Call | 202 // date because Chrome does not automatically watch for file removal. Call |
203 // $ref:search() in order to trigger the check for file existence. When the | 203 // $ref:search() in order to trigger the check for file existence. When the |
204 // existence check completes, if the file has been deleted, then an | 204 // existence check completes, if the file has been deleted, then an |
205 // $ref:onChanged event will fire. Note that $ref:search() does not wait | 205 // $ref:onChanged event will fire. Note that $ref:search() does not wait |
206 // for the existence check to finish before returning, so results from | 206 // for the existence check to finish before returning, so results from |
207 // $ref:search() may not accurately reflect the file system. Also, | 207 // $ref:search() may not accurately reflect the file system. Also, |
208 // $ref:search() may be called as often as necessary, but will not check for | 208 // $ref:search() may be called as often as necessary, but will not check for |
209 // file existence any more frequently than once every 10 seconds. | 209 // file existence any more frequently than once every 10 seconds. |
(...skipping 27 matching lines...) Expand all Loading... |
237 // Limits results to $ref:DownloadItem that ended before the given ms since
the | 237 // Limits results to $ref:DownloadItem that ended before the given ms since
the |
238 // epoch. | 238 // epoch. |
239 DOMString? endedBefore; | 239 DOMString? endedBefore; |
240 | 240 |
241 // Limits results to $ref:DownloadItem that ended after the given ms since t
he | 241 // Limits results to $ref:DownloadItem that ended after the given ms since t
he |
242 // epoch. | 242 // epoch. |
243 DOMString? endedAfter; | 243 DOMString? endedAfter; |
244 | 244 |
245 // Limits results to $ref:DownloadItem whose | 245 // Limits results to $ref:DownloadItem whose |
246 // <code>totalBytes</code> is greater than the given integer. | 246 // <code>totalBytes</code> is greater than the given integer. |
247 long? totalBytesGreater; | 247 double? totalBytesGreater; |
248 | 248 |
249 // Limits results to $ref:DownloadItem whose | 249 // Limits results to $ref:DownloadItem whose |
250 // <code>totalBytes</code> is less than the given integer. | 250 // <code>totalBytes</code> is less than the given integer. |
251 long? totalBytesLess; | 251 double? totalBytesLess; |
252 | 252 |
253 // Limits results to $ref:DownloadItem whose | 253 // Limits results to $ref:DownloadItem whose |
254 // <code>filename</code> matches the given regular expression. | 254 // <code>filename</code> matches the given regular expression. |
255 DOMString? filenameRegex; | 255 DOMString? filenameRegex; |
256 | 256 |
257 // Limits results to $ref:DownloadItem whose | 257 // Limits results to $ref:DownloadItem whose |
258 // <code>url</code> matches the given regular expression. | 258 // <code>url</code> matches the given regular expression. |
259 DOMString? urlRegex; | 259 DOMString? urlRegex; |
260 | 260 |
261 // The maximum number of matching $ref:DownloadItem returned. Defaults to | 261 // The maximum number of matching $ref:DownloadItem returned. Defaults to |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 | 297 |
298 // True if the download has stopped reading data from the host, but kept the | 298 // True if the download has stopped reading data from the host, but kept the |
299 // connection open. | 299 // connection open. |
300 boolean? paused; | 300 boolean? paused; |
301 | 301 |
302 // Why a download was interrupted. | 302 // Why a download was interrupted. |
303 InterruptReason? error; | 303 InterruptReason? error; |
304 | 304 |
305 // Number of bytes received so far from the host, without considering file | 305 // Number of bytes received so far from the host, without considering file |
306 // compression. | 306 // compression. |
307 long? bytesReceived; | 307 double? bytesReceived; |
308 | 308 |
309 // Number of bytes in the whole file, without considering file compression, | 309 // Number of bytes in the whole file, without considering file compression, |
310 // or -1 if unknown. | 310 // or -1 if unknown. |
311 long? totalBytes; | 311 double? totalBytes; |
312 | 312 |
313 // Number of bytes in the whole file post-decompression, or -1 if unknown. | 313 // Number of bytes in the whole file post-decompression, or -1 if unknown. |
314 long? fileSize; | 314 double? fileSize; |
315 | 315 |
316 // Whether the downloaded file exists; | 316 // Whether the downloaded file exists; |
317 boolean? exists; | 317 boolean? exists; |
318 }; | 318 }; |
319 | 319 |
320 dictionary StringDelta { | 320 dictionary StringDelta { |
321 DOMString? previous; | 321 DOMString? previous; |
322 DOMString? current; | 322 DOMString? current; |
323 }; | 323 }; |
324 | 324 |
325 dictionary LongDelta { | 325 dictionary DoubleDelta { |
326 long? previous; | 326 double? previous; |
327 long? current; | 327 double? current; |
328 }; | 328 }; |
329 | 329 |
330 dictionary BooleanDelta { | 330 dictionary BooleanDelta { |
331 boolean? previous; | 331 boolean? previous; |
332 boolean? current; | 332 boolean? current; |
333 }; | 333 }; |
334 | 334 |
335 // Encapsulates a change in a DownloadItem. | 335 // Encapsulates a change in a DownloadItem. |
336 [inline_doc] dictionary DownloadDelta { | 336 [inline_doc] dictionary DownloadDelta { |
337 // The <code>id</code> of the $ref:DownloadItem | 337 // The <code>id</code> of the $ref:DownloadItem |
(...skipping 24 matching lines...) Expand all Loading... |
362 // The change in <code>canResume</code>, if any. | 362 // The change in <code>canResume</code>, if any. |
363 BooleanDelta? canResume; | 363 BooleanDelta? canResume; |
364 | 364 |
365 // The change in <code>paused</code>, if any. | 365 // The change in <code>paused</code>, if any. |
366 BooleanDelta? paused; | 366 BooleanDelta? paused; |
367 | 367 |
368 // The change in <code>error</code>, if any. | 368 // The change in <code>error</code>, if any. |
369 StringDelta? error; | 369 StringDelta? error; |
370 | 370 |
371 // The change in <code>totalBytes</code>, if any. | 371 // The change in <code>totalBytes</code>, if any. |
372 LongDelta? totalBytes; | 372 DoubleDelta? totalBytes; |
373 | 373 |
374 // The change in <code>fileSize</code>, if any. | 374 // The change in <code>fileSize</code>, if any. |
375 LongDelta? fileSize; | 375 DoubleDelta? fileSize; |
376 | 376 |
377 // The change in <code>exists</code>, if any. | 377 // The change in <code>exists</code>, if any. |
378 BooleanDelta? exists; | 378 BooleanDelta? exists; |
379 }; | 379 }; |
380 | 380 |
381 [inline_doc] dictionary GetFileIconOptions { | 381 [inline_doc] dictionary GetFileIconOptions { |
382 // The size of the icon. The returned icon will be square with dimensions | 382 // The size of the icon. The returned icon will be square with dimensions |
383 // size * size pixels. The default size for the icon is 32x32 pixels. | 383 // size * size pixels. The default size for the icon is 32x32 pixels. |
384 [legalValues=(16,32)] long? size; | 384 [legalValues=(16,32)] long? size; |
385 }; | 385 }; |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 // <code>suggestion</code> object to <code>suggest</code> wins. In order to | 536 // <code>suggestion</code> object to <code>suggest</code> wins. In order to |
537 // avoid confusion regarding which extension will win, users should not | 537 // avoid confusion regarding which extension will win, users should not |
538 // install extensions that may conflict. If the download is initiated by | 538 // install extensions that may conflict. If the download is initiated by |
539 // $ref:download and the target filename is known before the MIME type and | 539 // $ref:download and the target filename is known before the MIME type and |
540 // tentative filename have been determined, pass <code>filename</code> to | 540 // tentative filename have been determined, pass <code>filename</code> to |
541 // $ref:download instead. | 541 // $ref:download instead. |
542 [maxListeners=1] static void onDeterminingFilename( | 542 [maxListeners=1] static void onDeterminingFilename( |
543 DownloadItem downloadItem, SuggestFilenameCallback suggest); | 543 DownloadItem downloadItem, SuggestFilenameCallback suggest); |
544 }; | 544 }; |
545 }; | 545 }; |
OLD | NEW |