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

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

Issue 449973002: Use data reduction proxy when managed proxy config returns direct (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no-uma-in-proxy-service
Patch Set: Remove copy from ProxyConfig access Created 6 years, 4 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 19 matching lines...) Expand all
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 ProxyInfo;
39 class ProxyServer; 39 class ProxyServer;
40 class ProxyService;
40 class SocketStream; 41 class SocketStream;
41 class URLRequest; 42 class URLRequest;
42 43
43 class NET_EXPORT NetworkDelegate : public base::NonThreadSafe { 44 class NET_EXPORT NetworkDelegate : public base::NonThreadSafe {
44 public: 45 public:
45 // AuthRequiredResponse indicates how a NetworkDelegate handles an 46 // AuthRequiredResponse indicates how a NetworkDelegate handles an
46 // OnAuthRequired call. It's placed in this file to prevent url_request.h 47 // OnAuthRequired call. It's placed in this file to prevent url_request.h
47 // from having to include network_delegate.h. 48 // from having to include network_delegate.h.
48 enum AuthRequiredResponse { 49 enum AuthRequiredResponse {
49 AUTH_REQUIRED_RESPONSE_NO_ACTION, 50 AUTH_REQUIRED_RESPONSE_NO_ACTION,
50 AUTH_REQUIRED_RESPONSE_SET_AUTH, 51 AUTH_REQUIRED_RESPONSE_SET_AUTH,
51 AUTH_REQUIRED_RESPONSE_CANCEL_AUTH, 52 AUTH_REQUIRED_RESPONSE_CANCEL_AUTH,
52 AUTH_REQUIRED_RESPONSE_IO_PENDING, 53 AUTH_REQUIRED_RESPONSE_IO_PENDING,
53 }; 54 };
54 typedef base::Callback<void(AuthRequiredResponse)> AuthCallback; 55 typedef base::Callback<void(AuthRequiredResponse)> AuthCallback;
55 56
56 virtual ~NetworkDelegate() {} 57 virtual ~NetworkDelegate() {}
57 58
58 // Notification interface called by the network stack. Note that these 59 // Notification interface called by the network stack. Note that these
59 // functions mostly forward to the private virtuals. They also add some sanity 60 // functions mostly forward to the private virtuals. They also add some sanity
60 // checking on parameters. See the corresponding virtuals for explanations of 61 // checking on parameters. See the corresponding virtuals for explanations of
61 // the methods and their arguments. 62 // the methods and their arguments.
62 int NotifyBeforeURLRequest(URLRequest* request, 63 int NotifyBeforeURLRequest(URLRequest* request,
63 const CompletionCallback& callback, 64 const CompletionCallback& callback,
64 GURL* new_url); 65 GURL* new_url);
65 void NotifyResolveProxy(const GURL& url, int load_flags, 66 void NotifyResolveProxy(const GURL& url,
67 int load_flags,
68 const ProxyService& proxy_service,
66 ProxyInfo* result); 69 ProxyInfo* result);
67 void NotifyProxyFallback(const ProxyServer& bad_proxy, 70 void NotifyProxyFallback(const ProxyServer& bad_proxy,
68 int net_error, 71 int net_error,
69 bool did_fallback); 72 bool did_fallback);
70 int NotifyBeforeSendHeaders(URLRequest* request, 73 int NotifyBeforeSendHeaders(URLRequest* request,
71 const CompletionCallback& callback, 74 const CompletionCallback& callback,
72 HttpRequestHeaders* headers); 75 HttpRequestHeaders* headers);
73 void NotifyBeforeSendProxyHeaders(URLRequest* request, 76 void NotifyBeforeSendProxyHeaders(URLRequest* request,
74 const ProxyInfo& proxy_info, 77 const ProxyInfo& proxy_info,
75 HttpRequestHeaders* headers); 78 HttpRequestHeaders* headers);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // The default implementation returns OK (continue with request). 128 // The default implementation returns OK (continue with request).
126 virtual int OnBeforeURLRequest(URLRequest* request, 129 virtual int OnBeforeURLRequest(URLRequest* request,
127 const CompletionCallback& callback, 130 const CompletionCallback& callback,
128 GURL* new_url); 131 GURL* new_url);
129 132
130 // Called as the proxy is being resolved for |url|. Allows the delegate to 133 // Called as the proxy is being resolved for |url|. Allows the delegate to
131 // override the proxy resolution decision made by ProxyService. The delegate 134 // override the proxy resolution decision made by ProxyService. The delegate
132 // may override the decision by modifying the ProxyInfo |result|. 135 // may override the decision by modifying the ProxyInfo |result|.
133 virtual void OnResolveProxy(const GURL& url, 136 virtual void OnResolveProxy(const GURL& url,
134 int load_flags, 137 int load_flags,
138 const ProxyService& proxy_service,
135 ProxyInfo* result); 139 ProxyInfo* result);
136 140
137 // Called when use of |bad_proxy| fails due to |net_error|. |did_fallback| is 141 // Called when use of |bad_proxy| fails due to |net_error|. |did_fallback| is
138 // true if the proxy service was able to fallback to another proxy 142 // true if the proxy service was able to fallback to another proxy
139 // configuration. 143 // configuration.
140 virtual void OnProxyFallback(const ProxyServer& bad_proxy, 144 virtual void OnProxyFallback(const ProxyServer& bad_proxy,
141 int net_error, 145 int net_error,
142 bool did_fallback); 146 bool did_fallback);
143 147
144 // Called right before the HTTP headers are sent. Allows the delegate to 148 // Called right before the HTTP headers are sent. Allows the delegate to
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 269
266 // Called before a SocketStream tries to connect. 270 // Called before a SocketStream tries to connect.
267 // See OnBeforeURLRequest for return value description. Returns OK by default. 271 // See OnBeforeURLRequest for return value description. Returns OK by default.
268 virtual int OnBeforeSocketStreamConnect( 272 virtual int OnBeforeSocketStreamConnect(
269 SocketStream* socket, const CompletionCallback& callback); 273 SocketStream* socket, const CompletionCallback& callback);
270 }; 274 };
271 275
272 } // namespace net 276 } // namespace net
273 277
274 #endif // NET_BASE_NETWORK_DELEGATE_H_ 278 #endif // NET_BASE_NETWORK_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698