OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 module content.mojom; | 5 module content.mojom; |
6 | 6 |
7 [Native] | 7 [Native] |
8 struct URLRequest; | 8 struct URLRequest; |
9 | 9 |
10 [Native] | 10 [Native] |
11 struct URLResponseHead; | 11 struct URLResponseHead; |
12 | 12 |
13 [Native] | 13 [Native] |
14 struct URLRequestRedirectInfo; | 14 struct URLRequestRedirectInfo; |
15 | 15 |
16 [Native] | 16 [Native] |
17 struct URLLoaderStatus; | 17 struct URLLoaderStatus; |
18 | 18 |
19 // Destroying a URLLoader will cancel the associated request. | 19 // Destroying a URLLoader will cancel the associated request. |
20 interface URLLoader { | 20 interface URLLoader { |
21 // If the associated request has |auto_follow_redirects| set to false, | 21 // If the associated request has |auto_follow_redirects| set to false, |
22 // then upon receiving an URLResponse with a non-NULL |redirect_url| field, | 22 // then upon receiving an URLResponse with a non-NULL |redirect_url| field, |
23 // |FollowRedirect| may be called to load the URL indicated by the redirect. | 23 // |FollowRedirect| may be called to load the URL indicated by the redirect. |
24 FollowRedirect(); | 24 FollowRedirect(); |
25 }; | 25 }; |
26 | 26 |
| 27 // Opaque handle passed from the browser process to a child process to manage |
| 28 // the lifetime of temporary files used for download_to_file resource loading. |
| 29 // When the message pipe for this interface is closed, the browser process will |
| 30 // clean up the corresponding temporary file. |
| 31 interface DownloadedTempFile { |
| 32 }; |
| 33 |
| 34 |
27 interface URLLoaderClient { | 35 interface URLLoaderClient { |
28 // Called when the response head is received. | 36 // Called when the response head is received. |downloaded_file| is non-null in |
29 OnReceiveResponse(URLResponseHead head); | 37 // the 'download_to_file' case. |
| 38 OnReceiveResponse(URLResponseHead head, DownloadedTempFile? downloaded_file); |
30 | 39 |
31 // Called when the request has been redirected. The receiver is expected to | 40 // Called when the request has been redirected. The receiver is expected to |
32 // call FollowRedirect or cancel the request. | 41 // call FollowRedirect or cancel the request. |
33 OnReceiveRedirect(URLRequestRedirectInfo redirect_info, URLResponseHead head); | 42 OnReceiveRedirect(URLRequestRedirectInfo redirect_info, URLResponseHead head); |
34 | 43 |
35 // Called when some data from a resource request has been downloaded to the | 44 // Called when some data from a resource request has been downloaded to the |
36 // file. This is only called in the 'download_to_file' case and replaces | 45 // file. This is only called in the 'download_to_file' case and replaces |
37 // OnStartLoadingResponseBody in the call sequence in that case. | 46 // OnStartLoadingResponseBody in the call sequence in that case. |
38 OnDataDownloaded(int64 data_length, int64 encoded_length); | 47 OnDataDownloaded(int64 data_length, int64 encoded_length); |
39 | 48 |
40 // Called when the loader starts loading response body. | 49 // Called when the loader starts loading response body. |
41 OnStartLoadingResponseBody(handle<data_pipe_consumer> body); | 50 OnStartLoadingResponseBody(handle<data_pipe_consumer> body); |
42 | 51 |
43 // Called when the loading completes. No notification will be dispatched for | 52 // Called when the loading completes. No notification will be dispatched for |
44 // this client after this message arrives. | 53 // this client after this message arrives. |
45 OnComplete(URLLoaderStatus completion_status); | 54 OnComplete(URLLoaderStatus completion_status); |
46 }; | 55 }; |
47 | 56 |
OLD | NEW |