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

Side by Side Diff: mojo/services/network/interfaces/url_loader_interceptor.mojom

Issue 1741963002: Auto-formatted all .mojom files. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 9 months 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 [DartPackage="mojo_services"] 5 [DartPackage="mojo_services"]
6 module mojo; 6 module mojo;
7 7
8 import "mojo/public/interfaces/network/url_request.mojom"; 8 import "mojo/public/interfaces/network/url_request.mojom";
9 import "mojo/public/interfaces/network/url_response.mojom"; 9 import "mojo/public/interfaces/network/url_response.mojom";
10 10
11 // Factory for |URLLoaderInterceptor|. The factory is called once per URLLoader 11 // Factory for |URLLoaderInterceptor|. The factory is called once per URLLoader
12 // and will be associated to it. 12 // and will be associated to it.
13 interface URLLoaderInterceptorFactory { 13 interface URLLoaderInterceptorFactory {
14 Create(URLLoaderInterceptor& interceptor); 14 Create(URLLoaderInterceptor& interceptor);
15 }; 15 };
16 16
17 // An |URLLoaderInterceptor| is associated to a single URLLoader. It will be 17 // An |URLLoaderInterceptor| is associated to a single URLLoader. It will be
18 // able to intercept requests sent to the URLLoader and transform these or 18 // able to intercept requests sent to the URLLoader and transform these or
19 // directly respond to it. It will also intercept responses and transform them 19 // directly respond to it. It will also intercept responses and transform them
20 // or ask the network to continue with another request instead. 20 // or ask the network to continue with another request instead.
21 // In case of redirect, the behavior is the following: 21 // In case of redirect, the behavior is the following:
22 // - If in the request |auto_follow_redirects| is true, the interceptor doesn't 22 // - If in the request |auto_follow_redirects| is true, the interceptor doesn't
23 // have access to any of the intermediate request(s) or response(s). 23 // have access to any of the intermediate request(s) or response(s).
24 // Otherwise, it has access to intermediate responses as they are sent to the 24 // Otherwise, it has access to intermediate responses as they are sent to the
25 // client and it is also notified when the client asks to follow a redirect. 25 // client and it is also notified when the client asks to follow a redirect.
26 interface URLLoaderInterceptor { 26 interface URLLoaderInterceptor {
27 // Intercept a request before it is sent to the network. This method can 27 // Intercept a request before it is sent to the network. This method can
28 // transform the request by returning the new requests to consider, or 28 // transform the request by returning the new requests to consider, or
29 // respond to the request itself by returning a response. 29 // respond to the request itself by returning a response.
30 InterceptRequest(URLRequest request) => 30 InterceptRequest(URLRequest request)
31 (URLLoaderInterceptorResponse response); 31 => (URLLoaderInterceptorResponse response);
32 32
33 // Intercept |URLLoader.FollowRedirect()| calls. This method can either 33 // Intercept |URLLoader.FollowRedirect()| calls. This method can either
34 // return null to let the call through, return a request to change the 34 // return null to let the call through, return a request to change the
35 // redirect, or respond to the redirect itself by returning a response. 35 // redirect, or respond to the redirect itself by returning a response.
36 InterceptFollowRedirect() => (URLLoaderInterceptorResponse? response); 36 InterceptFollowRedirect() => (URLLoaderInterceptorResponse? response);
37 37
38 // Intercept a response before it is sent to the loader client. This method 38 // Intercept a response before it is sent to the loader client. This method
39 // can transform the response by returning the new response to send, ask 39 // can transform the response by returning the new response to send, ask
40 // the loader to load a new request instead by returning the request to load, 40 // the loader to load a new request instead by returning the request to load,
41 // or if the response is a redirect, follow it by returning null. 41 // or if the response is a redirect, follow it by returning null.
42 InterceptResponse(URLResponse response) => 42 InterceptResponse(URLResponse response)
43 (URLLoaderInterceptorResponse? response); 43 => (URLLoaderInterceptorResponse? response);
44 }; 44 };
45 45
46 // Response for the intercept methods. One and only one of the two fields 46 // Response for the intercept methods. One and only one of the two fields
47 // must be set. If |request| is set, the url loader will execute the request. 47 // must be set. If |request| is set, the url loader will execute the request.
48 // If |response| is set, the url loader will send it to its client. It is the 48 // If |response| is set, the url loader will send it to its client. It is the
49 // responsibility of the interceptor not to create infinite loops. 49 // responsibility of the interceptor not to create infinite loops.
50 // TODO(qsr): Change this to an union. 50 // TODO(qsr): Change this to an union.
51 struct URLLoaderInterceptorResponse { 51 struct URLLoaderInterceptorResponse {
52 URLRequest? request; 52 URLRequest? request;
53 URLResponse? response; 53 URLResponse? response;
54 }; 54 };
OLDNEW
« no previous file with comments | « mojo/services/network/interfaces/udp_socket.mojom ('k') | mojo/services/network/interfaces/web_socket.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698