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