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 "components/drive/drive_uploader.h" | 5 #include "components/drive/drive_uploader.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 | 193 |
194 return StartUploadFile( | 194 return StartUploadFile( |
195 std::unique_ptr<UploadFileInfo>(new UploadFileInfo( | 195 std::unique_ptr<UploadFileInfo>(new UploadFileInfo( |
196 local_file_path, content_type, callback, progress_callback)), | 196 local_file_path, content_type, callback, progress_callback)), |
197 base::Bind(&DriveUploader::CallUploadServiceAPINewFile, | 197 base::Bind(&DriveUploader::CallUploadServiceAPINewFile, |
198 weak_ptr_factory_.GetWeakPtr(), parent_resource_id, title, | 198 weak_ptr_factory_.GetWeakPtr(), parent_resource_id, title, |
199 options, current_batch_request_)); | 199 options, current_batch_request_)); |
200 } | 200 } |
201 | 201 |
202 void DriveUploader::StartBatchProcessing() { | 202 void DriveUploader::StartBatchProcessing() { |
203 DCHECK(current_batch_request_ == nullptr); | 203 DCHECK(!current_batch_request_); |
204 current_batch_request_ = | 204 current_batch_request_ = |
205 new RefCountedBatchRequest(drive_service_->StartBatchRequest()); | 205 new RefCountedBatchRequest(drive_service_->StartBatchRequest()); |
206 } | 206 } |
207 | 207 |
208 void DriveUploader::StopBatchProcessing() { | 208 void DriveUploader::StopBatchProcessing() { |
209 current_batch_request_ = nullptr; | 209 current_batch_request_ = nullptr; |
210 } | 210 } |
211 | 211 |
212 CancelCallback DriveUploader::UploadExistingFile( | 212 CancelCallback DriveUploader::UploadExistingFile( |
213 const std::string& resource_id, | 213 const std::string& resource_id, |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 DVLOG(1) << "Upload failed " << upload_file_info->DebugString(); | 528 DVLOG(1) << "Upload failed " << upload_file_info->DebugString(); |
529 if (error == HTTP_PRECONDITION) | 529 if (error == HTTP_PRECONDITION) |
530 error = HTTP_CONFLICT; // ETag mismatch. | 530 error = HTTP_CONFLICT; // ETag mismatch. |
531 upload_file_info->completion_callback.Run(error, | 531 upload_file_info->completion_callback.Run(error, |
532 upload_file_info->upload_location, | 532 upload_file_info->upload_location, |
533 std::unique_ptr<FileResource>()); | 533 std::unique_ptr<FileResource>()); |
534 } | 534 } |
535 } | 535 } |
536 | 536 |
537 } // namespace drive | 537 } // namespace drive |
OLD | NEW |