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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 void Cancel() { | 117 void Cancel() { |
118 cancelled = true; | 118 cancelled = true; |
119 if (!cancel_callback.is_null()) | 119 if (!cancel_callback.is_null()) |
120 cancel_callback.Run(); | 120 cancel_callback.Run(); |
121 } | 121 } |
122 | 122 |
123 base::WeakPtrFactory<UploadFileInfo> weak_ptr_factory_; | 123 base::WeakPtrFactory<UploadFileInfo> weak_ptr_factory_; |
124 DISALLOW_COPY_AND_ASSIGN(UploadFileInfo); | 124 DISALLOW_COPY_AND_ASSIGN(UploadFileInfo); |
125 }; | 125 }; |
126 | 126 |
127 DriveUploader::DriveUploader(DriveServiceInterface* drive_service, | 127 DriveUploader::DriveUploader( |
128 base::TaskRunner* blocking_task_runner) | 128 DriveServiceInterface* drive_service, |
| 129 const scoped_refptr<base::TaskRunner>& blocking_task_runner) |
129 : drive_service_(drive_service), | 130 : drive_service_(drive_service), |
130 blocking_task_runner_(blocking_task_runner), | 131 blocking_task_runner_(blocking_task_runner), |
131 weak_ptr_factory_(this) { | 132 weak_ptr_factory_(this) { |
132 } | 133 } |
133 | 134 |
134 DriveUploader::~DriveUploader() {} | 135 DriveUploader::~DriveUploader() {} |
135 | 136 |
136 CancelCallback DriveUploader::UploadNewFile( | 137 CancelCallback DriveUploader::UploadNewFile( |
137 const std::string& parent_resource_id, | 138 const std::string& parent_resource_id, |
138 const base::FilePath& local_file_path, | 139 const base::FilePath& local_file_path, |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 // Discard the upload location because no request could succeed with it. | 426 // Discard the upload location because no request could succeed with it. |
426 // Maybe it's obsolete. | 427 // Maybe it's obsolete. |
427 upload_file_info->upload_location = GURL(); | 428 upload_file_info->upload_location = GURL(); |
428 } | 429 } |
429 | 430 |
430 upload_file_info->completion_callback.Run( | 431 upload_file_info->completion_callback.Run( |
431 error, upload_file_info->upload_location, scoped_ptr<FileResource>()); | 432 error, upload_file_info->upload_location, scoped_ptr<FileResource>()); |
432 } | 433 } |
433 | 434 |
434 } // namespace drive | 435 } // namespace drive |
OLD | NEW |