Chromium Code Reviews| Index: chrome/browser/chromeos/gdata/gdata_file_system.cc |
| =================================================================== |
| --- chrome/browser/chromeos/gdata/gdata_file_system.cc (revision 128786) |
| +++ chrome/browser/chromeos/gdata/gdata_file_system.cc (working copy) |
| @@ -427,6 +427,10 @@ |
| cache_paths_.push_back(gdata_cache_path_.Append(kGDataCacheTmpDir)); |
| cache_paths_.push_back(gdata_cache_path_.Append(kGDataCacheTmpDownloadsDir)); |
| + // Bail out if we can't create the directory for hosting temporary document |
| + // JSON files. |
|
Ben Chan
2012/03/24 22:55:34
Should we bail out here or return an error in Crea
|
| + CHECK(temp_document_dir_.CreateUniqueTempDir()); |
|
zel
2012/03/24 23:03:10
you can't create dir on UI thread - check CreateCa
Ben Chan
2012/03/24 23:33:46
Done.
|
| + |
| documents_service_->Initialize(profile_); |
| root_.reset(new GDataRootDirectory(this)); |
| @@ -979,6 +983,7 @@ |
| // static |
| void GDataFileSystem::CreateDocumentJsonFileOnIOThreadPool( |
| + const FilePath& document_dir, |
| const GURL& edit_url, |
| const std::string& resource_id, |
| const GetFileCallback& callback, |
| @@ -986,7 +991,7 @@ |
| base::PlatformFileError error = base::PLATFORM_FILE_ERROR_FAILED; |
| FilePath temp_file; |
| - if (file_util::CreateTemporaryFile(&temp_file)) { |
| + if (file_util::CreateTemporaryFileInDir(document_dir, &temp_file)) { |
| std::string document_content = base::StringPrintf( |
| "{\"url\": \"%s\", \"resource_id\": \"%s\"}", |
| edit_url.spec().c_str(), resource_id.c_str()); |
| @@ -1028,6 +1033,7 @@ |
| if (file_properties.is_hosted_document) { |
| BrowserThread::PostBlockingPoolTask(FROM_HERE, |
| base::Bind(&GDataFileSystem::CreateDocumentJsonFileOnIOThreadPool, |
| + temp_document_dir_.path(), |
| file_properties.edit_url, |
| file_properties.resource_id, |
| callback, |
| @@ -1239,6 +1245,10 @@ |
| return cache_paths_[GDataRootDirectory::CACHE_TYPE_PERSISTENT]; |
| } |
| +FilePath GDataFileSystem::GetGDataTempDocumentDirectory() const { |
| + return temp_document_dir_.path(); |
| +} |
| + |
| base::WeakPtr<GDataFileSystem> GDataFileSystem::GetWeakPtrForCurrentThread() { |
| if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
| return ui_weak_ptr_factory_->GetWeakPtr(); |