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

Unified Diff: chrome/browser/chromeos/drive/file_system_util.cc

Issue 23050014: Convert drive::FileWriteHelper to a single function for simplification. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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/drive/file_system_util.h ('k') | chrome/browser/chromeos/drive/file_write_helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/drive/file_system_util.cc
diff --git a/chrome/browser/chromeos/drive/file_system_util.cc b/chrome/browser/chromeos/drive/file_system_util.cc
index e84c860ff35b492907858d48f9f90a9b761dfa55..da2271d119fca0967f7c3da105e207725f531f78 100644
--- a/chrome/browser/chromeos/drive/file_system_util.cc
+++ b/chrome/browser/chromeos/drive/file_system_util.cc
@@ -27,8 +27,8 @@
#include "chrome/browser/chromeos/drive/drive.pb.h"
#include "chrome/browser/chromeos/drive/drive_integration_service.h"
#include "chrome/browser/chromeos/drive/file_system_interface.h"
-#include "chrome/browser/chromeos/drive/file_write_helper.h"
#include "chrome/browser/chromeos/drive/job_list.h"
+#include "chrome/browser/chromeos/drive/write_on_cache_file.h"
#include "chrome/browser/google_apis/gdata_wapi_parser.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
@@ -73,12 +73,6 @@ FileSystemInterface* GetFileSystem(Profile* profile) {
return integration_service ? integration_service->file_system() : NULL;
}
-FileWriteHelper* GetFileWriteHelper(Profile* profile) {
- DriveIntegrationService* integration_service =
- DriveIntegrationServiceFactory::GetForProfile(profile);
- return integration_service ? integration_service->file_write_helper() : NULL;
-}
-
std::string ReadStringFromGDocFile(const base::FilePath& file_path,
const std::string& key) {
const int64 kMaxGDocSize = 4096;
@@ -327,19 +321,19 @@ void MigrateCacheFilesFromOldDirectories(
void PrepareWritableFileAndRun(Profile* profile,
const base::FilePath& path,
- const OpenFileCallback& callback) {
+ const PrepareWritableFileCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!callback.is_null());
- if (IsUnderDriveMountPoint(path)) {
- FileWriteHelper* file_write_helper = GetFileWriteHelper(profile);
- if (!file_write_helper)
- return;
- base::FilePath remote_path(ExtractDrivePath(path));
- file_write_helper->PrepareWritableFileAndRun(remote_path, callback);
- } else {
+
+ FileSystemInterface* file_system = GetFileSystem(profile);
+ if (!file_system || !IsUnderDriveMountPoint(path)) {
content::BrowserThread::GetBlockingPool()->PostTask(
- FROM_HERE, base::Bind(callback, FILE_ERROR_OK, path));
+ FROM_HERE, base::Bind(callback, FILE_ERROR_FAILED, base::FilePath()));
+ return;
}
+
+ const base::FilePath drive_path = ExtractDrivePath(path);
+ WriteOnCacheFile(file_system, drive_path, callback);
}
void EnsureDirectoryExists(Profile* profile,
« no previous file with comments | « chrome/browser/chromeos/drive/file_system_util.h ('k') | chrome/browser/chromeos/drive/file_write_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698