diff options
Diffstat (limited to 'chrome/browser/chromeos/gdata')
-rw-r--r-- | chrome/browser/chromeos/gdata/gdata_download_observer.cc | 15 | ||||
-rw-r--r-- | chrome/browser/chromeos/gdata/gdata_download_observer.h | 6 | ||||
-rw-r--r-- | chrome/browser/chromeos/gdata/gdata_file_system.cc | 1 |
3 files changed, 22 insertions, 0 deletions
diff --git a/chrome/browser/chromeos/gdata/gdata_download_observer.cc b/chrome/browser/chromeos/gdata/gdata_download_observer.cc index f5cc19c..4f14a63 100644 --- a/chrome/browser/chromeos/gdata/gdata_download_observer.cc +++ b/chrome/browser/chromeos/gdata/gdata_download_observer.cc @@ -4,6 +4,7 @@ #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" +#include "base/file_util.h" #include "chrome/browser/chromeos/gdata/gdata_uploader.h" #include "chrome/browser/chromeos/gdata/gdata_upload_file_info.h" #include "chrome/browser/chromeos/gdata/gdata_util.h" @@ -153,6 +154,20 @@ int GDataDownloadObserver::PercentComplete(DownloadItem* download) { return -1; } +// |gdata_tmp_download_path| is set to a temporary local download path in +// ~/GCache/v1/tmp/downloads/ +// static +void GDataDownloadObserver::GetGDataTempDownloadPath( + const FilePath& gdata_tmp_download_dir, + FilePath* gdata_tmp_download_path) { + bool created = file_util::CreateDirectory(gdata_tmp_download_dir); + DCHECK(created) << "Can not create temp download directory at " + << gdata_tmp_download_dir.value(); + created = file_util::CreateTemporaryFileInDir(gdata_tmp_download_dir, + gdata_tmp_download_path); + DCHECK(created) << "Temporary download file creation failed"; +} + void GDataDownloadObserver::ManagerGoingDown( DownloadManager* download_manager) { download_manager->RemoveObserver(this); diff --git a/chrome/browser/chromeos/gdata/gdata_download_observer.h b/chrome/browser/chromeos/gdata/gdata_download_observer.h index ef67487..8d5cf95 100644 --- a/chrome/browser/chromeos/gdata/gdata_download_observer.h +++ b/chrome/browser/chromeos/gdata/gdata_download_observer.h @@ -54,6 +54,12 @@ class GDataDownloadObserver : public content::DownloadManager::Observer, // progress is unknown, returns -1. static int PercentComplete(content::DownloadItem* download); + // Create a temporary file |gdata_tmp_download_path| in + // |gdata_tmp_download_dir|. Must be called on a thread that allows file + // operations. + static void GetGDataTempDownloadPath(const FilePath& gdata_tmp_download_dir, + FilePath* gdata_tmp_download_path); + private: // Gets the gdata_path from external data in |download|. // GetGDataPath may return an empty path in case SetGDataPath was not diff --git a/chrome/browser/chromeos/gdata/gdata_file_system.cc b/chrome/browser/chromeos/gdata/gdata_file_system.cc index c2649b5..7f86155 100644 --- a/chrome/browser/chromeos/gdata/gdata_file_system.cc +++ b/chrome/browser/chromeos/gdata/gdata_file_system.cc @@ -631,6 +631,7 @@ void GDataFileSystem::TransferFile(const FilePath& local_file_path, if (!dest_dir || !dest_dir->AsGDataDirectory()) { base::MessageLoopProxy::current()->PostTask(FROM_HERE, base::Bind(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND)); + NOTREACHED(); return; } |