Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(496)

Side by Side Diff: content/common/url_loader.mojom

Issue 2503813002: Fix and refactor downloaded file handling in the loading stack (Closed)
Patch Set: revert an unrelated change Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 URLLoaderStatus; 14 struct URLLoaderStatus;
15 15
16 interface URLLoader { 16 interface URLLoader {
17 // If the associated request has |auto_follow_redirects| set to false, 17 // If the associated request has |auto_follow_redirects| set to false,
18 // then upon receiving an URLResponse with a non-NULL |redirect_url| field, 18 // then upon receiving an URLResponse with a non-NULL |redirect_url| field,
19 // |FollowRedirect| may be called to load the URL indicated by the redirect. 19 // |FollowRedirect| may be called to load the URL indicated by the redirect.
20 FollowRedirect(); 20 FollowRedirect();
21 21
22 // Cancels the request. The service will cancel loading, but there may be some 22 // Cancels the request. The service will cancel loading, but there may be some
23 // time lag and it is possible that the client gets some notification after 23 // time lag and it is possible that the client gets some notification after
24 // calling this method for a while. 24 // calling this method for a while.
25 Cancel(); 25 Cancel();
26 }; 26 };
27 27
28 interface DownloadedTempFile {
29 // Cleans up a downloaded temporary file created for 'download_to_file' case
30 // of resource loading.
31 Release();
32 };
33
28 interface URLLoaderClient { 34 interface URLLoaderClient {
29 // Called when the response head is received. 35 // Called when the response head is received. |downloaded_file| is non-null on
30 OnReceiveResponse(URLResponseHead head); 36 // the 'download_to_file' case. Call DownloadedTempFile::Release() once the
37 // resource load has completed and the client finished its clean up.
38 OnReceiveResponse(URLResponseHead head, DownloadedTempFile? downloaded_file);
31 39
32 // Called when some data from a resource request has been downloaded to the 40 // Called when some data from a resource request has been downloaded to the
33 // file. This is only called in the 'download_to_file' case and replaces 41 // file. This is only called in the 'download_to_file' case and replaces
34 // OnStartLoadingResponseBody in the call sequence in that case. 42 // OnStartLoadingResponseBody in the call sequence in that case.
35 OnDataDownloaded(int64 data_length, int64 encoded_length); 43 OnDataDownloaded(int64 data_length, int64 encoded_length);
36 44
37 // Called when the loader starts loading response body. 45 // Called when the loader starts loading response body.
38 OnStartLoadingResponseBody(handle<data_pipe_consumer> body); 46 OnStartLoadingResponseBody(handle<data_pipe_consumer> body);
39 47
40 // Called when the loading completes. No notification will be dispatched for 48 // Called when the loading completes. No notification will be dispatched for
41 // this client after this message arrives. 49 // this client after this message arrives.
42 OnComplete(URLLoaderStatus completion_status); 50 OnComplete(URLLoaderStatus completion_status);
43 }; 51 };
44 52
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698