Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(401)

Unified Diff: chrome/browser/chromeos/gdata/gdata_file_system.cc

Issue 9834091: gdata: Fix issue with copying hosted documents out from Docs folder. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_file_system.h ('k') | chrome/browser/chromeos/gdata/mock_gdata_file_system.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698