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

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
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_file_system.h ('k') | chrome/browser/chromeos/gdata/gdata_files.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/gdata/gdata_file_system.cc
===================================================================
--- chrome/browser/chromeos/gdata/gdata_file_system.cc (revision 128807)
+++ chrome/browser/chromeos/gdata/gdata_file_system.cc (working copy)
@@ -53,6 +53,8 @@
const FilePath::CharType kGDataCacheTmpDir[] = FILE_PATH_LITERAL("tmp");
const FilePath::CharType kGDataCacheTmpDownloadsDir[] =
FILE_PATH_LITERAL("tmp/downloads");
+const FilePath::CharType kGDataCacheTmpDocumentsDir[] =
+ FILE_PATH_LITERAL("tmp/documents");
const FilePath::CharType kLastFeedFile[] = FILE_PATH_LITERAL("last_feed.json");
const char kGDataFileSystemToken[] = "GDataFileSystemToken";
const FilePath::CharType kAccountMetadataFile[] =
@@ -426,6 +428,7 @@
cache_paths_.push_back(gdata_cache_path_.Append(kGDataCachePersistentDir));
cache_paths_.push_back(gdata_cache_path_.Append(kGDataCacheTmpDir));
cache_paths_.push_back(gdata_cache_path_.Append(kGDataCacheTmpDownloadsDir));
+ cache_paths_.push_back(gdata_cache_path_.Append(kGDataCacheTmpDocumentsDir));
documents_service_->Initialize(profile_);
@@ -979,6 +982,7 @@
// static
void GDataFileSystem::CreateDocumentJsonFileOnIOThreadPool(
+ const FilePath& document_dir,
const GURL& edit_url,
const std::string& resource_id,
const GetFileCallback& callback,
@@ -986,7 +990,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());
@@ -1026,8 +1030,13 @@
// formats. The JSON file contains the edit URL and resource ID of the
// document.
if (file_properties.is_hosted_document) {
- BrowserThread::PostBlockingPoolTask(FROM_HERE,
+ InitializeCacheIfNecessary();
+
+ PostBlockingPoolSequencedTask(
+ kGDataFileSystemToken,
+ FROM_HERE,
base::Bind(&GDataFileSystem::CreateDocumentJsonFileOnIOThreadPool,
+ GetGDataTempDocumentFolderPath(),
file_properties.edit_url,
file_properties.resource_id,
callback,
@@ -1276,6 +1285,10 @@
return cache_paths_[GDataRootDirectory::CACHE_TYPE_TMP_DOWNLOADS];
}
+FilePath GDataFileSystem::GetGDataTempDocumentFolderPath() const {
+ return cache_paths_[GDataRootDirectory::CACHE_TYPE_TMP_DOCUMENTS];
+}
+
FilePath GDataFileSystem::GetGDataCachePinnedDirectory() const {
return cache_paths_[GDataRootDirectory::CACHE_TYPE_PINNED];
}
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_file_system.h ('k') | chrome/browser/chromeos/gdata/gdata_files.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698