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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 CancelCallback DriveUploader::StartUploadFile( | 207 CancelCallback DriveUploader::StartUploadFile( |
208 scoped_ptr<UploadFileInfo> upload_file_info, | 208 scoped_ptr<UploadFileInfo> upload_file_info, |
209 const StartInitiateUploadCallback& start_initiate_upload_callback) { | 209 const StartInitiateUploadCallback& start_initiate_upload_callback) { |
210 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 210 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
211 DVLOG(1) << "Uploading file: " << upload_file_info->DebugString(); | 211 DVLOG(1) << "Uploading file: " << upload_file_info->DebugString(); |
212 | 212 |
213 UploadFileInfo* info_ptr = upload_file_info.get(); | 213 UploadFileInfo* info_ptr = upload_file_info.get(); |
214 base::PostTaskAndReplyWithResult( | 214 base::PostTaskAndReplyWithResult( |
215 blocking_task_runner_.get(), | 215 blocking_task_runner_.get(), |
216 FROM_HERE, | 216 FROM_HERE, |
217 base::Bind(&file_util::GetFileSize, | 217 base::Bind(&base::GetFileSize, |
218 info_ptr->file_path, | 218 info_ptr->file_path, |
219 &info_ptr->content_length), | 219 &info_ptr->content_length), |
220 base::Bind(&DriveUploader::StartUploadFileAfterGetFileSize, | 220 base::Bind(&DriveUploader::StartUploadFileAfterGetFileSize, |
221 weak_ptr_factory_.GetWeakPtr(), | 221 weak_ptr_factory_.GetWeakPtr(), |
222 base::Passed(&upload_file_info), | 222 base::Passed(&upload_file_info), |
223 start_initiate_upload_callback)); | 223 start_initiate_upload_callback)); |
224 return info_ptr->GetCancelCallback(); | 224 return info_ptr->GetCancelCallback(); |
225 } | 225 } |
226 | 226 |
227 void DriveUploader::StartUploadFileAfterGetFileSize( | 227 void DriveUploader::StartUploadFileAfterGetFileSize( |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 // Discard the upload location because no request could succeed with it. | 421 // Discard the upload location because no request could succeed with it. |
422 // Maybe it's obsolete. | 422 // Maybe it's obsolete. |
423 upload_file_info->upload_location = GURL(); | 423 upload_file_info->upload_location = GURL(); |
424 } | 424 } |
425 | 425 |
426 upload_file_info->completion_callback.Run( | 426 upload_file_info->completion_callback.Run( |
427 error, upload_file_info->upload_location, scoped_ptr<ResourceEntry>()); | 427 error, upload_file_info->upload_location, scoped_ptr<ResourceEntry>()); |
428 } | 428 } |
429 | 429 |
430 } // namespace drive | 430 } // namespace drive |
OLD | NEW |