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/url_request/url_request_ftp_job.h" | 5 #include "net/url_request/url_request_ftp_job.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "net/base/auth.h" | 10 #include "net/base/auth.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 226 |
227 // Once the auth is cancelled, we proceed with the request as though | 227 // Once the auth is cancelled, we proceed with the request as though |
228 // there were no auth. Schedule this for later so that we don't cause | 228 // there were no auth. Schedule this for later so that we don't cause |
229 // any recursing into the caller as a result of this call. | 229 // any recursing into the caller as a result of this call. |
230 MessageLoop::current()->PostTask( | 230 MessageLoop::current()->PostTask( |
231 FROM_HERE, | 231 FROM_HERE, |
232 base::Bind(&URLRequestFtpJob::OnStartCompleted, | 232 base::Bind(&URLRequestFtpJob::OnStartCompleted, |
233 weak_factory_.GetWeakPtr(), OK)); | 233 weak_factory_.GetWeakPtr(), OK)); |
234 } | 234 } |
235 | 235 |
236 uint64 URLRequestFtpJob::GetUploadProgress() const { | 236 UploadProgress URLRequestFtpJob::GetUploadProgress() const { |
237 return 0; | 237 return UploadProgress(); |
238 } | 238 } |
239 | 239 |
240 bool URLRequestFtpJob::ReadRawData(IOBuffer* buf, | 240 bool URLRequestFtpJob::ReadRawData(IOBuffer* buf, |
241 int buf_size, | 241 int buf_size, |
242 int *bytes_read) { | 242 int *bytes_read) { |
243 DCHECK_NE(buf_size, 0); | 243 DCHECK_NE(buf_size, 0); |
244 DCHECK(bytes_read); | 244 DCHECK(bytes_read); |
245 DCHECK(!read_in_progress_); | 245 DCHECK(!read_in_progress_); |
246 | 246 |
247 int rv = transaction_->Read(buf, buf_size, | 247 int rv = transaction_->Read(buf, buf_size, |
248 base::Bind(&URLRequestFtpJob::OnReadCompleted, | 248 base::Bind(&URLRequestFtpJob::OnReadCompleted, |
249 base::Unretained(this))); | 249 base::Unretained(this))); |
250 if (rv >= 0) { | 250 if (rv >= 0) { |
251 *bytes_read = rv; | 251 *bytes_read = rv; |
252 return true; | 252 return true; |
253 } | 253 } |
254 | 254 |
255 if (rv == ERR_IO_PENDING) { | 255 if (rv == ERR_IO_PENDING) { |
256 read_in_progress_ = true; | 256 read_in_progress_ = true; |
257 SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0)); | 257 SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0)); |
258 } else { | 258 } else { |
259 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); | 259 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); |
260 } | 260 } |
261 return false; | 261 return false; |
262 } | 262 } |
263 | 263 |
264 } // namespace net | 264 } // namespace net |
OLD | NEW |