| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 gdata::GDataSystemService* system_service = | 115 gdata::GDataSystemService* system_service = |
| 116 gdata::GDataSystemServiceFactory::GetForProfile( | 116 gdata::GDataSystemServiceFactory::GetForProfile( |
| 117 profile ? profile : ProfileManager::GetDefaultProfile()); | 117 profile ? profile : ProfileManager::GetDefaultProfile()); |
| 118 DCHECK(system_service); | 118 DCHECK(system_service); |
| 119 | 119 |
| 120 // If we're trying to download a file into gdata, save path in external | 120 // If we're trying to download a file into gdata, save path in external |
| 121 // data. | 121 // data. |
| 122 SetDownloadParams(gdata_path, download); | 122 SetDownloadParams(gdata_path, download); |
| 123 | 123 |
| 124 const FilePath gdata_tmp_download_dir = | 124 const FilePath gdata_tmp_download_dir = |
| 125 system_service->file_system()->GetCacheDirectoryPath( | 125 system_service->cache()->GetCacheDirectoryPath( |
| 126 gdata::GDataCache::CACHE_TYPE_TMP_DOWNLOADS); | 126 gdata::GDataCache::CACHE_TYPE_TMP_DOWNLOADS); |
| 127 | 127 |
| 128 // Swap the gdata path with a local path. Local path must be created | 128 // Swap the gdata path with a local path. Local path must be created |
| 129 // on the FILE thread. | 129 // on the FILE thread. |
| 130 FilePath* gdata_tmp_download_path(new FilePath()); | 130 FilePath* gdata_tmp_download_path(new FilePath()); |
| 131 BrowserThread::GetBlockingPool()->PostTaskAndReply(FROM_HERE, | 131 BrowserThread::GetBlockingPool()->PostTaskAndReply(FROM_HERE, |
| 132 base::Bind(&gdata::GDataDownloadObserver::GetGDataTempDownloadPath, | 132 base::Bind(&gdata::GDataDownloadObserver::GetGDataTempDownloadPath, |
| 133 gdata_tmp_download_dir, | 133 gdata_tmp_download_dir, |
| 134 gdata_tmp_download_path), | 134 gdata_tmp_download_path), |
| 135 base::Bind(&SubstituteGDataDownloadPathHelper, | 135 base::Bind(&SubstituteGDataDownloadPathHelper, |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 return; | 386 return; |
| 387 } | 387 } |
| 388 DVLOG(1) << "Completing upload for download ID " << download_id; | 388 DVLOG(1) << "Completing upload for download ID " << download_id; |
| 389 DownloadItem* download_item = iter->second; | 389 DownloadItem* download_item = iter->second; |
| 390 UploadingExternalData* upload_data = GetUploadingExternalData(download_item); | 390 UploadingExternalData* upload_data = GetUploadingExternalData(download_item); |
| 391 DCHECK(upload_data); | 391 DCHECK(upload_data); |
| 392 upload_data->CompleteDownload(); | 392 upload_data->CompleteDownload(); |
| 393 } | 393 } |
| 394 | 394 |
| 395 } // namespace gdata | 395 } // namespace gdata |
| OLD | NEW |