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