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

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

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

Powered by Google App Engine
This is Rietveld 408576698