| 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 722441ace590dbf952cc7dfe12be6279c9cf0637..1c2d2c84da10c41bdc8b89466c0d4219781266ae 100644
|
| --- a/chrome/browser/chromeos/gdata/gdata_util.cc
|
| +++ b/chrome/browser/chromeos/gdata/gdata_util.cc
|
| @@ -63,6 +63,12 @@ GDataFileSystem* GetGDataFileSystem(Profile* profile) {
|
| return system_service ? system_service->file_system() : NULL;
|
| }
|
|
|
| +GDataCache* GetGDataCache(Profile* profile) {
|
| + GDataSystemService* system_service =
|
| + GDataSystemServiceFactory::GetForProfile(profile);
|
| + return system_service ? system_service->cache() : NULL;
|
| +}
|
| +
|
| void GetHostedDocumentURLBlockingThread(const FilePath& gdata_cache_path,
|
| GURL* url) {
|
| std::string json;
|
| @@ -106,8 +112,8 @@ void OnGetFileInfoForInsertGDataCachePathsPermissions(
|
| DCHECK(cache_paths);
|
| DCHECK(!callback.is_null());
|
|
|
| - GDataFileSystem* file_system = GetGDataFileSystem(profile);
|
| - if (!file_system || error != base::PLATFORM_FILE_OK) {
|
| + GDataCache* cache = GetGDataCache(profile);
|
| + if (!cache || error != base::PLATFORM_FILE_OK) {
|
| callback.Run();
|
| return;
|
| }
|
| @@ -121,24 +127,24 @@ void OnGetFileInfoForInsertGDataCachePathsPermissions(
|
| // should be sufficient for all cache paths. For the rest of supported
|
| // operations the file access check is done for drive/ paths.
|
| cache_paths->push_back(std::make_pair(
|
| - file_system->GetCacheFilePath(resource_id, file_md5,
|
| + cache->GetCacheFilePath(resource_id, file_md5,
|
| GDataCache::CACHE_TYPE_PERSISTENT,
|
| GDataCache::CACHED_FILE_FROM_SERVER),
|
| kReadOnlyFilePermissions));
|
| // TODO(tbarzic): When we start supporting openFile operation, we may have to
|
| // change permission for localy modified files to match handler's permissions.
|
| cache_paths->push_back(std::make_pair(
|
| - file_system->GetCacheFilePath(resource_id, file_md5,
|
| + cache->GetCacheFilePath(resource_id, file_md5,
|
| GDataCache::CACHE_TYPE_PERSISTENT,
|
| GDataCache::CACHED_FILE_LOCALLY_MODIFIED),
|
| kReadOnlyFilePermissions));
|
| cache_paths->push_back(std::make_pair(
|
| - file_system->GetCacheFilePath(resource_id, file_md5,
|
| + cache->GetCacheFilePath(resource_id, file_md5,
|
| GDataCache::CACHE_TYPE_PERSISTENT,
|
| GDataCache::CACHED_FILE_MOUNTED),
|
| kReadOnlyFilePermissions));
|
| cache_paths->push_back(std::make_pair(
|
| - file_system->GetCacheFilePath(resource_id, file_md5,
|
| + cache->GetCacheFilePath(resource_id, file_md5,
|
| GDataCache::CACHE_TYPE_TMP,
|
| GDataCache::CACHED_FILE_FROM_SERVER),
|
| kReadOnlyFilePermissions));
|
| @@ -181,10 +187,13 @@ void ModifyGDataFileResourceUrl(Profile* profile,
|
| GDataFileSystem* file_system = GetGDataFileSystem(profile);
|
| if (!file_system)
|
| return;
|
| + GDataCache* cache = GetGDataCache(profile);
|
| + if (!cache)
|
| + return;
|
|
|
| // Handle hosted documents. The edit url is in the temporary file, so we
|
| // read it on a blocking thread.
|
| - if (file_system->GetCacheDirectoryPath(
|
| + if (cache->GetCacheDirectoryPath(
|
| GDataCache::CACHE_TYPE_TMP_DOCUMENTS).IsParent(
|
| gdata_cache_path)) {
|
| GURL* edit_url = new GURL();
|
| @@ -197,7 +206,7 @@ void ModifyGDataFileResourceUrl(Profile* profile,
|
| }
|
|
|
| // Handle all other gdata files.
|
| - if (file_system->GetCacheDirectoryPath(
|
| + if (cache->GetCacheDirectoryPath(
|
| GDataCache::CACHE_TYPE_TMP).IsParent(gdata_cache_path)) {
|
| const std::string resource_id =
|
| gdata_cache_path.BaseName().RemoveExtension().AsUTF8Unsafe();
|
|
|