| 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/drive/drive_uploader.h" | 5 #include "chrome/browser/drive/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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 const UploadCompletionCallback& callback, | 52 const UploadCompletionCallback& callback, |
| 53 const ProgressCallback& progress_callback) | 53 const ProgressCallback& progress_callback) |
| 54 : file_path(local_path), | 54 : file_path(local_path), |
| 55 content_type(content_type), | 55 content_type(content_type), |
| 56 completion_callback(callback), | 56 completion_callback(callback), |
| 57 progress_callback(progress_callback), | 57 progress_callback(progress_callback), |
| 58 content_length(0), | 58 content_length(0), |
| 59 next_start_position(-1), | 59 next_start_position(-1), |
| 60 power_save_blocker(content::PowerSaveBlocker::Create( | 60 power_save_blocker(content::PowerSaveBlocker::Create( |
| 61 content::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, | 61 content::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, |
| 62 content::PowerSaveBlocker::kReasonOther, |
| 62 "Upload in progress")), | 63 "Upload in progress")), |
| 63 cancelled(false), | 64 cancelled(false), |
| 64 weak_ptr_factory_(this) { | 65 weak_ptr_factory_(this) {} |
| 65 } | |
| 66 | 66 |
| 67 ~UploadFileInfo() { | 67 ~UploadFileInfo() { |
| 68 } | 68 } |
| 69 | 69 |
| 70 // Useful for printf debugging. | 70 // Useful for printf debugging. |
| 71 std::string DebugString() const { | 71 std::string DebugString() const { |
| 72 return "file_path=[" + file_path.AsUTF8Unsafe() + | 72 return "file_path=[" + file_path.AsUTF8Unsafe() + |
| 73 "], content_type=[" + content_type + | 73 "], content_type=[" + content_type + |
| 74 "], content_length=[" + base::UintToString(content_length) + | 74 "], content_length=[" + base::UintToString(content_length) + |
| 75 "]"; | 75 "]"; |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 } else { | 453 } else { |
| 454 DVLOG(1) << "Upload failed " << upload_file_info->DebugString(); | 454 DVLOG(1) << "Upload failed " << upload_file_info->DebugString(); |
| 455 if (error == HTTP_PRECONDITION) | 455 if (error == HTTP_PRECONDITION) |
| 456 error = HTTP_CONFLICT; // ETag mismatch. | 456 error = HTTP_CONFLICT; // ETag mismatch. |
| 457 upload_file_info->completion_callback.Run( | 457 upload_file_info->completion_callback.Run( |
| 458 error, upload_file_info->upload_location, scoped_ptr<FileResource>()); | 458 error, upload_file_info->upload_location, scoped_ptr<FileResource>()); |
| 459 } | 459 } |
| 460 } | 460 } |
| 461 | 461 |
| 462 } // namespace drive | 462 } // namespace drive |
| OLD | NEW |