| 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];
|
| }
|
|
|