Index: chrome/browser/chromeos/gdata/gdata_util.cc |
diff --git a/chrome/browser/chromeos/gdata/gdata_util.cc b/chrome/browser/chromeos/gdata/gdata_util.cc |
index fe764c9ea56c16d80185a3bde161038ae20ee606..08402e7dfc3e3890e85f07d66ec5b1af24c45928 100644 |
--- a/chrome/browser/chromeos/gdata/gdata_util.cc |
+++ b/chrome/browser/chromeos/gdata/gdata_util.cc |
@@ -21,6 +21,7 @@ |
#include "base/stringprintf.h" |
#include "base/threading/sequenced_worker_pool.h" |
#include "base/time.h" |
+#include "chrome/browser/chromeos/gdata/file_write_helper.h" |
#include "chrome/browser/chromeos/gdata/gdata.pb.h" |
#include "chrome/browser/chromeos/gdata/gdata_file_system_interface.h" |
#include "chrome/browser/chromeos/gdata/gdata_system_service.h" |
@@ -71,6 +72,12 @@ GDataCache* GetGDataCache(Profile* profile) { |
return system_service ? system_service->cache() : NULL; |
} |
+FileWriteHelper* GetFileWriteHelper(Profile* profile) { |
+ GDataSystemService* system_service = |
+ GDataSystemServiceFactory::GetForProfile(profile); |
+ return system_service ? system_service->file_write_helper() : NULL; |
+} |
+ |
void GetHostedDocumentURLBlockingThread(const FilePath& gdata_cache_path, |
GURL* url) { |
std::string json; |
@@ -579,5 +586,22 @@ std::string FormatTimeAsString(const base::Time& time) { |
exploded.hour, exploded.minute, exploded.second, exploded.millisecond); |
} |
+void PrepareWritableFileAndRun(Profile* profile, |
+ const FilePath& path, |
+ const OpenFileCallback& callback) { |
satorux1
2012/08/02 07:37:51
Add DCHECK(BrowserThread::CurrentlyOn(BrowserThrea
kinaba
2012/08/02 08:30:02
Done.
|
+ if (IsUnderGDataMountPoint(path)) { |
+ FileWriteHelper* file_write_helper = GetFileWriteHelper(profile); |
+ if (!file_write_helper) |
+ return; |
+ FilePath remote_path(ExtractGDataPath(path)); |
+ file_write_helper->PrepareWritableFileAndRun(remote_path, callback); |
+ } else { |
+ if (!callback.is_null()) { |
+ content::BrowserThread::GetBlockingPool()->PostTask( |
+ FROM_HERE, base::Bind(callback, GDATA_FILE_OK, path)); |
+ } |
+ } |
+} |
+ |
} // namespace util |
} // namespace gdata |