| 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 "chrome/browser/google_apis/drive_uploader.h" | 5 #include "chrome/browser/google_apis/drive_uploader.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 info_ptr->upload_mode, | 353 info_ptr->upload_mode, |
| 354 info_ptr->drive_path, | 354 info_ptr->drive_path, |
| 355 info_ptr->upload_location, | 355 info_ptr->upload_location, |
| 356 start_position, | 356 start_position, |
| 357 end_position, | 357 end_position, |
| 358 info_ptr->content_length, | 358 info_ptr->content_length, |
| 359 info_ptr->content_type, | 359 info_ptr->content_type, |
| 360 info_ptr->buf, | 360 info_ptr->buf, |
| 361 base::Bind(&DriveUploader::OnUploadRangeResponseReceived, | 361 base::Bind(&DriveUploader::OnUploadRangeResponseReceived, |
| 362 weak_ptr_factory_.GetWeakPtr(), | 362 weak_ptr_factory_.GetWeakPtr(), |
| 363 base::Passed(&upload_file_info))); | 363 base::Passed(&upload_file_info)), |
| 364 ProgressCallback()); |
| 364 } | 365 } |
| 365 | 366 |
| 366 void DriveUploader::OnUploadRangeResponseReceived( | 367 void DriveUploader::OnUploadRangeResponseReceived( |
| 367 scoped_ptr<UploadFileInfo> upload_file_info, | 368 scoped_ptr<UploadFileInfo> upload_file_info, |
| 368 const UploadRangeResponse& response, | 369 const UploadRangeResponse& response, |
| 369 scoped_ptr<ResourceEntry> entry) { | 370 scoped_ptr<ResourceEntry> entry) { |
| 370 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 371 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 371 | 372 |
| 372 const UploadMode upload_mode = upload_file_info->upload_mode; | 373 const UploadMode upload_mode = upload_file_info->upload_mode; |
| 373 if ((upload_mode == UPLOAD_NEW_FILE && response.code == HTTP_CREATED) || | 374 if ((upload_mode == UPLOAD_NEW_FILE && response.code == HTTP_CREATED) || |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 | 423 |
| 423 LOG(ERROR) << "Upload failed " << upload_file_info->DebugString(); | 424 LOG(ERROR) << "Upload failed " << upload_file_info->DebugString(); |
| 424 | 425 |
| 425 upload_file_info->completion_callback.Run(error, | 426 upload_file_info->completion_callback.Run(error, |
| 426 upload_file_info->drive_path, | 427 upload_file_info->drive_path, |
| 427 upload_file_info->file_path, | 428 upload_file_info->file_path, |
| 428 scoped_ptr<ResourceEntry>()); | 429 scoped_ptr<ResourceEntry>()); |
| 429 } | 430 } |
| 430 | 431 |
| 431 } // namespace google_apis | 432 } // namespace google_apis |
| OLD | NEW |