Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_LAYERED_NETWORK_DELEGATE_H_ | 5 #ifndef NET_BASE_LAYERED_NETWORK_DELEGATE_H_ |
| 6 #define NET_BASE_LAYERED_NETWORK_DELEGATE_H_ | 6 #define NET_BASE_LAYERED_NETWORK_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "net/base/completion_callback.h" | 12 #include "net/base/completion_callback.h" |
| 13 #include "net/base/network_delegate.h" | 13 #include "net/base/network_delegate.h" |
| 14 #include "net/cookies/canonical_cookie.h" | 14 #include "net/cookies/canonical_cookie.h" |
| 15 | 15 |
| 16 class GURL; | 16 class GURL; |
| 17 | 17 |
| 18 namespace base { | 18 namespace base { |
| 19 class FilePath; | 19 class FilePath; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace net { | 22 namespace net { |
| 23 | 23 |
| 24 class CookieOptions; | 24 class CookieOptions; |
| 25 class HttpRequestHeaders; | 25 class HttpRequestHeaders; |
| 26 class HttpResponseHeaders; | 26 class HttpResponseHeaders; |
| 27 class ProxyInfo; | 27 class ProxyInfo; |
| 28 class ProxyServer; | 28 class ProxyServer; |
| 29 class ProxyService; | 29 class ProxyService; |
|
bengr
2016/02/08 23:23:30
You don't need ProxyServer or ProxyService anymore
RyanSturm
2016/02/09 00:46:03
Done.
| |
| 30 class URLRequest; | 30 class URLRequest; |
| 31 | 31 |
| 32 // WrappingNetworkDelegate takes a |network_delegate| and extends it. When | 32 // WrappingNetworkDelegate takes a |network_delegate| and extends it. When |
| 33 // On*() is called, the On*Internal() method of this is first called and then | 33 // On*() is called, the On*Internal() method of this is first called and then |
| 34 // the On*() of |network_delegate| is called. On*Internal() methods have no | 34 // the On*() of |network_delegate| is called. On*Internal() methods have no |
| 35 // return values, and cannot prevent calling into the nested network delegate. | 35 // return values, and cannot prevent calling into the nested network delegate. |
| 36 class NET_EXPORT LayeredNetworkDelegate : public NetworkDelegate { | 36 class NET_EXPORT LayeredNetworkDelegate : public NetworkDelegate { |
| 37 public: | 37 public: |
| 38 explicit LayeredNetworkDelegate( | 38 explicit LayeredNetworkDelegate( |
| 39 scoped_ptr<NetworkDelegate> nested_network_delegate); | 39 scoped_ptr<NetworkDelegate> nested_network_delegate); |
| 40 ~LayeredNetworkDelegate() override; | 40 ~LayeredNetworkDelegate() override; |
| 41 | 41 |
| 42 // NetworkDelegate implementation: | 42 // NetworkDelegate implementation: |
| 43 int OnBeforeURLRequest(URLRequest* request, | 43 int OnBeforeURLRequest(URLRequest* request, |
| 44 const CompletionCallback& callback, | 44 const CompletionCallback& callback, |
| 45 GURL* new_url) final; | 45 GURL* new_url) final; |
| 46 void OnResolveProxy(const GURL& url, | |
| 47 int load_flags, | |
| 48 const ProxyService& proxy_service, | |
| 49 ProxyInfo* result) final; | |
| 50 void OnProxyFallback(const ProxyServer& bad_proxy, int net_error) final; | |
| 51 int OnBeforeSendHeaders(URLRequest* request, | 46 int OnBeforeSendHeaders(URLRequest* request, |
| 52 const CompletionCallback& callback, | 47 const CompletionCallback& callback, |
| 53 HttpRequestHeaders* headers) final; | 48 HttpRequestHeaders* headers) final; |
| 54 void OnBeforeSendProxyHeaders(URLRequest* request, | 49 void OnBeforeSendProxyHeaders(URLRequest* request, |
| 55 const ProxyInfo& proxy_info, | 50 const ProxyInfo& proxy_info, |
| 56 HttpRequestHeaders* headers) final; | 51 HttpRequestHeaders* headers) final; |
| 57 void OnSendHeaders(URLRequest* request, | 52 void OnSendHeaders(URLRequest* request, |
| 58 const HttpRequestHeaders& headers) final; | 53 const HttpRequestHeaders& headers) final; |
| 59 int OnHeadersReceived( | 54 int OnHeadersReceived( |
| 60 URLRequest* request, | 55 URLRequest* request, |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 88 bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( | 83 bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( |
| 89 const URLRequest& request, | 84 const URLRequest& request, |
| 90 const GURL& target_url, | 85 const GURL& target_url, |
| 91 const GURL& referrer_url) const final; | 86 const GURL& referrer_url) const final; |
| 92 | 87 |
| 93 protected: | 88 protected: |
| 94 virtual void OnBeforeURLRequestInternal(URLRequest* request, | 89 virtual void OnBeforeURLRequestInternal(URLRequest* request, |
| 95 const CompletionCallback& callback, | 90 const CompletionCallback& callback, |
| 96 GURL* new_url); | 91 GURL* new_url); |
| 97 | 92 |
| 98 virtual void OnResolveProxyInternal(const GURL& url, | |
| 99 int load_flags, | |
| 100 const ProxyService& proxy_service, | |
| 101 ProxyInfo* result); | |
| 102 | |
| 103 virtual void OnProxyFallbackInternal(const ProxyServer& bad_proxy, | |
| 104 int net_error); | |
| 105 | |
| 106 virtual void OnBeforeSendHeadersInternal(URLRequest* request, | 93 virtual void OnBeforeSendHeadersInternal(URLRequest* request, |
| 107 const CompletionCallback& callback, | 94 const CompletionCallback& callback, |
| 108 HttpRequestHeaders* headers); | 95 HttpRequestHeaders* headers); |
| 109 | 96 |
| 110 virtual void OnBeforeSendProxyHeadersInternal(URLRequest* request, | 97 virtual void OnBeforeSendProxyHeadersInternal(URLRequest* request, |
| 111 const ProxyInfo& proxy_info, | 98 const ProxyInfo& proxy_info, |
| 112 HttpRequestHeaders* headers); | 99 HttpRequestHeaders* headers); |
| 113 | 100 |
| 114 virtual void OnSendHeadersInternal(URLRequest* request, | 101 virtual void OnSendHeadersInternal(URLRequest* request, |
| 115 const HttpRequestHeaders& headers); | 102 const HttpRequestHeaders& headers); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 166 const GURL& target_url, | 153 const GURL& target_url, |
| 167 const GURL& referrer_url) const; | 154 const GURL& referrer_url) const; |
| 168 | 155 |
| 169 private: | 156 private: |
| 170 scoped_ptr<NetworkDelegate> nested_network_delegate_; | 157 scoped_ptr<NetworkDelegate> nested_network_delegate_; |
| 171 }; | 158 }; |
| 172 | 159 |
| 173 } // namespace net | 160 } // namespace net |
| 174 | 161 |
| 175 #endif // NET_BASE_LAYERED_NETWORK_DELEGATE_H_ | 162 #endif // NET_BASE_LAYERED_NETWORK_DELEGATE_H_ |
| OLD | NEW |