OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "net/base/layered_network_delegate.h" |
| 6 |
| 7 namespace net { |
| 8 |
| 9 LayeredNetworkDelegate::LayeredNetworkDelegate( |
| 10 scoped_ptr<NetworkDelegate> nested_network_delegate) |
| 11 : nested_network_delegate_(nested_network_delegate.Pass()) {} |
| 12 |
| 13 LayeredNetworkDelegate::~LayeredNetworkDelegate() {} |
| 14 |
| 15 int LayeredNetworkDelegate::OnBeforeURLRequest( |
| 16 URLRequest* request, |
| 17 const CompletionCallback& callback, |
| 18 GURL* new_url) { |
| 19 OnBeforeURLRequestInternal(request, callback, new_url); |
| 20 return nested_network_delegate_->NotifyBeforeURLRequest( |
| 21 request, callback, new_url); |
| 22 } |
| 23 |
| 24 void LayeredNetworkDelegate::OnBeforeURLRequestInternal( |
| 25 URLRequest* request, |
| 26 const CompletionCallback& callback, |
| 27 GURL* new_url) { |
| 28 } |
| 29 |
| 30 void LayeredNetworkDelegate::OnResolveProxy( |
| 31 const GURL& url, |
| 32 int load_flags, |
| 33 const ProxyService& proxy_service, |
| 34 ProxyInfo* result) { |
| 35 OnResolveProxyInternal(url, load_flags, proxy_service, result); |
| 36 nested_network_delegate_->NotifyResolveProxy( |
| 37 url, load_flags, proxy_service, result); |
| 38 } |
| 39 |
| 40 void LayeredNetworkDelegate::OnResolveProxyInternal( |
| 41 const GURL& url, |
| 42 int load_flags, |
| 43 const ProxyService& proxy_service, |
| 44 ProxyInfo* result) { |
| 45 } |
| 46 |
| 47 void LayeredNetworkDelegate::OnProxyFallback(const ProxyServer& bad_proxy, |
| 48 int net_error) { |
| 49 OnProxyFallbackInternal(bad_proxy, net_error); |
| 50 nested_network_delegate_->NotifyProxyFallback(bad_proxy, net_error); |
| 51 } |
| 52 |
| 53 void LayeredNetworkDelegate::OnProxyFallbackInternal( |
| 54 const ProxyServer& bad_proxy, |
| 55 int net_error) { |
| 56 } |
| 57 |
| 58 int LayeredNetworkDelegate::OnBeforeSendHeaders( |
| 59 URLRequest* request, |
| 60 const CompletionCallback& callback, |
| 61 HttpRequestHeaders* headers) { |
| 62 OnBeforeSendHeadersInternal(request, callback, headers); |
| 63 return nested_network_delegate_->NotifyBeforeSendHeaders( |
| 64 request, callback, headers); |
| 65 } |
| 66 |
| 67 void LayeredNetworkDelegate::OnBeforeSendHeadersInternal( |
| 68 URLRequest* request, |
| 69 const CompletionCallback& callback, |
| 70 HttpRequestHeaders* headers) { |
| 71 } |
| 72 |
| 73 void LayeredNetworkDelegate::OnBeforeSendProxyHeaders( |
| 74 URLRequest* request, |
| 75 const ProxyInfo& proxy_info, |
| 76 HttpRequestHeaders* headers) { |
| 77 OnBeforeSendProxyHeadersInternal(request, proxy_info, headers); |
| 78 nested_network_delegate_->NotifyBeforeSendProxyHeaders( |
| 79 request, proxy_info, headers); |
| 80 } |
| 81 |
| 82 void LayeredNetworkDelegate::OnBeforeSendProxyHeadersInternal( |
| 83 URLRequest* request, |
| 84 const ProxyInfo& proxy_info, |
| 85 HttpRequestHeaders* headers) { |
| 86 } |
| 87 |
| 88 void LayeredNetworkDelegate::OnSendHeaders(URLRequest* request, |
| 89 const HttpRequestHeaders& headers) { |
| 90 OnSendHeadersInternal(request, headers); |
| 91 nested_network_delegate_->NotifySendHeaders(request, headers); |
| 92 } |
| 93 |
| 94 void LayeredNetworkDelegate::OnSendHeadersInternal( |
| 95 URLRequest* request, |
| 96 const HttpRequestHeaders& headers) { |
| 97 } |
| 98 |
| 99 int LayeredNetworkDelegate::OnHeadersReceived( |
| 100 URLRequest* request, |
| 101 const CompletionCallback& callback, |
| 102 const HttpResponseHeaders* original_response_headers, |
| 103 scoped_refptr<HttpResponseHeaders>* override_response_headers, |
| 104 GURL* allowed_unsafe_redirect_url) { |
| 105 OnHeadersReceivedInternal( |
| 106 request, callback, original_response_headers, |
| 107 override_response_headers, allowed_unsafe_redirect_url); |
| 108 return nested_network_delegate_->NotifyHeadersReceived( |
| 109 request, callback, original_response_headers, |
| 110 override_response_headers, allowed_unsafe_redirect_url); |
| 111 } |
| 112 |
| 113 void LayeredNetworkDelegate::OnHeadersReceivedInternal( |
| 114 URLRequest* request, |
| 115 const CompletionCallback& callback, |
| 116 const HttpResponseHeaders* original_response_headers, |
| 117 scoped_refptr<HttpResponseHeaders>* override_response_headers, |
| 118 GURL* allowed_unsafe_redirect_url) { |
| 119 } |
| 120 |
| 121 void LayeredNetworkDelegate::OnBeforeRedirect(URLRequest* request, |
| 122 const GURL& new_location) { |
| 123 OnBeforeRedirectInternal(request, new_location); |
| 124 nested_network_delegate_->NotifyBeforeRedirect(request, new_location); |
| 125 } |
| 126 |
| 127 void LayeredNetworkDelegate::OnBeforeRedirectInternal( |
| 128 URLRequest* request, |
| 129 const GURL& new_location) { |
| 130 } |
| 131 |
| 132 void LayeredNetworkDelegate::OnResponseStarted(URLRequest* request) { |
| 133 OnResponseStartedInternal(request); |
| 134 nested_network_delegate_->NotifyResponseStarted(request); |
| 135 } |
| 136 |
| 137 void LayeredNetworkDelegate::OnResponseStartedInternal(URLRequest* request) { |
| 138 } |
| 139 |
| 140 void LayeredNetworkDelegate::OnRawBytesRead(const URLRequest& request, |
| 141 int bytes_read) { |
| 142 OnRawBytesReadInternal(request, bytes_read); |
| 143 nested_network_delegate_->NotifyRawBytesRead(request, bytes_read); |
| 144 } |
| 145 |
| 146 void LayeredNetworkDelegate::OnRawBytesReadInternal(const URLRequest& request, |
| 147 int bytes_read) { |
| 148 } |
| 149 |
| 150 void LayeredNetworkDelegate::OnCompleted(URLRequest* request, bool started) { |
| 151 OnCompletedInternal(request, started); |
| 152 nested_network_delegate_->NotifyCompleted(request, started); |
| 153 } |
| 154 |
| 155 void LayeredNetworkDelegate::OnCompletedInternal( |
| 156 URLRequest* request, |
| 157 bool started) { |
| 158 } |
| 159 |
| 160 void LayeredNetworkDelegate::OnURLRequestDestroyed(URLRequest* request) { |
| 161 OnURLRequestDestroyedInternal(request); |
| 162 nested_network_delegate_->NotifyURLRequestDestroyed(request); |
| 163 } |
| 164 |
| 165 void LayeredNetworkDelegate::OnURLRequestDestroyedInternal( |
| 166 URLRequest* request) { |
| 167 } |
| 168 |
| 169 void LayeredNetworkDelegate::OnPACScriptError(int line_number, |
| 170 const base::string16& error) { |
| 171 OnPACScriptErrorInternal(line_number, error); |
| 172 nested_network_delegate_->NotifyPACScriptError(line_number, error); |
| 173 } |
| 174 |
| 175 void LayeredNetworkDelegate::OnPACScriptErrorInternal( |
| 176 int line_number, |
| 177 const base::string16& error) { |
| 178 } |
| 179 |
| 180 NetworkDelegate::AuthRequiredResponse LayeredNetworkDelegate::OnAuthRequired( |
| 181 URLRequest* request, |
| 182 const AuthChallengeInfo& auth_info, |
| 183 const AuthCallback& callback, |
| 184 AuthCredentials* credentials) { |
| 185 OnAuthRequiredInternal(request, auth_info, callback, credentials); |
| 186 return nested_network_delegate_->NotifyAuthRequired( |
| 187 request, auth_info, callback, credentials); |
| 188 } |
| 189 |
| 190 void LayeredNetworkDelegate::OnAuthRequiredInternal( |
| 191 URLRequest* request, |
| 192 const AuthChallengeInfo& auth_info, |
| 193 const AuthCallback& callback, |
| 194 AuthCredentials* credentials) { |
| 195 } |
| 196 |
| 197 bool LayeredNetworkDelegate::OnCanGetCookies(const URLRequest& request, |
| 198 const CookieList& cookie_list) { |
| 199 OnCanGetCookiesInternal(request, cookie_list); |
| 200 return nested_network_delegate_->CanGetCookies(request, cookie_list); |
| 201 } |
| 202 |
| 203 void LayeredNetworkDelegate::OnCanGetCookiesInternal( |
| 204 const URLRequest& request, |
| 205 const CookieList& cookie_list) { |
| 206 } |
| 207 |
| 208 bool LayeredNetworkDelegate::OnCanSetCookie(const URLRequest& request, |
| 209 const std::string& cookie_line, |
| 210 CookieOptions* options) { |
| 211 OnCanSetCookieInternal(request, cookie_line, options); |
| 212 return nested_network_delegate_->CanSetCookie( |
| 213 request, cookie_line, options); |
| 214 } |
| 215 |
| 216 void LayeredNetworkDelegate::OnCanSetCookieInternal( |
| 217 const URLRequest& request, |
| 218 const std::string& cookie_line, |
| 219 CookieOptions* options) { |
| 220 } |
| 221 |
| 222 bool LayeredNetworkDelegate::OnCanAccessFile( |
| 223 const URLRequest& request, |
| 224 const base::FilePath& path) const { |
| 225 OnCanAccessFileInternal(request, path); |
| 226 return nested_network_delegate_->CanAccessFile(request, path); |
| 227 } |
| 228 |
| 229 void LayeredNetworkDelegate::OnCanAccessFileInternal( |
| 230 const URLRequest& request, |
| 231 const base::FilePath& path) const { |
| 232 } |
| 233 |
| 234 bool LayeredNetworkDelegate::OnCanThrottleRequest( |
| 235 const URLRequest& request) const { |
| 236 OnCanThrottleRequestInternal(request); |
| 237 return nested_network_delegate_->CanThrottleRequest(request); |
| 238 } |
| 239 |
| 240 void LayeredNetworkDelegate::OnCanThrottleRequestInternal( |
| 241 const URLRequest& request) const { |
| 242 } |
| 243 |
| 244 bool LayeredNetworkDelegate::OnCanEnablePrivacyMode( |
| 245 const GURL& url, |
| 246 const GURL& first_party_for_cookies) const { |
| 247 OnCanEnablePrivacyModeInternal(url, first_party_for_cookies); |
| 248 return nested_network_delegate_->CanEnablePrivacyMode( |
| 249 url, first_party_for_cookies); |
| 250 } |
| 251 |
| 252 void LayeredNetworkDelegate::OnCanEnablePrivacyModeInternal( |
| 253 const GURL& url, |
| 254 const GURL& first_party_for_cookies) const { |
| 255 } |
| 256 |
| 257 bool |
| 258 LayeredNetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader( |
| 259 const URLRequest& request, |
| 260 const GURL& target_url, |
| 261 const GURL& referrer_url) const { |
| 262 OnCancelURLRequestWithPolicyViolatingReferrerHeaderInternal( |
| 263 request, target_url, referrer_url); |
| 264 return nested_network_delegate_-> |
| 265 CancelURLRequestWithPolicyViolatingReferrerHeader( |
| 266 request, target_url, referrer_url); |
| 267 } |
| 268 |
| 269 void LayeredNetworkDelegate:: |
| 270 OnCancelURLRequestWithPolicyViolatingReferrerHeaderInternal( |
| 271 const URLRequest& request, |
| 272 const GURL& target_url, |
| 273 const GURL& referrer_url) const { |
| 274 } |
| 275 |
| 276 } // namespace net |
OLD | NEW |