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 "google_apis/drive/base_requests.h" | 5 #include "google_apis/drive/base_requests.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 make_scoped_refptr(buffer), callback)); | 305 make_scoped_refptr(buffer), callback)); |
306 if (result != net::ERR_IO_PENDING) | 306 if (result != net::ERR_IO_PENDING) |
307 DidWrite(buffer, net::CompletionCallback(), result); | 307 DidWrite(buffer, net::CompletionCallback(), result); |
308 return result; | 308 return result; |
309 } | 309 } |
310 | 310 |
311 data_.append(buffer->data(), num_bytes); | 311 data_.append(buffer->data(), num_bytes); |
312 return num_bytes; | 312 return num_bytes; |
313 } | 313 } |
314 | 314 |
315 int ResponseWriter::Finish(const net::CompletionCallback& callback) { | 315 int ResponseWriter::Finish(int net_error, |
| 316 const net::CompletionCallback& callback) { |
316 if (file_writer_) | 317 if (file_writer_) |
317 return file_writer_->Finish(callback); | 318 return file_writer_->Finish(net_error, callback); |
318 | 319 |
319 return net::OK; | 320 return net::OK; |
320 } | 321 } |
321 | 322 |
322 void ResponseWriter::DidWrite(scoped_refptr<net::IOBuffer> buffer, | 323 void ResponseWriter::DidWrite(scoped_refptr<net::IOBuffer> buffer, |
323 const net::CompletionCallback& callback, | 324 const net::CompletionCallback& callback, |
324 int result) { | 325 int result) { |
325 if (result > 0) { | 326 if (result > 0) { |
326 // Even if file_writer_ is used, append the data to |data_|, so that it can | 327 // Even if file_writer_ is used, append the data to |data_|, so that it can |
327 // be used to get error information in case of server side errors. | 328 // be used to get error information in case of server side errors. |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1003 download_action_callback_.Run(code, temp_file); | 1004 download_action_callback_.Run(code, temp_file); |
1004 OnProcessURLFetchResultsComplete(); | 1005 OnProcessURLFetchResultsComplete(); |
1005 } | 1006 } |
1006 | 1007 |
1007 void DownloadFileRequestBase::RunCallbackOnPrematureFailure( | 1008 void DownloadFileRequestBase::RunCallbackOnPrematureFailure( |
1008 DriveApiErrorCode code) { | 1009 DriveApiErrorCode code) { |
1009 download_action_callback_.Run(code, base::FilePath()); | 1010 download_action_callback_.Run(code, base::FilePath()); |
1010 } | 1011 } |
1011 | 1012 |
1012 } // namespace google_apis | 1013 } // namespace google_apis |
OLD | NEW |