| 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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 return file_writer_->Initialize(callback); | 286 return file_writer_->Initialize(callback); |
| 287 | 287 |
| 288 data_.clear(); | 288 data_.clear(); |
| 289 return net::OK; | 289 return net::OK; |
| 290 } | 290 } |
| 291 | 291 |
| 292 int ResponseWriter::Write(net::IOBuffer* buffer, | 292 int ResponseWriter::Write(net::IOBuffer* buffer, |
| 293 int num_bytes, | 293 int num_bytes, |
| 294 const net::CompletionCallback& callback) { | 294 const net::CompletionCallback& callback) { |
| 295 if (!get_content_callback_.is_null()) { | 295 if (!get_content_callback_.is_null()) { |
| 296 get_content_callback_.Run(HTTP_SUCCESS, base::WrapUnique(new std::string( | 296 get_content_callback_.Run( |
| 297 buffer->data(), num_bytes))); | 297 HTTP_SUCCESS, base::MakeUnique<std::string>(buffer->data(), num_bytes)); |
| 298 } | 298 } |
| 299 | 299 |
| 300 if (file_writer_) { | 300 if (file_writer_) { |
| 301 const int result = file_writer_->Write( | 301 const int result = file_writer_->Write( |
| 302 buffer, num_bytes, | 302 buffer, num_bytes, |
| 303 base::Bind(&ResponseWriter::DidWrite, | 303 base::Bind(&ResponseWriter::DidWrite, |
| 304 weak_ptr_factory_.GetWeakPtr(), | 304 weak_ptr_factory_.GetWeakPtr(), |
| 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); |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 download_action_callback_.Run(code, temp_file); | 1002 download_action_callback_.Run(code, temp_file); |
| 1003 OnProcessURLFetchResultsComplete(); | 1003 OnProcessURLFetchResultsComplete(); |
| 1004 } | 1004 } |
| 1005 | 1005 |
| 1006 void DownloadFileRequestBase::RunCallbackOnPrematureFailure( | 1006 void DownloadFileRequestBase::RunCallbackOnPrematureFailure( |
| 1007 DriveApiErrorCode code) { | 1007 DriveApiErrorCode code) { |
| 1008 download_action_callback_.Run(code, base::FilePath()); | 1008 download_action_callback_.Run(code, base::FilePath()); |
| 1009 } | 1009 } |
| 1010 | 1010 |
| 1011 } // namespace google_apis | 1011 } // namespace google_apis |
| OLD | NEW |