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/chromeos/gdata/gdata_uploader.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_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 25 matching lines...) Expand all Loading... | |
36 ALLOW_THIS_IN_INITIALIZER_LIST(uploader_factory_(this)) { | 36 ALLOW_THIS_IN_INITIALIZER_LIST(uploader_factory_(this)) { |
37 } | 37 } |
38 | 38 |
39 GDataUploader::~GDataUploader() { | 39 GDataUploader::~GDataUploader() { |
40 } | 40 } |
41 | 41 |
42 void GDataUploader::UploadFile(UploadFileInfo* upload_file_info) { | 42 void GDataUploader::UploadFile(UploadFileInfo* upload_file_info) { |
43 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 43 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
44 DCHECK(upload_file_info); | 44 DCHECK(upload_file_info); |
45 DCHECK_EQ(upload_file_info->upload_id, -1); | 45 DCHECK_EQ(upload_file_info->upload_id, -1); |
46 DCHECK(!upload_file_info->file_path.empty()); | |
47 DCHECK_NE(upload_file_info->file_size, 0); | |
48 DCHECK(!upload_file_info->gdata_path.empty()); | |
49 DCHECK(!upload_file_info->title.empty()); | |
50 DCHECK(!upload_file_info->content_type.empty()); | |
asanka
2012/03/26 16:50:14
For regular downloads, it is possible that we don'
achuithb
2012/03/26 19:51:39
We do need to handle this, but I pulled this file
| |
46 | 51 |
47 upload_file_info->upload_id = next_upload_id_++; | 52 upload_file_info->upload_id = next_upload_id_++; |
48 // Add upload_file_info to our internal map and take ownership. | 53 // Add upload_file_info to our internal map and take ownership. |
49 pending_uploads_[upload_file_info->upload_id] = upload_file_info; | 54 pending_uploads_[upload_file_info->upload_id] = upload_file_info; |
50 DVLOG(1) << "Uploading file: " << upload_file_info->DebugString(); | 55 DVLOG(1) << "Uploading file: " << upload_file_info->DebugString(); |
51 | 56 |
52 // Create a FileStream to make sure the file can be opened successfully. | 57 // Create a FileStream to make sure the file can be opened successfully. |
53 upload_file_info->file_stream = new net::FileStream(NULL); | 58 upload_file_info->file_stream = new net::FileStream(NULL); |
54 | 59 |
55 // Create buffer to hold upload data. | 60 // Create buffer to hold upload data. |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
349 void GDataUploader::UploadComplete(UploadFileInfo* upload_file_info) { | 354 void GDataUploader::UploadComplete(UploadFileInfo* upload_file_info) { |
350 DVLOG(1) << "UploadComplete " << upload_file_info->file_path.value(); | 355 DVLOG(1) << "UploadComplete " << upload_file_info->file_path.value(); |
351 file_system_->AddUploadedFile(upload_file_info->gdata_path.DirName(), | 356 file_system_->AddUploadedFile(upload_file_info->gdata_path.DirName(), |
352 upload_file_info->entry.get(), | 357 upload_file_info->entry.get(), |
353 upload_file_info->file_path, | 358 upload_file_info->file_path, |
354 GDataFileSystemInterface::FILE_OPERATION_MOVE); | 359 GDataFileSystemInterface::FILE_OPERATION_MOVE); |
355 RemovePendingUpload(upload_file_info); | 360 RemovePendingUpload(upload_file_info); |
356 } | 361 } |
357 | 362 |
358 } // namespace gdata | 363 } // namespace gdata |
OLD | NEW |