| 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..c5a2e03fe84d1750485e35c59b019908fc8db3b9 100644
|
| --- a/chrome/browser/chromeos/gdata/gdata_util.cc
|
| +++ b/chrome/browser/chromeos/gdata/gdata_util.cc
|
| @@ -23,6 +23,7 @@
|
| #include "base/time.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_file_writing.h"
|
| #include "chrome/browser/chromeos/gdata/gdata_system_service.h"
|
| #include "chrome/browser/chromeos/login/user.h"
|
| #include "chrome/browser/chromeos/login/user_manager.h"
|
| @@ -71,6 +72,12 @@ GDataCache* GetGDataCache(Profile* profile) {
|
| return system_service ? system_service->cache() : NULL;
|
| }
|
|
|
| +GDataFileWriting* GetGDataFileWriting(Profile* profile) {
|
| + GDataSystemService* system_service =
|
| + GDataSystemServiceFactory::GetForProfile(profile);
|
| + return system_service ? system_service->file_writing() : 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) {
|
| + if (IsUnderGDataMountPoint(path)) {
|
| + GDataFileWriting* file_writing = GetGDataFileWriting(profile);
|
| + if (!file_writing)
|
| + return;
|
| + FilePath remote_path(ExtractGDataPath(path));
|
| + file_writing->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
|
|
|