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

Side by Side Diff: net/base/network_delegate.h

Issue 333113002: Move data reduction proxy to Chrome-Proxy header for authentication (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@flywheel-refactor-net-fake-a-redirect-response-headers-chrome-proxy-auth
Patch Set: errata Created 6 years, 5 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef NET_BASE_NETWORK_DELEGATE_H_ 5 #ifndef NET_BASE_NETWORK_DELEGATE_H_
6 #define NET_BASE_NETWORK_DELEGATE_H_ 6 #define NET_BASE_NETWORK_DELEGATE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 17 matching lines...) Expand all
28 // would have to be broken up into too many smaller interfaces targeted to each 28 // would have to be broken up into too many smaller interfaces targeted to each
29 // submodule. Also, since the lower levels in net/ may callback into higher 29 // submodule. Also, since the lower levels in net/ may callback into higher
30 // levels, we may encounter dangerous casting issues. 30 // levels, we may encounter dangerous casting issues.
31 // 31 //
32 // NOTE: It is not okay to add any compile-time dependencies on symbols outside 32 // NOTE: It is not okay to add any compile-time dependencies on symbols outside
33 // of net/base here, because we have a net_base library. Forward declarations 33 // of net/base here, because we have a net_base library. Forward declarations
34 // are ok. 34 // are ok.
35 class CookieOptions; 35 class CookieOptions;
36 class HttpRequestHeaders; 36 class HttpRequestHeaders;
37 class HttpResponseHeaders; 37 class HttpResponseHeaders;
38 class ProxyInfo;
38 class SocketStream; 39 class SocketStream;
39 class URLRequest; 40 class URLRequest;
40 41
41 class NET_EXPORT NetworkDelegate : public base::NonThreadSafe { 42 class NET_EXPORT NetworkDelegate : public base::NonThreadSafe {
42 public: 43 public:
43 // AuthRequiredResponse indicates how a NetworkDelegate handles an 44 // AuthRequiredResponse indicates how a NetworkDelegate handles an
44 // OnAuthRequired call. It's placed in this file to prevent url_request.h 45 // OnAuthRequired call. It's placed in this file to prevent url_request.h
45 // from having to include network_delegate.h. 46 // from having to include network_delegate.h.
46 enum AuthRequiredResponse { 47 enum AuthRequiredResponse {
47 AUTH_REQUIRED_RESPONSE_NO_ACTION, 48 AUTH_REQUIRED_RESPONSE_NO_ACTION,
48 AUTH_REQUIRED_RESPONSE_SET_AUTH, 49 AUTH_REQUIRED_RESPONSE_SET_AUTH,
49 AUTH_REQUIRED_RESPONSE_CANCEL_AUTH, 50 AUTH_REQUIRED_RESPONSE_CANCEL_AUTH,
50 AUTH_REQUIRED_RESPONSE_IO_PENDING, 51 AUTH_REQUIRED_RESPONSE_IO_PENDING,
51 }; 52 };
52 typedef base::Callback<void(AuthRequiredResponse)> AuthCallback; 53 typedef base::Callback<void(AuthRequiredResponse)> AuthCallback;
53 54
54 virtual ~NetworkDelegate() {} 55 virtual ~NetworkDelegate() {}
55 56
56 // Notification interface called by the network stack. Note that these 57 // Notification interface called by the network stack. Note that these
57 // functions mostly forward to the private virtuals. They also add some sanity 58 // functions mostly forward to the private virtuals. They also add some sanity
58 // checking on parameters. See the corresponding virtuals for explanations of 59 // checking on parameters. See the corresponding virtuals for explanations of
59 // the methods and their arguments. 60 // the methods and their arguments.
60 int NotifyBeforeURLRequest(URLRequest* request, 61 int NotifyBeforeURLRequest(URLRequest* request,
61 const CompletionCallback& callback, 62 const CompletionCallback& callback,
62 GURL* new_url); 63 GURL* new_url);
63 int NotifyBeforeSendHeaders(URLRequest* request, 64 int NotifyBeforeSendHeaders(URLRequest* request,
64 const CompletionCallback& callback, 65 const CompletionCallback& callback,
65 HttpRequestHeaders* headers); 66 HttpRequestHeaders* headers);
67 void NotifyBeforeSendProxyHeaders(URLRequest* request,
68 const ProxyInfo& proxy_info,
69 HttpRequestHeaders* headers);
66 void NotifySendHeaders(URLRequest* request, 70 void NotifySendHeaders(URLRequest* request,
67 const HttpRequestHeaders& headers); 71 const HttpRequestHeaders& headers);
68 int NotifyHeadersReceived( 72 int NotifyHeadersReceived(
69 URLRequest* request, 73 URLRequest* request,
70 const CompletionCallback& callback, 74 const CompletionCallback& callback,
71 const HttpResponseHeaders* original_response_headers, 75 const HttpResponseHeaders* original_response_headers,
72 scoped_refptr<HttpResponseHeaders>* override_response_headers, 76 scoped_refptr<HttpResponseHeaders>* override_response_headers,
73 GURL* allowed_unsafe_redirect_url); 77 GURL* allowed_unsafe_redirect_url);
74 void NotifyBeforeRedirect(URLRequest* request, 78 void NotifyBeforeRedirect(URLRequest* request,
75 const GURL& new_location); 79 const GURL& new_location);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 123
120 // Called right before the HTTP headers are sent. Allows the delegate to 124 // Called right before the HTTP headers are sent. Allows the delegate to
121 // read/write |headers| before they get sent out. |callback| and |headers| are 125 // read/write |headers| before they get sent out. |callback| and |headers| are
122 // valid only until OnCompleted or OnURLRequestDestroyed is called for this 126 // valid only until OnCompleted or OnURLRequestDestroyed is called for this
123 // request. 127 // request.
124 // See OnBeforeURLRequest for return value description. Returns OK by default. 128 // See OnBeforeURLRequest for return value description. Returns OK by default.
125 virtual int OnBeforeSendHeaders(URLRequest* request, 129 virtual int OnBeforeSendHeaders(URLRequest* request,
126 const CompletionCallback& callback, 130 const CompletionCallback& callback,
127 HttpRequestHeaders* headers); 131 HttpRequestHeaders* headers);
128 132
133 // Called after a proxy connection. Allows the delegate to read/write
134 // |headers| before they get sent out. |headers| is valid only until
135 // OnCompleted or OnURLRequestDestroyed is called for this request.
136 virtual void OnBeforeSendProxyHeaders(URLRequest* request,
137 const ProxyInfo& proxy_info,
138 HttpRequestHeaders* headers);
139
129 // Called right before the HTTP request(s) are being sent to the network. 140 // Called right before the HTTP request(s) are being sent to the network.
130 // |headers| is only valid until OnCompleted or OnURLRequestDestroyed is 141 // |headers| is only valid until OnCompleted or OnURLRequestDestroyed is
131 // called for this request. 142 // called for this request.
132 virtual void OnSendHeaders(URLRequest* request, 143 virtual void OnSendHeaders(URLRequest* request,
133 const HttpRequestHeaders& headers); 144 const HttpRequestHeaders& headers);
134 145
135 // Called for HTTP requests when the headers have been received. 146 // Called for HTTP requests when the headers have been received.
136 // |original_response_headers| contains the headers as received over the 147 // |original_response_headers| contains the headers as received over the
137 // network, these must not be modified. |override_response_headers| can be set 148 // network, these must not be modified. |override_response_headers| can be set
138 // to new values, that should be considered as overriding 149 // to new values, that should be considered as overriding
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 245
235 // Called before a SocketStream tries to connect. 246 // Called before a SocketStream tries to connect.
236 // See OnBeforeURLRequest for return value description. Returns OK by default. 247 // See OnBeforeURLRequest for return value description. Returns OK by default.
237 virtual int OnBeforeSocketStreamConnect( 248 virtual int OnBeforeSocketStreamConnect(
238 SocketStream* socket, const CompletionCallback& callback); 249 SocketStream* socket, const CompletionCallback& callback);
239 }; 250 };
240 251
241 } // namespace net 252 } // namespace net
242 253
243 #endif // NET_BASE_NETWORK_DELEGATE_H_ 254 #endif // NET_BASE_NETWORK_DELEGATE_H_
OLDNEW
« no previous file with comments | « components/data_reduction_proxy/common/data_reduction_proxy_headers_unittest.cc ('k') | net/base/network_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698