| 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; |
| 29 class ProxyService; |
| 28 class URLRequest; | 30 class URLRequest; |
| 29 | 31 |
| 30 // WrappingNetworkDelegate takes a |network_delegate| and extends it. When | 32 // WrappingNetworkDelegate takes a |network_delegate| and extends it. When |
| 31 // 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 |
| 32 // 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 |
| 33 // return values, and cannot prevent calling into the nested network delegate. | 35 // return values, and cannot prevent calling into the nested network delegate. |
| 34 class NET_EXPORT LayeredNetworkDelegate : public NetworkDelegate { | 36 class NET_EXPORT LayeredNetworkDelegate : public NetworkDelegate { |
| 35 public: | 37 public: |
| 36 explicit LayeredNetworkDelegate( | 38 explicit LayeredNetworkDelegate( |
| 37 scoped_ptr<NetworkDelegate> nested_network_delegate); | 39 scoped_ptr<NetworkDelegate> nested_network_delegate); |
| 38 ~LayeredNetworkDelegate() override; | 40 ~LayeredNetworkDelegate() override; |
| 39 | 41 |
| 40 // NetworkDelegate implementation: | 42 // NetworkDelegate implementation: |
| 41 int OnBeforeURLRequest(URLRequest* request, | 43 int OnBeforeURLRequest(URLRequest* request, |
| 42 const CompletionCallback& callback, | 44 const CompletionCallback& callback, |
| 43 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; |
| 44 int OnBeforeSendHeaders(URLRequest* request, | 51 int OnBeforeSendHeaders(URLRequest* request, |
| 45 const CompletionCallback& callback, | 52 const CompletionCallback& callback, |
| 46 HttpRequestHeaders* headers) final; | 53 HttpRequestHeaders* headers) final; |
| 47 void OnBeforeSendProxyHeaders(URLRequest* request, | 54 void OnBeforeSendProxyHeaders(URLRequest* request, |
| 48 const ProxyInfo& proxy_info, | 55 const ProxyInfo& proxy_info, |
| 49 HttpRequestHeaders* headers) final; | 56 HttpRequestHeaders* headers) final; |
| 50 void OnSendHeaders(URLRequest* request, | 57 void OnSendHeaders(URLRequest* request, |
| 51 const HttpRequestHeaders& headers) final; | 58 const HttpRequestHeaders& headers) final; |
| 52 int OnHeadersReceived( | 59 int OnHeadersReceived( |
| 53 URLRequest* request, | 60 URLRequest* request, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 81 bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( | 88 bool OnCancelURLRequestWithPolicyViolatingReferrerHeader( |
| 82 const URLRequest& request, | 89 const URLRequest& request, |
| 83 const GURL& target_url, | 90 const GURL& target_url, |
| 84 const GURL& referrer_url) const final; | 91 const GURL& referrer_url) const final; |
| 85 | 92 |
| 86 protected: | 93 protected: |
| 87 virtual void OnBeforeURLRequestInternal(URLRequest* request, | 94 virtual void OnBeforeURLRequestInternal(URLRequest* request, |
| 88 const CompletionCallback& callback, | 95 const CompletionCallback& callback, |
| 89 GURL* new_url); | 96 GURL* new_url); |
| 90 | 97 |
| 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 |
| 91 virtual void OnBeforeSendHeadersInternal(URLRequest* request, | 106 virtual void OnBeforeSendHeadersInternal(URLRequest* request, |
| 92 const CompletionCallback& callback, | 107 const CompletionCallback& callback, |
| 93 HttpRequestHeaders* headers); | 108 HttpRequestHeaders* headers); |
| 94 | 109 |
| 95 virtual void OnBeforeSendProxyHeadersInternal(URLRequest* request, | 110 virtual void OnBeforeSendProxyHeadersInternal(URLRequest* request, |
| 96 const ProxyInfo& proxy_info, | 111 const ProxyInfo& proxy_info, |
| 97 HttpRequestHeaders* headers); | 112 HttpRequestHeaders* headers); |
| 98 | 113 |
| 99 virtual void OnSendHeadersInternal(URLRequest* request, | 114 virtual void OnSendHeadersInternal(URLRequest* request, |
| 100 const HttpRequestHeaders& headers); | 115 const HttpRequestHeaders& headers); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 const GURL& target_url, | 166 const GURL& target_url, |
| 152 const GURL& referrer_url) const; | 167 const GURL& referrer_url) const; |
| 153 | 168 |
| 154 private: | 169 private: |
| 155 scoped_ptr<NetworkDelegate> nested_network_delegate_; | 170 scoped_ptr<NetworkDelegate> nested_network_delegate_; |
| 156 }; | 171 }; |
| 157 | 172 |
| 158 } // namespace net | 173 } // namespace net |
| 159 | 174 |
| 160 #endif // NET_BASE_LAYERED_NETWORK_DELEGATE_H_ | 175 #endif // NET_BASE_LAYERED_NETWORK_DELEGATE_H_ |
| OLD | NEW |