| 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_download_observer.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" | 8 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" |
| 9 #include "chrome/browser/chromeos/gdata/gdata_upload_file_info.h" | 9 #include "chrome/browser/chromeos/gdata/gdata_upload_file_info.h" |
| 10 #include "chrome/browser/chromeos/gdata/gdata_uploader.h" | 10 #include "chrome/browser/chromeos/gdata/gdata_uploader.h" |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 upload_file_info->all_bytes_present = download->AllDataSaved(); | 369 upload_file_info->all_bytes_present = download->AllDataSaved(); |
| 370 | 370 |
| 371 upload_file_info->completion_callback = | 371 upload_file_info->completion_callback = |
| 372 base::Bind(&GDataDownloadObserver::OnUploadComplete, | 372 base::Bind(&GDataDownloadObserver::OnUploadComplete, |
| 373 weak_ptr_factory_.GetWeakPtr(), | 373 weak_ptr_factory_.GetWeakPtr(), |
| 374 download->GetId()); | 374 download->GetId()); |
| 375 | 375 |
| 376 return upload_file_info.Pass(); | 376 return upload_file_info.Pass(); |
| 377 } | 377 } |
| 378 | 378 |
| 379 void GDataDownloadObserver::OnUploadComplete(int32 download_id, | 379 void GDataDownloadObserver::OnUploadComplete( |
| 380 base::PlatformFileError error, | 380 int32 download_id, |
| 381 UploadFileInfo* upload_file_info) { | 381 base::PlatformFileError error, |
| 382 scoped_ptr<UploadFileInfo> upload_file_info) { |
| 382 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 383 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 383 DownloadMap::iterator iter = pending_downloads_.find(download_id); | 384 DownloadMap::iterator iter = pending_downloads_.find(download_id); |
| 384 if (iter == pending_downloads_.end()) { | 385 if (iter == pending_downloads_.end()) { |
| 385 DVLOG(1) << "Pending download not found" << download_id; | 386 DVLOG(1) << "Pending download not found" << download_id; |
| 386 return; | 387 return; |
| 387 } | 388 } |
| 388 DVLOG(1) << "Completing upload for download ID " << download_id; | 389 DVLOG(1) << "Completing upload for download ID " << download_id; |
| 389 DownloadItem* download_item = iter->second; | 390 DownloadItem* download_item = iter->second; |
| 390 UploadingExternalData* upload_data = GetUploadingExternalData(download_item); | 391 UploadingExternalData* upload_data = GetUploadingExternalData(download_item); |
| 391 DCHECK(upload_data); | 392 DCHECK(upload_data); |
| 392 upload_data->CompleteDownload(); | 393 upload_data->CompleteDownload(); |
| 393 } | 394 } |
| 394 | 395 |
| 395 } // namespace gdata | 396 } // namespace gdata |
| OLD | NEW |