OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 module content.mojom; | |
6 | |
7 [Native] | |
8 struct URLRequest; | |
9 | |
10 [Native] | |
11 struct URLResponseHead; | |
12 | |
13 [Native] | |
14 struct SSLInfo; | |
15 | |
16 [Native] | |
17 struct URLRequestRedirectInfo; | |
18 | |
19 [Native] | |
20 struct URLLoaderStatus; | |
21 | |
22 // This enum corresponds to net::RequestPriority. See its comments for details. | |
23 enum RequestPriority { | |
24 kThrottled = 0, | |
25 kIdle, | |
26 kLowest, | |
27 kLow, | |
28 kMedium, | |
29 kHighest | |
30 }; | |
31 | |
32 // Destroying a URLLoader will cancel the associated request. | |
33 interface URLLoader { | |
34 // If the associated request has |auto_follow_redirects| set to false, | |
35 // then upon receiving an URLResponse with a non-NULL |redirect_url| field, | |
36 // |FollowRedirect| may be called to load the URL indicated by the redirect. | |
37 FollowRedirect(); | |
38 | |
39 // Sets the request priority. | |
40 // |intra_priority_value| is a lesser priority which is used to prioritize | |
41 // requests within a given priority level. | |
42 SetPriority(RequestPriority priority, int32 intra_priority_value); | |
43 }; | |
44 | |
45 // Opaque handle passed from the browser process to a child process to manage | |
46 // the lifetime of temporary files used for download_to_file resource loading. | |
47 // When the message pipe for this interface is closed, the browser process will | |
48 // clean up the corresponding temporary file. | |
49 interface DownloadedTempFile { | |
50 }; | |
51 | |
52 | |
53 interface URLLoaderClient { | |
54 // Called when the response head is received. | |
55 // |downloaded_file| is non-null in the 'download_to_file' case. | |
56 // |ssl_info| is non-null if kSendSSLInfo was specified to | |
57 // CreateLoaderAndStart. | |
58 OnReceiveResponse(URLResponseHead head, | |
59 SSLInfo? ssl_info, | |
60 DownloadedTempFile? downloaded_file); | |
61 | |
62 // Called when the request has been redirected. The receiver is expected to | |
63 // call FollowRedirect or cancel the request. | |
64 OnReceiveRedirect(URLRequestRedirectInfo redirect_info, URLResponseHead head); | |
65 | |
66 // Called when some data from a resource request has been downloaded to the | |
67 // file. This is only called in the 'download_to_file' case and replaces | |
68 // OnStartLoadingResponseBody in the call sequence in that case. | |
69 // TODO(yhirano): Remove |encoded_length| and use OnTransferSizeUpdated | |
70 // instead. | |
71 OnDataDownloaded(int64 data_length, int64 encoded_length); | |
72 | |
73 // Called when the service made some progress on the file upload. This is | |
74 // called only when the request has an upload data. | |
75 // The implementation should call the response closure when the client is | |
76 // ready to receive the next upload progress. | |
77 OnUploadProgress(int64 current_position, int64 total_size) => (); | |
78 | |
79 // Called when cached metadata from a resource request is ready. | |
80 OnReceiveCachedMetadata(array<uint8> data); | |
81 | |
82 // Called when the transfer size is updated. This is only called if | |
83 // |report_raw_headers| is set and |download_to_file| is unset in the request. | |
84 // The transfer size is the length of the response (including both headers | |
85 // and the body) over the network. |transfer_size_diff| is the difference from | |
86 // the value previously reported one (including the one in OnReceiveResponse | |
87 // and OnReceiveRedirect). It must be positive. | |
88 // TODO(yhirano): Dispatch this notification even when |download_to_file| is | |
89 // set. | |
90 // TODO(yhirano): Consider using an unsigned type. | |
91 OnTransferSizeUpdated(int32 transfer_size_diff); | |
92 | |
93 // Called when the loader starts loading response body. This is called after | |
94 // OnReceiveResponse is called. | |
95 OnStartLoadingResponseBody(handle<data_pipe_consumer> body); | |
96 | |
97 // Called when the loading completes. No notification will be dispatched for | |
98 // this client after this message arrives. | |
99 OnComplete(URLLoaderStatus completion_status); | |
100 }; | |
101 | |
OLD | NEW |