| 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/download/download_file_picker_chromeos.h" | 5 #include "chrome/browser/download/download_file_picker_chromeos.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/i18n/file_util_icu.h" | 9 #include "base/i18n/file_util_icu.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 // If we're trying to download a file into gdata, save path in external | 62 // If we're trying to download a file into gdata, save path in external |
| 63 // data. | 63 // data. |
| 64 content::DownloadItem* download = | 64 content::DownloadItem* download = |
| 65 download_manager_->GetActiveDownloadItem(download_id_); | 65 download_manager_->GetActiveDownloadItem(download_id_); |
| 66 if (download) { | 66 if (download) { |
| 67 gdata::GDataDownloadObserver::SetGDataPath(download, path); | 67 gdata::GDataDownloadObserver::SetGDataPath(download, path); |
| 68 download->SetDisplayName(path.BaseName()); | 68 download->SetDisplayName(path.BaseName()); |
| 69 download->SetIsTemporary(true); | 69 download->SetIsTemporary(true); |
| 70 | 70 |
| 71 const FilePath gdata_tmp_download_dir = | 71 const FilePath gdata_tmp_download_dir = |
| 72 system_service->file_system()->GetGDataTempDownloadFolderPath(); | 72 system_service->file_system()->GetCacheDirectoryPath( |
| 73 gdata::GDataRootDirectory::CACHE_TYPE_TMP_DOWNLOADS); |
| 73 | 74 |
| 74 // Swap the gdata path with a local path. Local path must be created | 75 // Swap the gdata path with a local path. Local path must be created |
| 75 // on the IO thread pool. | 76 // on the IO thread pool. |
| 76 FilePath* gdata_tmp_download_path(new FilePath()); | 77 FilePath* gdata_tmp_download_path(new FilePath()); |
| 77 BrowserThread::GetBlockingPool()->PostTaskAndReply(FROM_HERE, | 78 BrowserThread::GetBlockingPool()->PostTaskAndReply(FROM_HERE, |
| 78 base::Bind(&gdata::GDataDownloadObserver::GetGDataTempDownloadPath, | 79 base::Bind(&gdata::GDataDownloadObserver::GetGDataTempDownloadPath, |
| 79 gdata_tmp_download_dir, | 80 gdata_tmp_download_dir, |
| 80 gdata_tmp_download_path), | 81 gdata_tmp_download_path), |
| 81 base::Bind(&GDataTempFileSelected, | 82 base::Bind(&GDataTempFileSelected, |
| 82 download_manager_, | 83 download_manager_, |
| 83 base::Owned(gdata_tmp_download_path), | 84 base::Owned(gdata_tmp_download_path), |
| 84 download_id_)); | 85 download_id_)); |
| 85 } | 86 } |
| 86 } else { | 87 } else { |
| 87 download_manager_->FileSelected(path, download_id_); | 88 download_manager_->FileSelected(path, download_id_); |
| 88 } | 89 } |
| 89 } | 90 } |
| 90 delete this; | 91 delete this; |
| 91 } | 92 } |
| OLD | NEW |