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 | |
14 LayeredNetworkDelegate::~LayeredNetworkDelegate() { | |
15 } | |
16 | |
17 int LayeredNetworkDelegate::OnBeforeURLRequest( | |
18 URLRequest* request, | |
19 const CompletionCallback& callback, | |
20 GURL* new_url) { | |
21 OnBeforeURLRequestInternal(request, callback, new_url); | |
22 return nested_network_delegate_->NotifyBeforeURLRequest(request, callback, | |
23 new_url); | |
24 } | |
25 | |
26 void LayeredNetworkDelegate::OnBeforeURLRequestInternal( | |
27 URLRequest* request, | |
28 const CompletionCallback& callback, | |
29 GURL* new_url) { | |
30 } | |
31 | |
32 void LayeredNetworkDelegate::OnResolveProxy(const GURL& url, | |
33 int load_flags, | |
34 const ProxyService& proxy_service, | |
35 ProxyInfo* result) { | |
36 OnResolveProxyInternal(url, load_flags, proxy_service, result); | |
37 nested_network_delegate_->NotifyResolveProxy(url, load_flags, proxy_service, | |
38 result); | |
39 } | |
40 | |
41 void LayeredNetworkDelegate::OnResolveProxyInternal( | |
42 const GURL& url, | |
43 int load_flags, | |
44 const ProxyService& proxy_service, | |
45 ProxyInfo* result) { | |
46 } | |
47 | |
48 void LayeredNetworkDelegate::OnProxyFallback(const ProxyServer& bad_proxy, | |
49 int net_error) { | |
50 OnProxyFallbackInternal(bad_proxy, net_error); | |
51 nested_network_delegate_->NotifyProxyFallback(bad_proxy, net_error); | |
52 } | |
53 | |
54 void LayeredNetworkDelegate::OnProxyFallbackInternal( | |
55 const ProxyServer& bad_proxy, | |
56 int net_error) { | |
57 } | |
58 | |
59 int LayeredNetworkDelegate::OnBeforeSendHeaders( | |
60 URLRequest* request, | |
61 const CompletionCallback& callback, | |
62 HttpRequestHeaders* headers) { | |
63 OnBeforeSendHeadersInternal(request, callback, headers); | |
64 return nested_network_delegate_->NotifyBeforeSendHeaders(request, callback, | |
65 headers); | |
66 } | |
67 | |
68 void LayeredNetworkDelegate::OnBeforeSendHeadersInternal( | |
69 URLRequest* request, | |
70 const CompletionCallback& callback, | |
71 HttpRequestHeaders* headers) { | |
72 } | |
73 | |
74 void LayeredNetworkDelegate::OnBeforeSendProxyHeaders( | |
75 URLRequest* request, | |
76 const ProxyInfo& proxy_info, | |
77 HttpRequestHeaders* headers) { | |
78 OnBeforeSendProxyHeadersInternal(request, proxy_info, headers); | |
79 nested_network_delegate_->NotifyBeforeSendProxyHeaders(request, proxy_info, | |
80 headers); | |
81 } | |
82 | |
83 void LayeredNetworkDelegate::OnBeforeSendProxyHeadersInternal( | |
84 URLRequest* request, | |
85 const ProxyInfo& proxy_info, | |
86 HttpRequestHeaders* headers) { | |
87 } | |
88 | |
89 void LayeredNetworkDelegate::OnSendHeaders(URLRequest* request, | |
90 const HttpRequestHeaders& headers) { | |
91 OnSendHeadersInternal(request, headers); | |
92 nested_network_delegate_->NotifySendHeaders(request, headers); | |
93 } | |
94 | |
95 void LayeredNetworkDelegate::OnSendHeadersInternal( | |
96 URLRequest* request, | |
97 const HttpRequestHeaders& headers) { | |
98 } | |
99 | |
100 int LayeredNetworkDelegate::OnHeadersReceived( | |
101 URLRequest* request, | |
102 const CompletionCallback& callback, | |
103 const HttpResponseHeaders* original_response_headers, | |
104 scoped_refptr<HttpResponseHeaders>* override_response_headers, | |
105 GURL* allowed_unsafe_redirect_url) { | |
106 OnHeadersReceivedInternal(request, callback, original_response_headers, | |
107 override_response_headers, | |
108 allowed_unsafe_redirect_url); | |
109 return nested_network_delegate_->NotifyHeadersReceived( | |
110 request, callback, original_response_headers, override_response_headers, | |
111 allowed_unsafe_redirect_url); | |
112 } | |
113 | |
114 void LayeredNetworkDelegate::OnHeadersReceivedInternal( | |
115 URLRequest* request, | |
116 const CompletionCallback& callback, | |
117 const HttpResponseHeaders* original_response_headers, | |
118 scoped_refptr<HttpResponseHeaders>* override_response_headers, | |
119 GURL* allowed_unsafe_redirect_url) { | |
120 } | |
121 | |
122 void LayeredNetworkDelegate::OnBeforeRedirect(URLRequest* request, | |
123 const GURL& new_location) { | |
124 OnBeforeRedirectInternal(request, new_location); | |
125 nested_network_delegate_->NotifyBeforeRedirect(request, new_location); | |
126 } | |
127 | |
128 void LayeredNetworkDelegate::OnBeforeRedirectInternal( | |
129 URLRequest* request, | |
130 const GURL& new_location) { | |
131 } | |
132 | |
133 void LayeredNetworkDelegate::OnResponseStarted(URLRequest* request) { | |
134 OnResponseStartedInternal(request); | |
135 nested_network_delegate_->NotifyResponseStarted(request); | |
136 } | |
137 | |
138 void LayeredNetworkDelegate::OnResponseStartedInternal(URLRequest* request) { | |
139 } | |
140 | |
141 void LayeredNetworkDelegate::OnRawBytesRead(const URLRequest& request, | |
142 int bytes_read) { | |
143 OnRawBytesReadInternal(request, bytes_read); | |
144 nested_network_delegate_->NotifyRawBytesRead(request, bytes_read); | |
145 } | |
146 | |
147 void LayeredNetworkDelegate::OnRawBytesReadInternal(const URLRequest& request, | |
148 int bytes_read) { | |
149 } | |
150 | |
151 void LayeredNetworkDelegate::OnCompleted(URLRequest* request, bool started) { | |
152 OnCompletedInternal(request, started); | |
153 nested_network_delegate_->NotifyCompleted(request, started); | |
154 } | |
155 | |
156 void LayeredNetworkDelegate::OnCompletedInternal(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(request, auth_info, | |
187 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(request, cookie_line, options); | |
213 } | |
214 | |
215 void LayeredNetworkDelegate::OnCanSetCookieInternal( | |
216 const URLRequest& request, | |
217 const std::string& cookie_line, | |
218 CookieOptions* options) { | |
219 } | |
220 | |
221 bool LayeredNetworkDelegate::OnCanAccessFile(const URLRequest& request, | |
222 const base::FilePath& path) const { | |
223 OnCanAccessFileInternal(request, path); | |
224 return nested_network_delegate_->CanAccessFile(request, path); | |
225 } | |
226 | |
227 void LayeredNetworkDelegate::OnCanAccessFileInternal( | |
228 const URLRequest& request, | |
229 const base::FilePath& path) const { | |
230 } | |
231 | |
232 bool LayeredNetworkDelegate::OnCanThrottleRequest( | |
233 const URLRequest& request) const { | |
234 OnCanThrottleRequestInternal(request); | |
235 return nested_network_delegate_->CanThrottleRequest(request); | |
236 } | |
237 | |
238 void LayeredNetworkDelegate::OnCanThrottleRequestInternal( | |
239 const URLRequest& request) const { | |
240 } | |
241 | |
242 bool LayeredNetworkDelegate::OnCanEnablePrivacyMode( | |
243 const GURL& url, | |
244 const GURL& first_party_for_cookies) const { | |
245 OnCanEnablePrivacyModeInternal(url, first_party_for_cookies); | |
246 return nested_network_delegate_->CanEnablePrivacyMode( | |
247 url, first_party_for_cookies); | |
248 } | |
249 | |
250 void LayeredNetworkDelegate::OnCanEnablePrivacyModeInternal( | |
251 const GURL& url, | |
252 const GURL& first_party_for_cookies) const { | |
253 } | |
254 | |
255 bool LayeredNetworkDelegate:: | |
256 OnCancelURLRequestWithPolicyViolatingReferrerHeader( | |
257 const URLRequest& request, | |
258 const GURL& target_url, | |
259 const GURL& referrer_url) const { | |
260 OnCancelURLRequestWithPolicyViolatingReferrerHeaderInternal( | |
261 request, target_url, referrer_url); | |
262 return nested_network_delegate_ | |
263 ->CancelURLRequestWithPolicyViolatingReferrerHeader(request, target_url, | |
264 referrer_url); | |
265 } | |
266 | |
267 void LayeredNetworkDelegate:: | |
268 OnCancelURLRequestWithPolicyViolatingReferrerHeaderInternal( | |
269 const URLRequest& request, | |
270 const GURL& target_url, | |
271 const GURL& referrer_url) const { | |
272 } | |
273 | |
274 } // namespace net | |
OLD | NEW |