Chromium Code Reviews| Index: chrome/browser/chromeos/gdata/gdata_file_system.cc |
| diff --git a/chrome/browser/chromeos/gdata/gdata_file_system.cc b/chrome/browser/chromeos/gdata/gdata_file_system.cc |
| index 90e7026ea1e264d0a4613a98edb42dc1698aa6b1..826ed85a49e33de63a594530c7907a19b3bb9fb4 100644 |
| --- a/chrome/browser/chromeos/gdata/gdata_file_system.cc |
| +++ b/chrome/browser/chromeos/gdata/gdata_file_system.cc |
| @@ -1687,7 +1687,8 @@ void GDataFileSystem::GetFileByPath(const FilePath& file_path, |
| kGDataFileSystemToken, |
| FROM_HERE, |
| base::Bind(&GDataFileSystem::CreateDocumentJsonFileOnIOThreadPool, |
| - GetGDataTempDocumentFolderPath(), |
| + GetCacheDirectoryPath( |
| + GDataRootDirectory::CACHE_TYPE_TMP_DOCUMENTS), |
| file_properties.alternate_url, |
| file_properties.resource_id, |
| error, |
| @@ -1817,7 +1818,7 @@ void GDataFileSystem::FreeDiskSpaceIfNeededFor(int64 num_bytes, |
| // First remove temporary files from the cache map. |
| root_->RemoveTemporaryFilesFromCacheMap(); |
| // Then remove all files under "tmp" directory. |
| - RemoveAllFiles(GetGDataCacheTmpDirectory()); |
| + RemoveAllFiles(GetCacheDirectoryPath(GDataRootDirectory::CACHE_TYPE_TMP)); |
| // Check the disk space again. |
| *has_enough_space = HasEnoughSpaceFor(num_bytes); |
| @@ -2009,26 +2010,6 @@ bool GDataFileSystem::GetFileInfoByPath( |
| return true; |
| } |
| -FilePath GDataFileSystem::GetGDataCacheTmpDirectory() const { |
| - return cache_paths_[GDataRootDirectory::CACHE_TYPE_TMP]; |
| -} |
| - |
| -FilePath GDataFileSystem::GetGDataTempDownloadFolderPath() const { |
| - 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]; |
| -} |
| - |
| -FilePath GDataFileSystem::GetGDataCachePersistentDirectory() const { |
| - return cache_paths_[GDataRootDirectory::CACHE_TYPE_PERSISTENT]; |
| -} |
| - |
| base::WeakPtr<GDataFileSystem> GDataFileSystem::GetWeakPtrForCurrentThread() { |
| if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
| return ui_weak_ptr_factory_->GetWeakPtr(); |
| @@ -2302,7 +2283,7 @@ void GDataFileSystem::LoadRootFeedFromCache( |
| const FilePath& search_file_path, |
| const FindEntryCallback& callback) { |
| const FilePath path = |
| - cache_paths_[GDataRootDirectory::CACHE_TYPE_META].Append( |
| + GetCacheDirectoryPath(GDataRootDirectory::CACHE_TYPE_META).Append( |
| kFilesystemProtoFile); |
| LoadRootFeedParams* params = new LoadRootFeedParams(search_file_path, |
| should_load_from_server, |
| @@ -2376,7 +2357,7 @@ void GDataFileSystem::SaveFileSystemAsProto() { |
| } |
| const FilePath path = |
| - cache_paths_[GDataRootDirectory::CACHE_TYPE_META].Append( |
| + GetCacheDirectoryPath(GDataRootDirectory::CACHE_TYPE_META).Append( |
| kFilesystemProtoFile); |
| scoped_ptr<std::string> serialized_proto(new std::string()); |
| root_->SerializeToString(serialized_proto.get()); |
| @@ -2501,8 +2482,8 @@ void GDataFileSystem::SaveFeed(scoped_ptr<base::Value> feed, |
| kGDataFileSystemToken, |
| FROM_HERE, |
| base::Bind(&SaveFeedOnIOThreadPool, |
| - cache_paths_[GDataRootDirectory::CACHE_TYPE_META].Append( |
| - name), |
| + GetCacheDirectoryPath( |
| + GDataRootDirectory::CACHE_TYPE_META).Append(name), |
| base::Passed(&feed))); |
| } |
| @@ -3203,6 +3184,11 @@ void GDataFileSystem::SetHideHostedDocuments(bool hide) { |
| //===================== GDataFileSystem: Cache entry points ==================== |
| +FilePath GDataFileSystem::GetCacheDirectoryPath( |
| + GDataRootDirectory::CacheSubDirectoryType sub_dir_type) const { |
| + return GetCacheDirectoryPath(sub_dir_type); |
|
achuithb
2012/04/23 23:41:13
I'm confused?
satorux1
2012/04/23 23:43:00
Fixed!
|
| +} |
| + |
| FilePath GDataFileSystem::GetCacheFilePath( |
| const std::string& resource_id, |
| const std::string& md5, |
| @@ -3222,7 +3208,7 @@ FilePath GDataFileSystem::GetCacheFilePath( |
| base_name += FilePath::kExtensionSeparator; |
| base_name += GDataEntry::EscapeUtf8FileName(md5); |
| } |
| - return cache_paths_[sub_dir_type].Append(base_name); |
| + return GetCacheDirectoryPath(sub_dir_type).Append(base_name); |
| } |
| void GDataFileSystem::StoreToCache(const std::string& resource_id, |
| @@ -3411,7 +3397,7 @@ void GDataFileSystem::InitializeCacheOnIOThreadPool() { |
| // Change permissions of cache persistent directory to u+rwx,og+x in order to |
| // allow archive files in that directory to be mounted by cros-disks. |
| error = ChangeFilePermissions( |
| - cache_paths_[GDataRootDirectory::CACHE_TYPE_PERSISTENT], |
| + GetCacheDirectoryPath(GDataRootDirectory::CACHE_TYPE_PERSISTENT), |
| S_IRWXU | S_IXGRP | S_IXOTH); |
| if (error != base::PLATFORM_FILE_OK) |
| return; |
| @@ -4150,7 +4136,7 @@ void GDataFileSystem::ScanCacheDirectory( |
| GDataRootDirectory::CacheSubDirectoryType sub_dir_type, |
| GDataRootDirectory::CacheMap* cache_map) { |
| file_util::FileEnumerator enumerator( |
| - cache_paths_[sub_dir_type], |
| + GetCacheDirectoryPath(sub_dir_type), |
| false, // not recursive |
| static_cast<file_util::FileEnumerator::FileType>( |
| file_util::FileEnumerator::FILES | |