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 // Represents a temporary file for a download_to_file case of resource loading. | |
28 // The downloaded file keeps alive until the instance is destroyed. | |
dcheng
2016/11/17 11:16:02
Empty interfaces are a bit unusual. My main feedba
tzik
2016/11/22 13:54:45
Done.
| |
29 interface DownloadedTempFile { | |
30 }; | |
31 | |
27 interface URLLoaderClient { | 32 interface URLLoaderClient { |
28 // Called when the response head is received. | 33 // Called when the response head is received. |downloaded_file| is non-null on |
dcheng
2016/11/17 11:16:02
Nit: on => in
tzik
2016/11/22 13:54:45
Done.
| |
29 OnReceiveResponse(URLResponseHead head); | 34 // the 'download_to_file' case. |
35 OnReceiveResponse(URLResponseHead head, DownloadedTempFile? downloaded_file); | |
30 | 36 |
31 // Called when the request has been redirected. The receiver is expected to | 37 // Called when the request has been redirected. The receiver is expected to |
32 // call FollowRedirect or cancel the request. | 38 // call FollowRedirect or cancel the request. |
33 OnReceiveRedirect(URLRequestRedirectInfo redirect_info, URLResponseHead head); | 39 OnReceiveRedirect(URLRequestRedirectInfo redirect_info, URLResponseHead head); |
34 | 40 |
35 // Called when some data from a resource request has been downloaded to the | 41 // 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 | 42 // file. This is only called in the 'download_to_file' case and replaces |
37 // OnStartLoadingResponseBody in the call sequence in that case. | 43 // OnStartLoadingResponseBody in the call sequence in that case. |
38 OnDataDownloaded(int64 data_length, int64 encoded_length); | 44 OnDataDownloaded(int64 data_length, int64 encoded_length); |
39 | 45 |
40 // Called when the loader starts loading response body. | 46 // Called when the loader starts loading response body. |
41 OnStartLoadingResponseBody(handle<data_pipe_consumer> body); | 47 OnStartLoadingResponseBody(handle<data_pipe_consumer> body); |
42 | 48 |
43 // Called when the loading completes. No notification will be dispatched for | 49 // Called when the loading completes. No notification will be dispatched for |
44 // this client after this message arrives. | 50 // this client after this message arrives. |
45 OnComplete(URLLoaderStatus completion_status); | 51 OnComplete(URLLoaderStatus completion_status); |
46 }; | 52 }; |
47 | 53 |
OLD | NEW |