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