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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 // <dt>complete</dt> | 127 // <dt>complete</dt> |
128 // <dd>The download completed successfully.</dd> | 128 // <dd>The download completed successfully.</dd> |
129 // </dl> | 129 // </dl> |
130 enum State {in_progress, interrupted, complete}; | 130 enum State {in_progress, interrupted, complete}; |
131 | 131 |
132 // The state of the process of downloading a file. | 132 // The state of the process of downloading a file. |
133 dictionary DownloadItem { | 133 dictionary DownloadItem { |
134 // An identifier that is persistent across browser sessions. | 134 // An identifier that is persistent across browser sessions. |
135 long id; | 135 long id; |
136 | 136 |
137 // Absolute URL. | 137 // The absolute URL that this download initiated from, before any |
| 138 // redirects. |
138 DOMString url; | 139 DOMString url; |
139 | 140 |
| 141 // The absolute URL that this download is being made from, after all |
| 142 // redirects. |
| 143 DOMString finalUrl; |
| 144 |
140 // Absolute URL. | 145 // Absolute URL. |
141 DOMString referrer; | 146 DOMString referrer; |
142 | 147 |
143 // Absolute local path. | 148 // Absolute local path. |
144 DOMString filename; | 149 DOMString filename; |
145 | 150 |
146 // False if this download is recorded in the history, true if it is not | 151 // False if this download is recorded in the history, true if it is not |
147 // recorded. | 152 // recorded. |
148 boolean incognito; | 153 boolean incognito; |
149 | 154 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 DOMString? byExtensionId; | 224 DOMString? byExtensionId; |
220 | 225 |
221 // The localized name of the extension that initiated this download if this | 226 // The localized name of the extension that initiated this download if this |
222 // download was initiated by an extension. May change if the extension | 227 // download was initiated by an extension. May change if the extension |
223 // changes its name or if the user changes their locale. | 228 // changes its name or if the user changes their locale. |
224 DOMString? byExtensionName; | 229 DOMString? byExtensionName; |
225 }; | 230 }; |
226 | 231 |
227 [inline_doc] dictionary DownloadQuery { | 232 [inline_doc] dictionary DownloadQuery { |
228 // This array of search terms limits results to $(ref:DownloadItem) whose | 233 // This array of search terms limits results to $(ref:DownloadItem) whose |
229 // <code>filename</code> or <code>url</code> contain all of the search terms | 234 // <code>filename</code> or <code>url</code> or <code>finalUrl</code> |
230 // that do not begin with a dash '-' and none of the search terms that do | 235 // contain all of the search terms that do not begin with a dash '-' and |
231 // begin with a dash. | 236 // none of the search terms that do begin with a dash. |
232 DOMString[]? query; | 237 DOMString[]? query; |
233 | 238 |
234 // Limits results to $(ref:DownloadItem) that | 239 // Limits results to $(ref:DownloadItem) that |
235 // started before the given ms since the epoch. | 240 // started before the given ms since the epoch. |
236 DOMString? startedBefore; | 241 DOMString? startedBefore; |
237 | 242 |
238 // Limits results to $(ref:DownloadItem) that | 243 // Limits results to $(ref:DownloadItem) that |
239 // started after the given ms since the epoch. | 244 // started after the given ms since the epoch. |
240 DOMString? startedAfter; | 245 DOMString? startedAfter; |
241 | 246 |
(...skipping 14 matching lines...) Expand all Loading... |
256 double? totalBytesLess; | 261 double? totalBytesLess; |
257 | 262 |
258 // Limits results to $(ref:DownloadItem) whose | 263 // Limits results to $(ref:DownloadItem) whose |
259 // <code>filename</code> matches the given regular expression. | 264 // <code>filename</code> matches the given regular expression. |
260 DOMString? filenameRegex; | 265 DOMString? filenameRegex; |
261 | 266 |
262 // Limits results to $(ref:DownloadItem) whose | 267 // Limits results to $(ref:DownloadItem) whose |
263 // <code>url</code> matches the given regular expression. | 268 // <code>url</code> matches the given regular expression. |
264 DOMString? urlRegex; | 269 DOMString? urlRegex; |
265 | 270 |
| 271 // Limits results to $(ref:DownloadItem) whose |
| 272 // <code>finalUrl</code> matches the given regular expression. |
| 273 DOMString? finalUrlRegex; |
| 274 |
266 // The maximum number of matching $(ref:DownloadItem) returned. Defaults to | 275 // The maximum number of matching $(ref:DownloadItem) returned. Defaults to |
267 // 1000. Set to 0 in order to return all matching $(ref:DownloadItem). See | 276 // 1000. Set to 0 in order to return all matching $(ref:DownloadItem). See |
268 // $(ref:search) for how to page through results. | 277 // $(ref:search) for how to page through results. |
269 long? limit; | 278 long? limit; |
270 | 279 |
271 // Set elements of this array to $(ref:DownloadItem) properties in order to | 280 // Set elements of this array to $(ref:DownloadItem) properties in order to |
272 // sort search results. For example, setting | 281 // sort search results. For example, setting |
273 // <code>orderBy=['startTime']</code> sorts the $(ref:DownloadItem) by their | 282 // <code>orderBy=['startTime']</code> sorts the $(ref:DownloadItem) by their |
274 // start time in ascending order. To specify descending order, prefix with a | 283 // start time in ascending order. To specify descending order, prefix with a |
275 // hyphen: '-startTime'. | 284 // hyphen: '-startTime'. |
276 DOMString[]? orderBy; | 285 DOMString[]? orderBy; |
277 | 286 |
278 // The <code>id</code> of the $(ref:DownloadItem) to query. | 287 // The <code>id</code> of the $(ref:DownloadItem) to query. |
279 long? id; | 288 long? id; |
280 | 289 |
281 // Absolute URL. | 290 // The absolute URL that this download initiated from, before any |
| 291 // redirects. |
282 DOMString? url; | 292 DOMString? url; |
283 | 293 |
| 294 // The absolute URL that this download is being made from, after all |
| 295 // redirects. |
| 296 DOMString? finalUrl; |
| 297 |
284 // Absolute local path. | 298 // Absolute local path. |
285 DOMString? filename; | 299 DOMString? filename; |
286 | 300 |
287 // Indication of whether this download is thought to be safe or known to be | 301 // Indication of whether this download is thought to be safe or known to be |
288 // suspicious. | 302 // suspicious. |
289 DangerType? danger; | 303 DangerType? danger; |
290 | 304 |
291 // The file's MIME type. | 305 // The file's MIME type. |
292 DOMString? mime; | 306 DOMString? mime; |
293 | 307 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 | 353 |
340 // Encapsulates a change in a DownloadItem. | 354 // Encapsulates a change in a DownloadItem. |
341 [inline_doc] dictionary DownloadDelta { | 355 [inline_doc] dictionary DownloadDelta { |
342 // The <code>id</code> of the $(ref:DownloadItem) | 356 // The <code>id</code> of the $(ref:DownloadItem) |
343 // that changed. | 357 // that changed. |
344 long id; | 358 long id; |
345 | 359 |
346 // The change in <code>url</code>, if any. | 360 // The change in <code>url</code>, if any. |
347 StringDelta? url; | 361 StringDelta? url; |
348 | 362 |
| 363 // The change in <code>finalUrl</code>, if any. |
| 364 StringDelta? finalUrl; |
| 365 |
349 // The change in <code>filename</code>, if any. | 366 // The change in <code>filename</code>, if any. |
350 StringDelta? filename; | 367 StringDelta? filename; |
351 | 368 |
352 // The change in <code>danger</code>, if any. | 369 // The change in <code>danger</code>, if any. |
353 StringDelta? danger; | 370 StringDelta? danger; |
354 | 371 |
355 // The change in <code>mime</code>, if any. | 372 // The change in <code>mime</code>, if any. |
356 StringDelta? mime; | 373 StringDelta? mime; |
357 | 374 |
358 // The change in <code>startTime</code>, if any. | 375 // The change in <code>startTime</code>, if any. |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 // <code>suggestion</code> object to <code>suggest</code> wins. In order to | 561 // <code>suggestion</code> object to <code>suggest</code> wins. In order to |
545 // avoid confusion regarding which extension will win, users should not | 562 // avoid confusion regarding which extension will win, users should not |
546 // install extensions that may conflict. If the download is initiated by | 563 // install extensions that may conflict. If the download is initiated by |
547 // $(ref:download) and the target filename is known before the MIME type and | 564 // $(ref:download) and the target filename is known before the MIME type and |
548 // tentative filename have been determined, pass <code>filename</code> to | 565 // tentative filename have been determined, pass <code>filename</code> to |
549 // $(ref:download) instead. | 566 // $(ref:download) instead. |
550 [maxListeners=1] static void onDeterminingFilename( | 567 [maxListeners=1] static void onDeterminingFilename( |
551 DownloadItem downloadItem, SuggestFilenameCallback suggest); | 568 DownloadItem downloadItem, SuggestFilenameCallback suggest); |
552 }; | 569 }; |
553 }; | 570 }; |
OLD | NEW |