1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
|
[
{
"namespace": "manifest",
"types": [
{
"$extend": "OptionalPermission",
"choices": [
{
"type": "string",
"enum": ["downloads", "downloads.open"]
}
]
}
]
},
{
"namespace": "downloads",
"permissions": ["downloads"],
"types": [
{
"id": "FilenameConflictAction",
"type": "string",
"enum": ["uniquify", "overwrite", "prompt"]
},
{
"id": "InterruptReason",
"type": "string",
"enum": [
"FILE_FAILED",
"FILE_ACCESS_DENIED",
"FILE_NO_SPACE",
"FILE_NAME_TOO_LONG",
"FILE_TOO_LARGE",
"FILE_VIRUS_INFECTED",
"FILE_TRANSIENT_ERROR",
"FILE_BLOCKED",
"FILE_SECURITY_CHECK_FAILED",
"FILE_TOO_SHORT",
"NETWORK_FAILED",
"NETWORK_TIMEOUT",
"NETWORK_DISCONNECTED",
"NETWORK_SERVER_DOWN",
"NETWORK_INVALID_REQUEST",
"SERVER_FAILED",
"SERVER_NO_RANGE",
"SERVER_BAD_CONTENT",
"SERVER_UNAUTHORIZED",
"SERVER_CERT_PROBLEM",
"SERVER_FORBIDDEN",
"USER_CANCELED",
"USER_SHUTDOWN",
"CRASH"
]
},
{
"id": "DangerType",
"type": "string",
"enum": [
"file",
"url",
"content",
"uncommon",
"host",
"unwanted",
"safe",
"accepted"
],
"description": "<dl><dt>file</dt><dd>The download's filename is suspicious.</dd><dt>url</dt><dd>The download's URL is known to be malicious.</dd><dt>content</dt><dd>The downloaded file is known to be malicious.</dd><dt>uncommon</dt><dd>The download's URL is not commonly downloaded and could be dangerous.</dd><dt>safe</dt><dd>The download presents no known danger to the user's computer.</dd></dl>These string constants will never change, however the set of DangerTypes may change."
},
{
"id": "State",
"type": "string",
"enum": ["in_progress", "interrupted", "complete"],
"description": "<dl><dt>in_progress</dt><dd>The download is currently receiving data from the server.</dd><dt>interrupted</dt><dd>An error broke the connection with the file host.</dd><dt>complete</dt><dd>The download completed successfully.</dd></dl>These string constants will never change, however the set of States may change."
},
{
"id": "DownloadItem",
"type": "object",
"properties": {
"id": {
"description": "An identifier that is persistent across browser sessions.",
"type": "integer"
},
"url": {
"description": "Absolute URL.",
"type": "string"
},
"referrer": {
"type": "string",
"optional": true
},
"filename": {
"description": "Absolute local path.",
"type": "string"
},
"incognito": {
"description": "False if this download is recorded in the history, true if it is not recorded.",
"type": "boolean"
},
"cookieStoreId": {
"type": "string",
"optional": true,
"description": "The cookie store ID of the contextual identity."
},
"danger": {
"$ref": "DangerType",
"description": "Indication of whether this download is thought to be safe or known to be suspicious."
},
"mime": {
"description": "The file's MIME type.",
"type": "string",
"optional": true
},
"startTime": {
"description": "Number of milliseconds between the unix epoch and when this download began.",
"type": "string"
},
"endTime": {
"description": "Number of milliseconds between the unix epoch and when this download ended.",
"optional": true,
"type": "string"
},
"estimatedEndTime": {
"type": "string",
"optional": true
},
"state": {
"$ref": "State",
"description": "Indicates whether the download is progressing, interrupted, or complete."
},
"paused": {
"description": "True if the download has stopped reading data from the host, but kept the connection open.",
"type": "boolean"
},
"canResume": {
"type": "boolean"
},
"error": {
"description": "Number indicating why a download was interrupted.",
"optional": true,
"$ref": "InterruptReason"
},
"bytesReceived": {
"description": "Number of bytes received so far from the host, without considering file compression.",
"type": "number"
},
"totalBytes": {
"description": "Number of bytes in the whole file, without considering file compression, or -1 if unknown.",
"type": "number"
},
"fileSize": {
"description": "Number of bytes in the whole file post-decompression, or -1 if unknown.",
"type": "number"
},
"exists": {
"type": "boolean"
},
"byExtensionId": {
"type": "string",
"optional": true
},
"byExtensionName": {
"type": "string",
"optional": true
}
}
},
{
"id": "StringDelta",
"type": "object",
"properties": {
"current": {
"optional": true,
"type": "string"
},
"previous": {
"optional": true,
"type": "string"
}
}
},
{
"id": "DoubleDelta",
"type": "object",
"properties": {
"current": {
"optional": true,
"type": "number"
},
"previous": {
"optional": true,
"type": "number"
}
}
},
{
"id": "BooleanDelta",
"type": "object",
"properties": {
"current": {
"optional": true,
"type": "boolean"
},
"previous": {
"optional": true,
"type": "boolean"
}
}
},
{
"id": "DownloadTime",
"description": "A time specified as a Date object, a number or string representing milliseconds since the epoch, or an ISO 8601 string",
"choices": [
{
"type": "string",
"pattern": "^[1-9]\\d*$"
},
{
"$ref": "extensionTypes.Date"
}
]
},
{
"id": "DownloadQuery",
"description": "Parameters that combine to specify a predicate that can be used to select a set of downloads. Used for example in search() and erase()",
"type": "object",
"properties": {
"query": {
"description": "This array of search terms limits results to <a href='#type-DownloadItem'>DownloadItems</a> whose <code>filename</code> or <code>url</code> contain all of the search terms that do not begin with a dash '-' and none of the search terms that do begin with a dash.",
"optional": true,
"type": "array",
"items": { "type": "string" }
},
"startedBefore": {
"description": "Limits results to downloads that started before the given ms since the epoch.",
"optional": true,
"$ref": "DownloadTime"
},
"startedAfter": {
"description": "Limits results to downloads that started after the given ms since the epoch.",
"optional": true,
"$ref": "DownloadTime"
},
"endedBefore": {
"description": "Limits results to downloads that ended before the given ms since the epoch.",
"optional": true,
"$ref": "DownloadTime"
},
"endedAfter": {
"description": "Limits results to downloads that ended after the given ms since the epoch.",
"optional": true,
"$ref": "DownloadTime"
},
"totalBytesGreater": {
"description": "Limits results to downloads whose totalBytes is greater than the given integer.",
"optional": true,
"type": "number"
},
"totalBytesLess": {
"description": "Limits results to downloads whose totalBytes is less than the given integer.",
"optional": true,
"type": "number"
},
"filenameRegex": {
"description": "Limits results to <a href='#type-DownloadItem'>DownloadItems</a> whose <code>filename</code> matches the given regular expression.",
"optional": true,
"type": "string"
},
"urlRegex": {
"description": "Limits results to <a href='#type-DownloadItem'>DownloadItems</a> whose <code>url</code> matches the given regular expression.",
"optional": true,
"type": "string"
},
"limit": {
"description": "Setting this integer limits the number of results. Otherwise, all matching <a href='#type-DownloadItem'>DownloadItems</a> will be returned.",
"optional": true,
"type": "integer"
},
"orderBy": {
"description": "Setting elements of this array to <a href='#type-DownloadItem'>DownloadItem</a> properties in order to sort the search results. For example, setting <code>orderBy='startTime'</code> sorts the <a href='#type-DownloadItem'>DownloadItems</a> by their start time in ascending order. To specify descending order, prefix <code>orderBy</code> with a hyphen: '-startTime'.",
"optional": true,
"type": "array",
"items": { "type": "string" }
},
"id": {
"type": "integer",
"optional": true
},
"url": {
"description": "Absolute URL.",
"optional": true,
"type": "string"
},
"filename": {
"description": "Absolute local path.",
"optional": true,
"type": "string"
},
"cookieStoreId": {
"type": "string",
"optional": true,
"description": "The cookie store ID of the contextual identity."
},
"danger": {
"$ref": "DangerType",
"description": "Indication of whether this download is thought to be safe or known to be suspicious.",
"optional": true
},
"mime": {
"description": "The file's MIME type.",
"optional": true,
"type": "string"
},
"startTime": {
"optional": true,
"type": "string"
},
"endTime": {
"optional": true,
"type": "string"
},
"state": {
"$ref": "State",
"description": "Indicates whether the download is progressing, interrupted, or complete.",
"optional": true
},
"paused": {
"description": "True if the download has stopped reading data from the host, but kept the connection open.",
"optional": true,
"type": "boolean"
},
"error": {
"description": "Why a download was interrupted.",
"optional": true,
"$ref": "InterruptReason"
},
"bytesReceived": {
"description": "Number of bytes received so far from the host, without considering file compression.",
"optional": true,
"type": "number"
},
"totalBytes": {
"description": "Number of bytes in the whole file, without considering file compression, or -1 if unknown.",
"optional": true,
"type": "number"
},
"fileSize": {
"description": "Number of bytes in the whole file post-decompression, or -1 if unknown.",
"optional": true,
"type": "number"
},
"exists": {
"type": "boolean",
"optional": true
}
}
}
],
"functions": [
{
"name": "download",
"type": "function",
"async": "callback",
"description": "Download a URL. If the URL uses the HTTP[S] protocol, then the request will include all cookies currently set for its hostname. If both <code>filename</code> and <code>saveAs</code> are specified, then the Save As dialog will be displayed, pre-populated with the specified <code>filename</code>. If the download started successfully, <code>callback</code> will be called with the new <a href='#type-DownloadItem'>DownloadItem</a>'s <code>downloadId</code>. If there was an error starting the download, then <code>callback</code> will be called with <code>downloadId=undefined</code> and <a href='extension.html#property-lastError'>chrome.extension.lastError</a> will contain a descriptive string. The error strings are not guaranteed to remain backwards compatible between releases. You must not parse it.",
"parameters": [
{
"description": "What to download and how.",
"name": "options",
"type": "object",
"properties": {
"url": {
"description": "The URL to download.",
"type": "string",
"format": "url"
},
"filename": {
"description": "A file path relative to the Downloads directory to contain the downloaded file.",
"optional": true,
"type": "string"
},
"incognito": {
"description": "Whether to associate the download with a private browsing session.",
"optional": true,
"default": false,
"type": "boolean"
},
"cookieStoreId": {
"type": "string",
"optional": true,
"description": "The cookie store ID of the contextual identity; requires \"cookies\" permission."
},
"conflictAction": {
"$ref": "FilenameConflictAction",
"optional": true
},
"saveAs": {
"description": "Use a file-chooser to allow the user to select a filename. If the option is not specified, the file chooser will be shown only if the Firefox \"Always ask you where to save files\" option is enabled (i.e. the pref <code>browser.download.useDownloadDir</code> is set to <code>false</code>).",
"optional": true,
"type": "boolean"
},
"method": {
"description": "The HTTP method to use if the URL uses the HTTP[S] protocol.",
"enum": ["GET", "POST"],
"optional": true,
"type": "string"
},
"headers": {
"optional": true,
"type": "array",
"description": "Extra HTTP headers to send with the request if the URL uses the HTTP[s] protocol. Each header is represented as a dictionary containing the keys <code>name</code> and either <code>value</code> or <code>binaryValue</code>, restricted to those allowed by XMLHttpRequest.",
"items": {
"type": "object",
"properties": {
"name": {
"description": "Name of the HTTP header.",
"type": "string"
},
"value": {
"description": "Value of the HTTP header.",
"type": "string"
}
}
}
},
"body": {
"description": "Post body.",
"optional": true,
"type": "string"
},
"allowHttpErrors": {
"description": "When this flag is set to <code>true</code>, then the browser will allow downloads to proceed after encountering HTTP errors such as <code>404 Not Found</code>.",
"optional": true,
"default": false,
"type": "boolean"
}
}
},
{
"name": "callback",
"type": "function",
"optional": true,
"parameters": [
{
"name": "downloadId",
"type": "integer"
}
]
}
]
},
{
"name": "search",
"type": "function",
"async": "callback",
"description": "Find <a href='#type-DownloadItem'>DownloadItems</a>. Set <code>query</code> to the empty object to get all <a href='#type-DownloadItem'>DownloadItems</a>. To get a specific <a href='#type-DownloadItem'>DownloadItem</a>, set only the <code>id</code> field.",
"parameters": [
{
"name": "query",
"$ref": "DownloadQuery"
},
{
"name": "callback",
"type": "function",
"parameters": [
{
"items": {
"$ref": "DownloadItem"
},
"name": "results",
"type": "array"
}
]
}
]
},
{
"name": "pause",
"type": "function",
"async": "callback",
"description": "Pause the download. If the request was successful the download is in a paused state. Otherwise <a href='extension.html#property-lastError'>chrome.extension.lastError</a> contains an error message. The request will fail if the download is not active.",
"parameters": [
{
"description": "The id of the download to pause.",
"name": "downloadId",
"type": "integer"
},
{
"name": "callback",
"optional": true,
"parameters": [],
"type": "function"
}
]
},
{
"name": "resume",
"type": "function",
"async": "callback",
"description": "Resume a paused download. If the request was successful the download is in progress and unpaused. Otherwise <a href='extension.html#property-lastError'>chrome.extension.lastError</a> contains an error message. The request will fail if the download is not active.",
"parameters": [
{
"description": "The id of the download to resume.",
"name": "downloadId",
"type": "integer"
},
{
"name": "callback",
"optional": true,
"parameters": [],
"type": "function"
}
]
},
{
"name": "cancel",
"type": "function",
"async": "callback",
"description": "Cancel a download. When <code>callback</code> is run, the download is cancelled, completed, interrupted or doesn't exist anymore.",
"parameters": [
{
"description": "The id of the download to cancel.",
"name": "downloadId",
"type": "integer"
},
{
"name": "callback",
"optional": true,
"parameters": [],
"type": "function"
}
]
},
{
"name": "getFileIcon",
"type": "function",
"async": "callback",
"description": "Retrieve an icon for the specified download. For new downloads, file icons are available after the <a href='#event-onCreated'>onCreated</a> event has been received. The image returned by this function while a download is in progress may be different from the image returned after the download is complete. Icon retrieval is done by querying the underlying operating system or toolkit depending on the platform. The icon that is returned will therefore depend on a number of factors including state of the download, platform, registered file types and visual theme. If a file icon cannot be determined, <a href='extension.html#property-lastError'>chrome.extension.lastError</a> will contain an error message.",
"parameters": [
{
"description": "The identifier for the download.",
"name": "downloadId",
"type": "integer"
},
{
"name": "options",
"optional": true,
"properties": {
"size": {
"description": "The size of the icon. The returned icon will be square with dimensions size * size pixels. The default size for the icon is 32x32 pixels.",
"optional": true,
"minimum": 1,
"maximum": 127,
"type": "integer"
}
},
"type": "object"
},
{
"name": "callback",
"parameters": [
{
"name": "iconURL",
"optional": true,
"type": "string"
}
],
"type": "function"
}
]
},
{
"name": "open",
"type": "function",
"async": "callback",
"requireUserInput": true,
"description": "Open the downloaded file.",
"permissions": ["downloads.open"],
"parameters": [
{
"name": "downloadId",
"type": "integer"
},
{
"name": "callback",
"type": "function",
"optional": true,
"parameters": []
}
]
},
{
"name": "show",
"type": "function",
"description": "Show the downloaded file in its folder in a file manager.",
"async": "callback",
"parameters": [
{
"name": "downloadId",
"type": "integer"
},
{
"name": "callback",
"type": "function",
"optional": true,
"parameters": [
{
"name": "success",
"type": "boolean"
}
]
}
]
},
{
"name": "showDefaultFolder",
"type": "function",
"parameters": []
},
{
"name": "erase",
"type": "function",
"async": "callback",
"description": "Erase matching <a href='#type-DownloadItem'>DownloadItems</a> from history",
"parameters": [
{
"name": "query",
"$ref": "DownloadQuery"
},
{
"name": "callback",
"type": "function",
"optional": true,
"parameters": [
{
"items": {
"type": "integer"
},
"name": "erasedIds",
"type": "array"
}
]
}
]
},
{
"name": "removeFile",
"async": "callback",
"type": "function",
"parameters": [
{
"name": "downloadId",
"type": "integer"
},
{
"name": "callback",
"type": "function",
"optional": true,
"parameters": []
}
]
},
{
"description": "Prompt the user to either accept or cancel a dangerous download. <code>acceptDanger()</code> does not automatically accept dangerous downloads.",
"name": "acceptDanger",
"unsupported": true,
"parameters": [
{
"name": "downloadId",
"type": "integer"
},
{
"name": "callback",
"type": "function",
"optional": true,
"parameters": []
}
],
"type": "function"
},
{
"description": "Initiate dragging the file to another application.",
"name": "drag",
"unsupported": true,
"parameters": [
{
"name": "downloadId",
"type": "integer"
}
],
"type": "function"
},
{
"name": "setShelfEnabled",
"type": "function",
"unsupported": true,
"parameters": [
{
"name": "enabled",
"type": "boolean"
}
]
}
],
"events": [
{
"description": "This event fires with the <a href='#type-DownloadItem'>DownloadItem</a> object when a download begins.",
"name": "onCreated",
"parameters": [
{
"$ref": "DownloadItem",
"name": "downloadItem"
}
],
"type": "function"
},
{
"description": "Fires with the <code>downloadId</code> when a download is erased from history.",
"name": "onErased",
"parameters": [
{
"name": "downloadId",
"description": "The <code>id</code> of the <a href='#type-DownloadItem'>DownloadItem</a> that was erased.",
"type": "integer"
}
],
"type": "function"
},
{
"name": "onChanged",
"description": "When any of a <a href='#type-DownloadItem'>DownloadItem</a>'s properties except <code>bytesReceived</code> changes, this event fires with the <code>downloadId</code> and an object containing the properties that changed.",
"parameters": [
{
"name": "downloadDelta",
"type": "object",
"properties": {
"id": {
"description": "The <code>id</code> of the <a href='#type-DownloadItem'>DownloadItem</a> that changed.",
"type": "integer"
},
"url": {
"description": "Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>url</code>.",
"optional": true,
"$ref": "StringDelta"
},
"filename": {
"description": "Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>filename</code>.",
"optional": true,
"$ref": "StringDelta"
},
"danger": {
"description": "Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>danger</code>.",
"optional": true,
"$ref": "StringDelta"
},
"mime": {
"description": "Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>mime</code>.",
"optional": true,
"$ref": "StringDelta"
},
"startTime": {
"description": "Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>startTime</code>.",
"optional": true,
"$ref": "StringDelta"
},
"endTime": {
"description": "Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>endTime</code>.",
"optional": true,
"$ref": "StringDelta"
},
"state": {
"description": "Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>state</code>.",
"optional": true,
"$ref": "StringDelta"
},
"canResume": {
"optional": true,
"$ref": "BooleanDelta"
},
"paused": {
"description": "Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>paused</code>.",
"optional": true,
"$ref": "BooleanDelta"
},
"error": {
"description": "Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>error</code>.",
"optional": true,
"$ref": "StringDelta"
},
"totalBytes": {
"description": "Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>totalBytes</code>.",
"optional": true,
"$ref": "DoubleDelta"
},
"fileSize": {
"description": "Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>fileSize</code>.",
"optional": true,
"$ref": "DoubleDelta"
},
"exists": {
"optional": true,
"$ref": "BooleanDelta"
}
}
}
],
"type": "function"
}
]
}
]
|