OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "net/base/network_delegate.h" | 5 #include "net/base/network_delegate.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "net/base/load_flags.h" | 8 #include "net/base/load_flags.h" |
| 9 #include "net/base/net_errors.h" |
9 #include "net/url_request/url_request.h" | 10 #include "net/url_request/url_request.h" |
10 | 11 |
11 namespace net { | 12 namespace net { |
12 | 13 |
13 int NetworkDelegate::NotifyBeforeURLRequest( | 14 int NetworkDelegate::NotifyBeforeURLRequest( |
14 URLRequest* request, const CompletionCallback& callback, | 15 URLRequest* request, const CompletionCallback& callback, |
15 GURL* new_url) { | 16 GURL* new_url) { |
16 DCHECK(CalledOnValidThread()); | 17 DCHECK(CalledOnValidThread()); |
17 DCHECK(request); | 18 DCHECK(request); |
18 DCHECK(!callback.is_null()); | 19 DCHECK(!callback.is_null()); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 return OnCanThrottleRequest(request); | 119 return OnCanThrottleRequest(request); |
119 } | 120 } |
120 | 121 |
121 bool NetworkDelegate::CanEnablePrivacyMode( | 122 bool NetworkDelegate::CanEnablePrivacyMode( |
122 const GURL& url, | 123 const GURL& url, |
123 const GURL& first_party_for_cookies) const { | 124 const GURL& first_party_for_cookies) const { |
124 DCHECK(CalledOnValidThread()); | 125 DCHECK(CalledOnValidThread()); |
125 return OnCanEnablePrivacyMode(url, first_party_for_cookies); | 126 return OnCanEnablePrivacyMode(url, first_party_for_cookies); |
126 } | 127 } |
127 | 128 |
| 129 int NetworkDelegate::OnBeforeURLRequest(URLRequest* request, |
| 130 const CompletionCallback& callback, |
| 131 GURL* new_url) { |
| 132 return net::OK; |
| 133 } |
| 134 |
| 135 int NetworkDelegate::OnBeforeSendHeaders(URLRequest* request, |
| 136 const CompletionCallback& callback, |
| 137 HttpRequestHeaders* headers) { |
| 138 return net::OK; |
| 139 } |
| 140 |
| 141 void NetworkDelegate::OnSendHeaders(URLRequest* request, |
| 142 const HttpRequestHeaders& headers) { |
| 143 } |
| 144 |
| 145 int NetworkDelegate::OnHeadersReceived( |
| 146 URLRequest* request, |
| 147 const CompletionCallback& callback, |
| 148 const HttpResponseHeaders* original_response_headers, |
| 149 scoped_refptr<HttpResponseHeaders>* override_response_headers) { |
| 150 return net::OK; |
| 151 } |
| 152 |
| 153 void NetworkDelegate::OnBeforeRedirect(URLRequest* request, |
| 154 const GURL& new_location) { |
| 155 } |
| 156 |
| 157 void NetworkDelegate::OnResponseStarted(URLRequest* request) { |
| 158 } |
| 159 |
| 160 void NetworkDelegate::OnRawBytesRead(const URLRequest& request, |
| 161 int bytes_read) { |
| 162 } |
| 163 |
| 164 void NetworkDelegate::OnCompleted(URLRequest* request, bool started) { |
| 165 } |
| 166 |
| 167 void NetworkDelegate::OnURLRequestDestroyed(URLRequest* request) { |
| 168 } |
| 169 |
| 170 void NetworkDelegate::OnPACScriptError(int line_number, |
| 171 const base::string16& error) { |
| 172 } |
| 173 |
| 174 NetworkDelegate::AuthRequiredResponse NetworkDelegate::OnAuthRequired( |
| 175 URLRequest* request, |
| 176 const AuthChallengeInfo& auth_info, |
| 177 const AuthCallback& callback, |
| 178 AuthCredentials* credentials) { |
| 179 return AUTH_REQUIRED_RESPONSE_NO_ACTION; |
| 180 } |
| 181 |
| 182 bool NetworkDelegate::OnCanGetCookies(const URLRequest& request, |
| 183 const CookieList& cookie_list) { |
| 184 return true; |
| 185 } |
| 186 |
| 187 bool NetworkDelegate::OnCanSetCookie(const URLRequest& request, |
| 188 const std::string& cookie_line, |
| 189 CookieOptions* options) { |
| 190 return true; |
| 191 } |
| 192 |
| 193 bool NetworkDelegate::OnCanAccessFile(const URLRequest& request, |
| 194 const base::FilePath& path) const { |
| 195 return false; |
| 196 } |
| 197 |
| 198 bool NetworkDelegate::OnCanThrottleRequest(const URLRequest& request) const { |
| 199 return false; |
| 200 } |
| 201 |
128 bool NetworkDelegate::OnCanEnablePrivacyMode( | 202 bool NetworkDelegate::OnCanEnablePrivacyMode( |
129 const GURL& url, | 203 const GURL& url, |
130 const GURL& first_party_for_cookies) const { | 204 const GURL& first_party_for_cookies) const { |
131 // Default implementation disables privacy mode. | |
132 return false; | 205 return false; |
133 } | 206 } |
134 | 207 |
| 208 int NetworkDelegate::OnBeforeSocketStreamConnect( |
| 209 SocketStream* socket, |
| 210 const CompletionCallback& callback) { |
| 211 return net::OK; |
| 212 } |
| 213 |
| 214 void NetworkDelegate::OnRequestWaitStateChange(const URLRequest& request, |
| 215 RequestWaitState state) { |
| 216 } |
| 217 |
135 int NetworkDelegate::NotifyBeforeSocketStreamConnect( | 218 int NetworkDelegate::NotifyBeforeSocketStreamConnect( |
136 SocketStream* socket, | 219 SocketStream* socket, |
137 const CompletionCallback& callback) { | 220 const CompletionCallback& callback) { |
138 DCHECK(CalledOnValidThread()); | 221 DCHECK(CalledOnValidThread()); |
139 DCHECK(socket); | 222 DCHECK(socket); |
140 DCHECK(!callback.is_null()); | 223 DCHECK(!callback.is_null()); |
141 return OnBeforeSocketStreamConnect(socket, callback); | 224 return OnBeforeSocketStreamConnect(socket, callback); |
142 } | 225 } |
143 | 226 |
144 void NetworkDelegate::NotifyRequestWaitStateChange(const URLRequest& request, | 227 void NetworkDelegate::NotifyRequestWaitStateChange(const URLRequest& request, |
145 RequestWaitState state) { | 228 RequestWaitState state) { |
146 DCHECK(CalledOnValidThread()); | 229 DCHECK(CalledOnValidThread()); |
147 OnRequestWaitStateChange(request, state); | 230 OnRequestWaitStateChange(request, state); |
148 } | 231 } |
149 | 232 |
150 } // namespace net | 233 } // namespace net |
OLD | NEW |