summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorsatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-21 05:43:02 +0000
committersatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-21 05:43:02 +0000
commit40101ae21c7134b274be9724512dc10c017365fa (patch)
treea4e004cf6ee08b1324f48fa84e4a91a6ad4dcc32 /chrome
parentaf6489c462479724d655e89713eef0f8dde41064 (diff)
downloadchromium_src-40101ae21c7134b274be9724512dc10c017365fa.zip
chromium_src-40101ae21c7134b274be9724512dc10c017365fa.tar.gz
chromium_src-40101ae21c7134b274be9724512dc10c017365fa.tar.bz2
gdata: Rename functions in GDataFileSystem
To make them more consistent and descriptive. GetFile -> GetFileByPath GetFileForResourceId -> GetFileByResourceId GetFromCache -> GetFileFromCacheByResourceIdAndMd5 GetFromCacheInternal -> GetFileFromCacheByResourceIdAndMd5Internal GetFromCacheForPath -> GetFileFromCacheByPath GetFromCacheOnIOThreadPool -> GetFileFromCacheOnIOThreadPool GetGDataEntryFromPath -> GetGDataEntryByPath TEST=chromium-os:29749 BUG=compiles Review URL: http://codereview.chromium.org/10144013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133338 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/chromeos/extensions/file_browser_private_api.cc2
-rw-r--r--chrome/browser/chromeos/gdata/gdata_file_system.cc140
-rw-r--r--chrome/browser/chromeos/gdata/gdata_file_system.h87
-rw-r--r--chrome/browser/chromeos/gdata/gdata_file_system_proxy.cc10
-rw-r--r--chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc103
-rw-r--r--chrome/browser/chromeos/gdata/gdata_protocol_handler.cc18
-rw-r--r--chrome/browser/chromeos/gdata/gdata_sync_client.cc2
-rw-r--r--chrome/browser/chromeos/gdata/gdata_sync_client_unittest.cc50
-rw-r--r--chrome/browser/chromeos/gdata/gdata_util.cc2
-rw-r--r--chrome/browser/chromeos/gdata/mock_gdata_file_system.h14
10 files changed, 224 insertions, 204 deletions
diff --git a/chrome/browser/chromeos/extensions/file_browser_private_api.cc b/chrome/browser/chromeos/extensions/file_browser_private_api.cc
index 8a706a7..907488e 100644
--- a/chrome/browser/chromeos/extensions/file_browser_private_api.cc
+++ b/chrome/browser/chromeos/extensions/file_browser_private_api.cc
@@ -1778,7 +1778,7 @@ void GetGDataFilesFunction::GetFileOrSendResponse() {
// Get the file on the top of the queue.
FilePath gdata_path = remaining_gdata_paths_.front();
- system_service->file_system()->GetFile(
+ system_service->file_system()->GetFileByPath(
gdata_path,
base::Bind(&GetGDataFilesFunction::OnFileReady, this));
}
diff --git a/chrome/browser/chromeos/gdata/gdata_file_system.cc b/chrome/browser/chromeos/gdata/gdata_file_system.cc
index 87eb3e9..91978fc 100644
--- a/chrome/browser/chromeos/gdata/gdata_file_system.cc
+++ b/chrome/browser/chromeos/gdata/gdata_file_system.cc
@@ -493,9 +493,9 @@ void RunCacheOperationCallbackHelper(
callback.Run(*error, resource_id, md5);
}
-// Ditto for GetFromCacheCallback.
-void RunGetFromCacheCallbackHelper(
- const GetFromCacheCallback& callback,
+// Ditto for GetFileFromCacheCallback.
+void RunGetFileFromCacheCallbackHelper(
+ const GetFileFromCacheCallback& callback,
base::PlatformFileError* error,
const std::string& resource_id,
const std::string& md5,
@@ -1108,7 +1108,7 @@ void GDataFileSystem::TransferFile(const FilePath& local_file_path,
base::AutoLock lock(lock_);
// Make sure the destination directory exists
- GDataEntry* dest_dir = GetGDataEntryFromPath(
+ GDataEntry* dest_dir = GetGDataEntryByPath(
remote_dest_file_path.DirName());
if (!dest_dir || !dest_dir->AsGDataDirectory()) {
base::MessageLoopProxy::current()->PostTask(FROM_HERE,
@@ -1265,8 +1265,8 @@ void GDataFileSystem::Copy(const FilePath& src_file_path,
bool src_file_is_hosted_document = false;
{
base::AutoLock lock(lock_);
- GDataEntry* src_entry = GetGDataEntryFromPath(src_file_path);
- GDataEntry* dest_parent = GetGDataEntryFromPath(dest_parent_path);
+ GDataEntry* src_entry = GetGDataEntryByPath(src_file_path);
+ GDataEntry* dest_parent = GetGDataEntryByPath(dest_parent_path);
if (!src_entry || !dest_parent) {
error = base::PLATFORM_FILE_ERROR_NOT_FOUND;
} else if (!dest_parent->AsGDataDirectory()) {
@@ -1301,7 +1301,7 @@ void GDataFileSystem::Copy(const FilePath& src_file_path,
// TODO(benchan): Reimplement this once the server API supports
// copying of regular files directly on the server side.
- GetFile(src_file_path,
+ GetFileByPath(src_file_path,
base::Bind(&GDataFileSystem::OnGetFileCompleteForCopy,
GetWeakPtrForCurrentThread(),
dest_file_path,
@@ -1370,7 +1370,7 @@ void GDataFileSystem::Rename(const FilePath& file_path,
}
base::AutoLock lock(lock_);
- GDataEntry* entry = GetGDataEntryFromPath(file_path);
+ GDataEntry* entry = GetGDataEntryByPath(file_path);
if (!entry) {
if (!callback.is_null()) {
MessageLoop::current()->PostTask(FROM_HERE,
@@ -1409,8 +1409,8 @@ void GDataFileSystem::Move(const FilePath& src_file_path,
{
// This scoped lock needs to be released before calling Rename() below.
base::AutoLock lock(lock_);
- GDataEntry* src_entry = GetGDataEntryFromPath(src_file_path);
- GDataEntry* dest_parent = GetGDataEntryFromPath(dest_parent_path);
+ GDataEntry* src_entry = GetGDataEntryByPath(src_file_path);
+ GDataEntry* dest_parent = GetGDataEntryByPath(dest_parent_path);
if (!src_entry || !dest_parent) {
error = base::PLATFORM_FILE_ERROR_NOT_FOUND;
} else {
@@ -1470,8 +1470,8 @@ void GDataFileSystem::AddEntryToDirectory(
base::PlatformFileError error,
const FilePath& file_path) {
base::AutoLock lock(lock_);
- GDataEntry* entry = GetGDataEntryFromPath(file_path);
- GDataEntry* dir_entry = GetGDataEntryFromPath(dir_path);
+ GDataEntry* entry = GetGDataEntryByPath(file_path);
+ GDataEntry* dir_entry = GetGDataEntryByPath(dir_path);
if (error == base::PLATFORM_FILE_OK) {
if (!entry || !dir_entry) {
error = base::PLATFORM_FILE_ERROR_NOT_FOUND;
@@ -1505,8 +1505,8 @@ void GDataFileSystem::RemoveEntryFromDirectory(
base::PlatformFileError error,
const FilePath& file_path) {
base::AutoLock lock(lock_);
- GDataEntry* entry = GetGDataEntryFromPath(file_path);
- GDataEntry* dir = GetGDataEntryFromPath(dir_path);
+ GDataEntry* entry = GetGDataEntryByPath(file_path);
+ GDataEntry* dir = GetGDataEntryByPath(dir_path);
if (error == base::PLATFORM_FILE_OK) {
if (!entry || !dir) {
error = base::PLATFORM_FILE_ERROR_NOT_FOUND;
@@ -1540,7 +1540,7 @@ void GDataFileSystem::Remove(const FilePath& file_path,
bool is_recursive,
const FileOperationCallback& callback) {
base::AutoLock lock(lock_);
- GDataEntry* entry = GetGDataEntryFromPath(file_path);
+ GDataEntry* entry = GetGDataEntryByPath(file_path);
if (!entry) {
if (!callback.is_null()) {
MessageLoop::current()->PostTask(
@@ -1656,10 +1656,10 @@ void GDataFileSystem::CreateDocumentJsonFileOnIOThreadPool(
temp_file_path->clear();
}
-void GDataFileSystem::GetFile(const FilePath& file_path,
- const GetFileCallback& callback) {
+void GDataFileSystem::GetFileByPath(const FilePath& file_path,
+ const GetFileCallback& callback) {
GDataFileProperties file_properties;
- if (!GetFileInfoFromPath(file_path, &file_properties)) {
+ if (!GetFileInfoByPath(file_path, &file_properties)) {
if (!callback.is_null()) {
MessageLoop::current()->PostTask(
FROM_HERE,
@@ -1709,21 +1709,23 @@ void GDataFileSystem::GetFile(const FilePath& file_path,
file_properties.file_md5,
GDataRootDirectory::CACHE_TYPE_TMP,
CACHED_FILE_FROM_SERVER);
- GetFromCache(file_properties.resource_id, file_properties.file_md5,
- base::Bind(
- &GDataFileSystem::OnGetFileFromCache,
- GetWeakPtrForCurrentThread(),
- GetFileFromCacheParams(file_path,
- local_tmp_path,
- file_properties.content_url,
- file_properties.resource_id,
- file_properties.file_md5,
- file_properties.mime_type,
- base::MessageLoopProxy::current(),
- callback)));
-}
-
-void GDataFileSystem::GetFileForResourceId(
+ GetFileFromCacheByResourceIdAndMd5(
+ file_properties.resource_id,
+ file_properties.file_md5,
+ base::Bind(
+ &GDataFileSystem::OnGetFileFromCache,
+ GetWeakPtrForCurrentThread(),
+ GetFileFromCacheParams(file_path,
+ local_tmp_path,
+ file_properties.content_url,
+ file_properties.resource_id,
+ file_properties.file_md5,
+ file_properties.mime_type,
+ base::MessageLoopProxy::current(),
+ callback)));
+}
+
+void GDataFileSystem::GetFileByResourceId(
const std::string& resource_id,
const GetFileCallback& callback) {
FilePath file_path;
@@ -1752,7 +1754,7 @@ void GDataFileSystem::GetFileForResourceId(
return;
}
- GetFile(file_path, callback);
+ GetFileByPath(file_path, callback);
}
void GDataFileSystem::OnGetFileFromCache(const GetFileFromCacheParams& params,
@@ -1987,11 +1989,11 @@ void GDataFileSystem::UnsafeFindEntryByPath(
delegate->OnDone(base::PLATFORM_FILE_ERROR_NOT_FOUND, FilePath(), NULL);
}
-bool GDataFileSystem::GetFileInfoFromPath(
+bool GDataFileSystem::GetFileInfoByPath(
const FilePath& file_path, GDataFileProperties* properties) {
DCHECK(properties);
base::AutoLock lock(lock_);
- GDataEntry* entry = GetGDataEntryFromPath(file_path);
+ GDataEntry* entry = GetGDataEntryByPath(file_path);
if (!entry)
return false;
@@ -2045,7 +2047,7 @@ base::WeakPtr<GDataFileSystem> GDataFileSystem::GetWeakPtrForCurrentThread() {
return ui_weak_ptr_factory_->GetWeakPtr();
}
-GDataEntry* GDataFileSystem::GetGDataEntryFromPath(
+GDataEntry* GDataFileSystem::GetGDataEntryByPath(
const FilePath& file_path) {
lock_.AssertAcquired();
// Find directory element within the cached file system snapshot.
@@ -2054,16 +2056,16 @@ GDataEntry* GDataFileSystem::GetGDataEntryFromPath(
return find_delegate.entry();
}
-void GDataFileSystem::GetFromCacheForPath(
+void GDataFileSystem::GetFileFromCacheByPath(
const FilePath& gdata_file_path,
- const GetFromCacheCallback& callback) {
+ const GetFileFromCacheCallback& callback) {
std::string resource_id;
std::string md5;
- { // Lock to use GetGDataEntryFromPath and returned pointer, but need to
- // release before GetFromCache.
+ { // Lock to use GetGDataEntryByPath and returned pointer, but need to
+ // release before GetFileFromCacheByResourceIdAndMd5.
base::AutoLock lock(lock_);
- GDataEntry* entry = GetGDataEntryFromPath(gdata_file_path);
+ GDataEntry* entry = GetGDataEntryByPath(gdata_file_path);
if (entry && entry->AsGDataFile()) {
GDataFile* file = entry->AsGDataFile();
@@ -2085,7 +2087,8 @@ void GDataFileSystem::GetFromCacheForPath(
}
}
- GetFromCacheInternal(resource_id, md5, gdata_file_path, callback);
+ GetFileFromCacheByResourceIdAndMd5Internal(
+ resource_id, md5, gdata_file_path, callback);
}
void GDataFileSystem::GetCacheState(const std::string& resource_id,
@@ -2129,7 +2132,7 @@ void GDataFileSystem::SetPinState(const FilePath& file_path, bool to_pin,
std::string resource_id, md5;
{
base::AutoLock lock(lock_);
- GDataEntry* entry = GetGDataEntryFromPath(file_path);
+ GDataEntry* entry = GetGDataEntryByPath(file_path);
GDataFile* file = entry ? entry->AsGDataFile() : NULL;
if (!file) {
@@ -2639,7 +2642,7 @@ base::PlatformFileError GDataFileSystem::RenameFileOnFilesystem(
DCHECK(updated_file_path);
base::AutoLock lock(lock_);
- GDataEntry* entry = GetGDataEntryFromPath(file_path);
+ GDataEntry* entry = GetGDataEntryByPath(file_path);
if (!entry)
return base::PLATFORM_FILE_ERROR_NOT_FOUND;
@@ -2660,13 +2663,13 @@ base::PlatformFileError GDataFileSystem::RenameFileOnFilesystem(
base::PlatformFileError GDataFileSystem::AddEntryToDirectoryOnFilesystem(
const FilePath& file_path, const FilePath& dir_path) {
base::AutoLock lock(lock_);
- GDataEntry* entry = GetGDataEntryFromPath(file_path);
+ GDataEntry* entry = GetGDataEntryByPath(file_path);
if (!entry)
return base::PLATFORM_FILE_ERROR_NOT_FOUND;
DCHECK_EQ(root_.get(), entry->parent());
- GDataEntry* dir_entry = GetGDataEntryFromPath(dir_path);
+ GDataEntry* dir_entry = GetGDataEntryByPath(dir_path);
if (!dir_entry)
return base::PLATFORM_FILE_ERROR_NOT_FOUND;
@@ -2687,11 +2690,11 @@ base::PlatformFileError GDataFileSystem::RemoveEntryFromDirectoryOnFilesystem(
DCHECK(updated_file_path);
base::AutoLock lock(lock_);
- GDataEntry* entry = GetGDataEntryFromPath(file_path);
+ GDataEntry* entry = GetGDataEntryByPath(file_path);
if (!entry)
return base::PLATFORM_FILE_ERROR_NOT_FOUND;
- GDataEntry* dir = GetGDataEntryFromPath(dir_path);
+ GDataEntry* dir = GetGDataEntryByPath(dir_path);
if (!dir)
return base::PLATFORM_FILE_ERROR_NOT_FOUND;
@@ -3065,7 +3068,7 @@ base::PlatformFileError GDataFileSystem::AddNewDirectory(
base::AutoLock lock(lock_);
// Find parent directory element within the cached file system snapshot.
- GDataEntry* entry = GetGDataEntryFromPath(directory_path);
+ GDataEntry* entry = GetGDataEntryByPath(directory_path);
if (!entry)
return base::PLATFORM_FILE_ERROR_FAILED;
@@ -3104,7 +3107,7 @@ GDataFileSystem::FindFirstMissingParentDirectory(
path_parts.begin();
iter != path_parts.end(); ++iter) {
current_path = current_path.Append(*iter);
- GDataEntry* entry = GetGDataEntryFromPath(current_path);
+ GDataEntry* entry = GetGDataEntryByPath(current_path);
if (entry) {
if (entry->file_info().is_directory) {
*last_dir_content_url = entry->content_url();
@@ -3124,7 +3127,7 @@ GURL GDataFileSystem::GetUploadUrlForDirectory(
const FilePath& destination_directory) {
// Find directory element within the cached file system snapshot.
base::AutoLock lock(lock_);
- GDataEntry* entry = GetGDataEntryFromPath(destination_directory);
+ GDataEntry* entry = GetGDataEntryByPath(destination_directory);
GDataDirectory* dir = entry ? entry->AsGDataDirectory() : NULL;
return dir ? dir->upload_url() : GURL();
}
@@ -3138,7 +3141,7 @@ base::PlatformFileError GDataFileSystem::RemoveEntryFromGData(
base::AutoLock lock(lock_);
// Find directory element within the cached file system snapshot.
- GDataEntry* entry = GetGDataEntryFromPath(file_path);
+ GDataEntry* entry = GetGDataEntryByPath(file_path);
if (!entry)
return base::PLATFORM_FILE_ERROR_NOT_FOUND;
@@ -3175,7 +3178,7 @@ void GDataFileSystem::AddUploadedFile(const FilePath& virtual_dir_path,
std::string md5;
{
base::AutoLock lock(lock_);
- GDataEntry* dir_entry = GetGDataEntryFromPath(virtual_dir_path);
+ GDataEntry* dir_entry = GetGDataEntryByPath(virtual_dir_path);
if (!dir_entry)
return;
@@ -3259,10 +3262,12 @@ FilePath GDataFileSystem::GetCacheFilePath(
return cache_paths_[sub_dir_type].Append(base_name);
}
-void GDataFileSystem::GetFromCache(const std::string& resource_id,
- const std::string& md5,
- const GetFromCacheCallback& callback) {
- GetFromCacheInternal(resource_id, md5, FilePath(), callback);
+void GDataFileSystem::GetFileFromCacheByResourceIdAndMd5(
+ const std::string& resource_id,
+ const std::string& md5,
+ const GetFileFromCacheCallback& callback) {
+ GetFileFromCacheByResourceIdAndMd5Internal(
+ resource_id, md5, FilePath(), callback);
}
void GDataFileSystem::StoreToCache(const std::string& resource_id,
@@ -3339,9 +3344,10 @@ void GDataFileSystem::Unpin(const std::string& resource_id,
callback));
}
-void GDataFileSystem::MarkDirtyInCache(const std::string& resource_id,
- const std::string& md5,
- const GetFromCacheCallback& callback) {
+void GDataFileSystem::MarkDirtyInCache(
+ const std::string& resource_id,
+ const std::string& md5,
+ const GetFileFromCacheCallback& callback) {
InitializeCacheIfNecessary();
base::PlatformFileError* error =
@@ -3357,7 +3363,7 @@ void GDataFileSystem::MarkDirtyInCache(const std::string& resource_id,
FILE_OPERATION_MOVE,
error,
cache_file_path),
- base::Bind(&RunGetFromCacheCallbackHelper,
+ base::Bind(&RunGetFileFromCacheCallbackHelper,
callback,
base::Owned(error),
resource_id,
@@ -3479,7 +3485,7 @@ void GDataFileSystem::InitializeCacheOnIOThreadPool() {
NotifyCacheInitialized();
}
-void GDataFileSystem::GetFromCacheOnIOThreadPool(
+void GDataFileSystem::GetFileFromCacheOnIOThreadPool(
const std::string& resource_id,
const std::string& md5,
const FilePath& gdata_file_path,
@@ -4260,11 +4266,11 @@ void GDataFileSystem::ScanCacheDirectory(
}
}
-void GDataFileSystem::GetFromCacheInternal(
+void GDataFileSystem::GetFileFromCacheByResourceIdAndMd5Internal(
const std::string& resource_id,
const std::string& md5,
const FilePath& gdata_file_path,
- const GetFromCacheCallback& callback) {
+ const GetFileFromCacheCallback& callback) {
InitializeCacheIfNecessary();
base::PlatformFileError* error =
@@ -4273,14 +4279,14 @@ void GDataFileSystem::GetFromCacheInternal(
PostBlockingPoolSequencedTaskAndReply(
kGDataFileSystemToken,
FROM_HERE,
- base::Bind(&GDataFileSystem::GetFromCacheOnIOThreadPool,
+ base::Bind(&GDataFileSystem::GetFileFromCacheOnIOThreadPool,
base::Unretained(this),
resource_id,
md5,
gdata_file_path,
error,
cache_file_path),
- base::Bind(&RunGetFromCacheCallbackHelper,
+ base::Bind(&RunGetFileFromCacheCallbackHelper,
callback,
base::Owned(error),
resource_id,
diff --git a/chrome/browser/chromeos/gdata/gdata_file_system.h b/chrome/browser/chromeos/gdata/gdata_file_system.h
index e569ca8..1bccaf8 100644
--- a/chrome/browser/chromeos/gdata/gdata_file_system.h
+++ b/chrome/browser/chromeos/gdata/gdata_file_system.h
@@ -52,13 +52,13 @@ typedef base::Callback<void(base::PlatformFileError error,
const std::string& resource_id,
const std::string& md5)> CacheOperationCallback;
-// Callback for GetFromCache.
+// Callback for GetFileFromCache.
typedef base::Callback<void(base::PlatformFileError error,
const std::string& resource_id,
const std::string& md5,
const FilePath& gdata_file_path,
const FilePath& cache_file_path)>
- GetFromCacheCallback;
+ GetFileFromCacheCallback;
// Used to get result of file search. Please note that |file| is a live
// object provided to this callback under lock. It must not be used outside
@@ -316,23 +316,24 @@ class GDataFileSystemInterface {
// will be downloaded through gdata api.
//
// Can be called from UI/IO thread. |callback| is run on the calling thread.
- virtual void GetFile(const FilePath& file_path,
- const GetFileCallback& callback) = 0;
+ virtual void GetFileByPath(const FilePath& file_path,
+ const GetFileCallback& callback) = 0;
- // Gets a file for the given |resource_id| from the gdata server. Used for
+ // Gets a file by the given |resource_id| from the gdata server. Used for
// fetching pinned-but-not-fetched files.
//
// Can be called from UI/IO thread. |callback| is run on the calling thread.
- virtual void GetFileForResourceId(
+ virtual void GetFileByResourceId(
const std::string& resource_id,
const GetFileCallback& callback) = 0;
- // Gets absolute path of cache file corresponding to |gdata_file_path|.
+ // Gets a file pointed by |gdata_file_path| from the cache.
// Upon completion, |callback| is invoked on the same thread where this method
// was called, with path if it exists and is accessible or empty FilePath
// otherwise.
- virtual void GetFromCacheForPath(const FilePath& gdata_file_path,
- const GetFromCacheCallback& callback) = 0;
+ virtual void GetFileFromCacheByPath(
+ const FilePath& gdata_file_path,
+ const GetFileFromCacheCallback& callback) = 0;
// Obtains the list of currently active operations.
virtual std::vector<GDataOperationRegistry::ProgressStatus>
@@ -360,10 +361,10 @@ class GDataFileSystemInterface {
const std::string& md5,
const GetCacheStateCallback& callback) = 0;
- // Finds file object by |file_path| and returns its key |properties|.
- // Returns true if file was found.
- virtual bool GetFileInfoFromPath(const FilePath& gdata_file_path,
- GDataFileProperties* properties) = 0;
+ // Finds a file (not a directory) by |file_path| and returns its key
+ // |properties|. Returns true if file was found.
+ virtual bool GetFileInfoByPath(const FilePath& gdata_file_path,
+ GDataFileProperties* properties) = 0;
// Returns the tmp sub-directory under gdata cache directory, i.e.
// <user_profile_dir>/GCache/v1/tmp
@@ -446,14 +447,14 @@ class GDataFileSystem : public GDataFileSystemInterface,
bool is_exclusive,
bool is_recursive,
const FileOperationCallback& callback) OVERRIDE;
- virtual void GetFile(const FilePath& file_path,
- const GetFileCallback& callback) OVERRIDE;
- virtual void GetFileForResourceId(
+ virtual void GetFileByPath(const FilePath& file_path,
+ const GetFileCallback& callback) OVERRIDE;
+ virtual void GetFileByResourceId(
const std::string& resource_id,
const GetFileCallback& callback) OVERRIDE;
- virtual void GetFromCacheForPath(
+ virtual void GetFileFromCacheByPath(
const FilePath& gdata_file_path,
- const GetFromCacheCallback& callback) OVERRIDE;
+ const GetFileFromCacheCallback& callback) OVERRIDE;
virtual std::vector<GDataOperationRegistry::ProgressStatus>
GetProgressStatusList() OVERRIDE;
virtual bool CancelOperation(const FilePath& file_path) OVERRIDE;
@@ -464,8 +465,8 @@ class GDataFileSystem : public GDataFileSystemInterface,
virtual void GetCacheState(const std::string& resource_id,
const std::string& md5,
const GetCacheStateCallback& callback) OVERRIDE;
- virtual bool GetFileInfoFromPath(const FilePath& gdata_file_path,
- GDataFileProperties* properties) OVERRIDE;
+ virtual bool GetFileInfoByPath(const FilePath& gdata_file_path,
+ GDataFileProperties* properties) OVERRIDE;
virtual FilePath GetGDataCacheTmpDirectory() const OVERRIDE;
virtual FilePath GetGDataTempDownloadFolderPath() const OVERRIDE;
virtual FilePath GetGDataTempDocumentFolderPath() const OVERRIDE;
@@ -508,9 +509,9 @@ class GDataFileSystem : public GDataFileSystemInterface,
FRIEND_TEST_ALL_PREFIXES(GDataFileSystemTest,
FindFirstMissingParentDirectory);
FRIEND_TEST_ALL_PREFIXES(GDataFileSystemTest,
- GetGDataEntryFromPath);
+ GetGDataEntryByPath);
FRIEND_TEST_ALL_PREFIXES(GDataFileSystemTest,
- GetFromCacheForPath);
+ GetFileFromCacheByPath);
FRIEND_TEST_ALL_PREFIXES(GDataFileSystemTest,
GetAvailableSpace);
@@ -542,7 +543,7 @@ class GDataFileSystem : public GDataFileSystemInterface,
};
// Defines set of parameters passed to intermediate callbacks during
- // execution of GetFile() method.
+ // execution of GetFileByPath() method.
struct GetFileFromCacheParams {
GetFileFromCacheParams(const FilePath& virtual_file_path,
const FilePath& local_tmp_path,
@@ -602,7 +603,7 @@ class GDataFileSystem : public GDataFileSystemInterface,
// Finds entry object by |file_path| and returns the entry object.
// Returns NULL if it does not find the entry.
- GDataEntry* GetGDataEntryFromPath(const FilePath& file_path);
+ GDataEntry* GetGDataEntryByPath(const FilePath& file_path);
// Inits cache directory paths in the provided root.
// Should be called before cache is initialized.
@@ -677,9 +678,9 @@ class GDataFileSystem : public GDataFileSystemInterface,
const FilePath& remote_dest_file_path,
const FileOperationCallback& callback);
- // Invoked upon completion of GetFile initiated by Copy. If GetFile
- // reports no error, calls TransferRegularFile to transfer |local_file_path|
- // to |remote_dest_file_path|.
+ // Invoked upon completion of GetFileByPath initiated by Copy. If
+ // GetFileByPath reports no error, calls TransferRegularFile to transfer
+ // |local_file_path| to |remote_dest_file_path|.
//
// Can be called from UI/IO thread. |callback| is run on the calling thread.
void OnGetFileCompleteForCopy(const FilePath& remote_dest_file_path,
@@ -983,9 +984,10 @@ class GDataFileSystem : public GDataFileSystemInterface,
// Upon completion, |callback| is invoked on the thread where this method was
// called, with the cache file path if it exists or empty otherwise.
// otherwise.
- void GetFromCache(const std::string& resource_id,
- const std::string& md5,
- const GetFromCacheCallback& callback);
+ void GetFileFromCacheByResourceIdAndMd5(
+ const std::string& resource_id,
+ const std::string& md5,
+ const GetFileFromCacheCallback& callback);
// Stores |source_path| corresponding to |resource_id| and |md5| to cache.
// |file_operation_type| specifies if |source_path| is to be moved or copied.
@@ -1049,7 +1051,7 @@ class GDataFileSystem : public GDataFileSystemInterface,
// called, with the absolute path of the dirty file.
void MarkDirtyInCache(const std::string& resource_id,
const std::string& md5,
- const GetFromCacheCallback& callback);
+ const GetFileFromCacheCallback& callback);
// Commit dirty the file corresponding to |resource_id| and |md5|.
// Must be called after MarkDirtyInCache to indicate that file modification
@@ -1109,13 +1111,13 @@ class GDataFileSystem : public GDataFileSystemInterface,
// info into cache map.
void InitializeCacheOnIOThreadPool();
- // Task posted from GetFromCacheInternal to run on IO thread pool.
+ // Task posted from GetFileFromCacheInternal to run on IO thread pool.
// Checks if file corresponding to |resource_id| and |md5| exists in cache
// map.
// Even though this task doesn't involve IO operations, it still runs on the
// IO thread pool, to force synchronization of all tasks on IO thread pool,
// e.g. this absolute must execute after InitailizeCacheOnIOTheadPool.
- void GetFromCacheOnIOThreadPool(
+ void GetFileFromCacheOnIOThreadPool(
const std::string& resource_id,
const std::string& md5,
const FilePath& gdata_file_path,
@@ -1222,8 +1224,9 @@ class GDataFileSystem : public GDataFileSystemInterface,
const std::string& md5,
const CacheOperationCallback& callback);
- // Helper function for internally handling responses from GetFromCache()
- // calls during processing of GetFile() request.
+ // Helper function for internally handling responses from
+ // GetFileFromCacheByResourceIdAndMd5() calls during processing of
+ // GetFile() request.
void OnGetFileFromCache(const GetFileFromCacheParams& params,
base::PlatformFileError error,
const std::string& resource_id,
@@ -1258,11 +1261,13 @@ class GDataFileSystem : public GDataFileSystemInterface,
GDataRootDirectory::CacheSubDirectoryType sub_dir_type,
GDataRootDirectory::CacheMap* cache_map);
- // Called from GetFromCache and GetFromCacheForPath.
- void GetFromCacheInternal(const std::string& resource_id,
- const std::string& md5,
- const FilePath& gdata_file_path,
- const GetFromCacheCallback& callback);
+ // Called from GetFileFromCacheByResourceIdAndMd5() and
+ // GetFileFromCacheByPath().
+ void GetFileFromCacheByResourceIdAndMd5Internal(
+ const std::string& resource_id,
+ const std::string& md5,
+ const FilePath& gdata_file_path,
+ const GetFileFromCacheCallback& callback);
// Wrapper task around any sequenced task that runs on IO thread pool that
// makes sure |in_shutdown_| and |on_io_completed_| are handled properly in
@@ -1347,7 +1352,7 @@ class GDataFileSystem : public GDataFileSystemInterface,
ObserverList<Observer> observers_;
};
-// The minimum free space to keep. GDataFileSystem::GetFile() returns
+// The minimum free space to keep. GDataFileSystem::GetFileByPath() returns
// base::PLATFORM_FILE_ERROR_NO_SPACE if the available space is smaller than
// this value.
//
diff --git a/chrome/browser/chromeos/gdata/gdata_file_system_proxy.cc b/chrome/browser/chromeos/gdata/gdata_file_system_proxy.cc
index 95d10364..583ee1e 100644
--- a/chrome/browser/chromeos/gdata/gdata_file_system_proxy.cc
+++ b/chrome/browser/chromeos/gdata/gdata_file_system_proxy.cc
@@ -197,7 +197,7 @@ void GDataFileSystemProxy::CreateSnapshotFile(
base::PlatformFileInfo file_info;
GDataFileProperties file_properties;
if (!ValidateUrl(file_url, &file_path) ||
- !file_system_->GetFileInfoFromPath(file_path, &file_properties)) {
+ !file_system_->GetFileInfoByPath(file_path, &file_properties)) {
MessageLoopProxy::current()->PostTask(FROM_HERE,
base::Bind(callback,
base::PLATFORM_FILE_ERROR_NOT_FOUND,
@@ -207,10 +207,10 @@ void GDataFileSystemProxy::CreateSnapshotFile(
return;
}
- file_system_->GetFile(file_path,
- base::Bind(&CallSnapshotFileCallback,
- callback,
- file_properties.file_info));
+ file_system_->GetFileByPath(file_path,
+ base::Bind(&CallSnapshotFileCallback,
+ callback,
+ file_properties.file_info));
}
// static.
diff --git a/chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc b/chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc
index 211a6a9..d694b59 100644
--- a/chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc
+++ b/chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc
@@ -349,26 +349,27 @@ class GDataFileSystemTest : public testing::Test {
RunAllPendingForIO();
}
- void TestGetFromCache(const std::string& resource_id,
- const std::string& md5,
- base::PlatformFileError expected_error,
- const std::string& expected_file_extension) {
+ void TestGetFileFromCacheByResourceIdAndMd5(
+ const std::string& resource_id,
+ const std::string& md5,
+ base::PlatformFileError expected_error,
+ const std::string& expected_file_extension) {
expected_error_ = expected_error;
expected_file_extension_ = expected_file_extension;
- file_system_->GetFromCache(resource_id, md5,
+ file_system_->GetFileFromCacheByResourceIdAndMd5(resource_id, md5,
base::Bind(&GDataFileSystemTest::VerifyGetFromCache,
base::Unretained(this)));
RunAllPendingForIO();
}
- void TestGetFromCacheForPath(const FilePath& gdata_file_path,
- base::PlatformFileError expected_error) {
+ void TestGetFileFromCacheByPath(const FilePath& gdata_file_path,
+ base::PlatformFileError expected_error) {
expected_error_ = expected_error;
expected_file_extension_.clear();
- file_system_->GetFromCacheForPath(gdata_file_path,
+ file_system_->GetFileFromCacheByPath(gdata_file_path,
base::Bind(&GDataFileSystemTest::VerifyGetFromCache,
base::Unretained(this)));
@@ -706,11 +707,13 @@ class GDataFileSystemTest : public testing::Test {
const struct InitialCacheResource& resource = initial_cache_resources[i];
// Check cache file.
num_callback_invocations_ = 0;
- TestGetFromCache(resource.resource_id, resource.md5,
- GDataFile::IsCachePresent(resource.cache_state) ?
- base::PLATFORM_FILE_OK :
- base::PLATFORM_FILE_ERROR_NOT_FOUND,
- resource.expected_file_extension);
+ TestGetFileFromCacheByResourceIdAndMd5(
+ resource.resource_id,
+ resource.md5,
+ GDataFile::IsCachePresent(resource.cache_state) ?
+ base::PLATFORM_FILE_OK :
+ base::PLATFORM_FILE_ERROR_NOT_FOUND,
+ resource.expected_file_extension);
EXPECT_EQ(1, num_callback_invocations_);
// Verify cache state.
@@ -2038,21 +2041,23 @@ TEST_F(GDataFileSystemTest, GetFromCacheSimple) {
// Then try to get the existing file from cache.
num_callback_invocations_ = 0;
- TestGetFromCache(resource_id, md5, base::PLATFORM_FILE_OK, md5);
+ TestGetFileFromCacheByResourceIdAndMd5(
+ resource_id, md5, base::PLATFORM_FILE_OK, md5);
EXPECT_EQ(1, num_callback_invocations_);
// Get file from cache with same resource id as existing file but different
// md5.
num_callback_invocations_ = 0;
- TestGetFromCache(resource_id, "9999", base::PLATFORM_FILE_ERROR_NOT_FOUND,
- md5);
+ TestGetFileFromCacheByResourceIdAndMd5(
+ resource_id, "9999", base::PLATFORM_FILE_ERROR_NOT_FOUND, md5);
EXPECT_EQ(1, num_callback_invocations_);
// Get file from cache with different resource id from existing file but same
// md5.
num_callback_invocations_ = 0;
resource_id = "document:1a2b";
- TestGetFromCache(resource_id, md5, base::PLATFORM_FILE_ERROR_NOT_FOUND, md5);
+ TestGetFileFromCacheByResourceIdAndMd5(
+ resource_id, md5, base::PLATFORM_FILE_ERROR_NOT_FOUND, md5);
EXPECT_EQ(1, num_callback_invocations_);
}
@@ -2196,7 +2201,8 @@ TEST_F(GDataFileSystemTest, GetFromCachePinned) {
// Get the non-existent pinned file from cache.
num_callback_invocations_ = 0;
- TestGetFromCache(resource_id, md5, base::PLATFORM_FILE_ERROR_NOT_FOUND, md5);
+ TestGetFileFromCacheByResourceIdAndMd5(
+ resource_id, md5, base::PLATFORM_FILE_ERROR_NOT_FOUND, md5);
EXPECT_EQ(1, num_callback_invocations_);
// Store an existing file to the previously pinned non-existent file.
@@ -2208,7 +2214,8 @@ TEST_F(GDataFileSystemTest, GetFromCachePinned) {
// Get the previously pinned and stored file from cache.
num_callback_invocations_ = 0;
- TestGetFromCache(resource_id, md5, base::PLATFORM_FILE_OK, md5);
+ TestGetFileFromCacheByResourceIdAndMd5(
+ resource_id, md5, base::PLATFORM_FILE_OK, md5);
EXPECT_EQ(1, num_callback_invocations_);
}
@@ -2601,24 +2608,24 @@ TEST_F(GDataFileSystemTest, InitializeCache) {
TestInitializeCache();
}
-TEST_F(GDataFileSystemTest, GetGDataEntryFromPath) {
+TEST_F(GDataFileSystemTest, GetGDataEntryByPath) {
LoadRootFeedDocument("root_feed.json");
- // Lock to call GetGDataEntryFromPath.
+ // Lock to call GetGDataEntryByPath.
base::AutoLock lock(file_system_->lock_);
- GDataEntry* entry = file_system_->GetGDataEntryFromPath(
+ GDataEntry* entry = file_system_->GetGDataEntryByPath(
FilePath(FILE_PATH_LITERAL("gdata/File 1.txt")));
ASSERT_TRUE(entry != NULL);
EXPECT_EQ("https://file1_link_self/file:2_file_resource_id",
entry->edit_url().spec());
EXPECT_EQ("https://file_content_url/", entry->content_url().spec());
- GDataEntry* non_existent = file_system_->GetGDataEntryFromPath(
+ GDataEntry* non_existent = file_system_->GetGDataEntryByPath(
FilePath(FILE_PATH_LITERAL("gdata/Nonexistent.txt")));
ASSERT_TRUE(non_existent == NULL);
}
-TEST_F(GDataFileSystemTest, GetFromCacheForPath) {
+TEST_F(GDataFileSystemTest, GetFileFromCacheByPath) {
EXPECT_CALL(*mock_sync_client_, OnCacheInitialized()).Times(1);
LoadRootFeedDocument("root_feed.json");
@@ -2626,10 +2633,10 @@ TEST_F(GDataFileSystemTest, GetFromCacheForPath) {
// First make sure the file exists in GData.
FilePath gdata_file_path = FilePath(FILE_PATH_LITERAL("gdata/File 1.txt"));
GDataFile* file = NULL;
- { // Lock to call GetGDataEntryFromPath.
+ { // Lock to call GetGDataEntryByPath.
base::AutoLock lock(file_system_->lock_);
GDataEntry* entry =
- file_system_->GetGDataEntryFromPath(gdata_file_path);
+ file_system_->GetGDataEntryByPath(gdata_file_path);
ASSERT_TRUE(entry != NULL);
file = entry->AsGDataFile();
ASSERT_TRUE(file != NULL);
@@ -2637,7 +2644,8 @@ TEST_F(GDataFileSystemTest, GetFromCacheForPath) {
// A file that exists in GData but not in cache.
num_callback_invocations_ = 0;
- TestGetFromCacheForPath(gdata_file_path, base::PLATFORM_FILE_ERROR_NOT_FOUND);
+ TestGetFileFromCacheByPath(
+ gdata_file_path, base::PLATFORM_FILE_ERROR_NOT_FOUND);
EXPECT_EQ(1, num_callback_invocations_);
// Store a file corresponding to resource and md5 of "gdata/File 1.txt" to
@@ -2651,13 +2659,14 @@ TEST_F(GDataFileSystemTest, GetFromCacheForPath) {
// Now the file should exist in cache.
num_callback_invocations_ = 0;
- TestGetFromCacheForPath(gdata_file_path, base::PLATFORM_FILE_OK);
+ TestGetFileFromCacheByPath(gdata_file_path, base::PLATFORM_FILE_OK);
EXPECT_EQ(1, num_callback_invocations_);
// A file that doesn't exist in gdata.
num_callback_invocations_ = 0;
- TestGetFromCacheForPath(FilePath(FILE_PATH_LITERAL("gdata/Nonexistent.txt")),
- base::PLATFORM_FILE_ERROR_NOT_FOUND);
+ TestGetFileFromCacheByPath(
+ FilePath(FILE_PATH_LITERAL("gdata/Nonexistent.txt")),
+ base::PLATFORM_FILE_ERROR_NOT_FOUND);
EXPECT_EQ(1, num_callback_invocations_);
}
@@ -2681,7 +2690,7 @@ TEST_F(GDataFileSystemTest, CreateDirectoryWithService) {
// EXPECT_EQ(base::PLATFORM_FILE_OK, callback_helper_->last_error_);
}
-TEST_F(GDataFileSystemTest, GetFile_FromGData_EnoughSpace) {
+TEST_F(GDataFileSystemTest, GetFileByPath_FromGData_EnoughSpace) {
EXPECT_CALL(*mock_sync_client_, OnCacheInitialized()).Times(1);
LoadRootFeedDocument("root_feed.json");
@@ -2708,7 +2717,7 @@ TEST_F(GDataFileSystemTest, GetFile_FromGData_EnoughSpace) {
_))
.Times(1);
- file_system_->GetFile(file_in_root, callback);
+ file_system_->GetFileByPath(file_in_root, callback);
RunAllPendingForIO(); // Try to get from the cache.
RunAllPendingForIO(); // Check if we have space before downloading.
RunAllPendingForIO(); // Check if we have space after downloading.
@@ -2719,7 +2728,7 @@ TEST_F(GDataFileSystemTest, GetFile_FromGData_EnoughSpace) {
callback_helper_->download_path_.value());
}
-TEST_F(GDataFileSystemTest, GetFile_FromGData_NoSpaceAtAll) {
+TEST_F(GDataFileSystemTest, GetFileByPath_FromGData_NoSpaceAtAll) {
EXPECT_CALL(*mock_sync_client_, OnCacheInitialized()).Times(1);
LoadRootFeedDocument("root_feed.json");
@@ -2746,7 +2755,7 @@ TEST_F(GDataFileSystemTest, GetFile_FromGData_NoSpaceAtAll) {
_))
.Times(0);
- file_system_->GetFile(file_in_root, callback);
+ file_system_->GetFileByPath(file_in_root, callback);
RunAllPendingForIO(); // Try to get from the cache.
RunAllPendingForIO(); // Check if we have space before downloading.
@@ -2754,7 +2763,7 @@ TEST_F(GDataFileSystemTest, GetFile_FromGData_NoSpaceAtAll) {
callback_helper_->last_error_);
}
-TEST_F(GDataFileSystemTest, GetFile_FromGData_NoEnoughSpaceButCanFreeUp) {
+TEST_F(GDataFileSystemTest, GetFileByPath_FromGData_NoEnoughSpaceButCanFreeUp) {
EXPECT_CALL(*mock_sync_client_, OnCacheInitialized()).Times(1);
LoadRootFeedDocument("root_feed.json");
@@ -2796,7 +2805,7 @@ TEST_F(GDataFileSystemTest, GetFile_FromGData_NoEnoughSpaceButCanFreeUp) {
_))
.Times(1);
- file_system_->GetFile(file_in_root, callback);
+ file_system_->GetFileByPath(file_in_root, callback);
RunAllPendingForIO(); // Try to get from the cache.
RunAllPendingForIO(); // Check if we have space before downloading.
RunAllPendingForIO(); // Check if we have space after downloading
@@ -2812,7 +2821,7 @@ TEST_F(GDataFileSystemTest, GetFile_FromGData_NoEnoughSpaceButCanFreeUp) {
ASSERT_FALSE(CacheFileExists("<resource_id>", "<md5>"));
}
-TEST_F(GDataFileSystemTest, GetFile_FromGData_EnoughSpaceButBecomeFull) {
+TEST_F(GDataFileSystemTest, GetFileByPath_FromGData_EnoughSpaceButBecomeFull) {
EXPECT_CALL(*mock_sync_client_, OnCacheInitialized()).Times(1);
LoadRootFeedDocument("root_feed.json");
@@ -2844,7 +2853,7 @@ TEST_F(GDataFileSystemTest, GetFile_FromGData_EnoughSpaceButBecomeFull) {
_))
.Times(1);
- file_system_->GetFile(file_in_root, callback);
+ file_system_->GetFileByPath(file_in_root, callback);
RunAllPendingForIO(); // Try to get from the cache.
RunAllPendingForIO(); // Check if we have space before downloading.
RunAllPendingForIO(); // Check if we have space after downloading.
@@ -2853,7 +2862,7 @@ TEST_F(GDataFileSystemTest, GetFile_FromGData_EnoughSpaceButBecomeFull) {
callback_helper_->last_error_);
}
-TEST_F(GDataFileSystemTest, GetFile_FromCache) {
+TEST_F(GDataFileSystemTest, GetFileByPath_FromCache) {
EXPECT_CALL(*mock_sync_client_, OnCacheInitialized()).Times(1);
LoadRootFeedDocument("root_feed.json");
@@ -2883,7 +2892,7 @@ TEST_F(GDataFileSystemTest, GetFile_FromCache) {
_))
.Times(0);
- file_system_->GetFile(file_in_root, callback);
+ file_system_->GetFileByPath(file_in_root, callback);
RunAllPendingForIO();
EXPECT_EQ(REGULAR_FILE, callback_helper_->file_type_);
@@ -2891,7 +2900,7 @@ TEST_F(GDataFileSystemTest, GetFile_FromCache) {
callback_helper_->download_path_.value());
}
-TEST_F(GDataFileSystemTest, GetFile_HostedDocument) {
+TEST_F(GDataFileSystemTest, GetFileByPath_HostedDocument) {
EXPECT_CALL(*mock_sync_client_, OnCacheInitialized()).Times(1);
LoadRootFeedDocument("root_feed.json");
@@ -2904,7 +2913,7 @@ TEST_F(GDataFileSystemTest, GetFile_HostedDocument) {
GDataEntry* entry = NULL;
EXPECT_TRUE((entry = FindEntry(file_in_root)) != NULL);
- file_system_->GetFile(file_in_root, callback);
+ file_system_->GetFileByPath(file_in_root, callback);
RunAllPendingForIO();
EXPECT_EQ(HOSTED_DOCUMENT, callback_helper_->file_type_);
@@ -2927,7 +2936,7 @@ TEST_F(GDataFileSystemTest, GetFile_HostedDocument) {
EXPECT_EQ(entry->resource_id(), resource_id);
}
-TEST_F(GDataFileSystemTest, GetFileForResourceId) {
+TEST_F(GDataFileSystemTest, GetFileByResourceId) {
EXPECT_CALL(*mock_sync_client_, OnCacheInitialized()).Times(1);
EXPECT_CALL(*mock_free_disk_space_checker_, AmountOfFreeDiskSpace())
.Times(AtLeast(1)).WillRepeatedly(Return(kLotsOfSpace));
@@ -2952,7 +2961,7 @@ TEST_F(GDataFileSystemTest, GetFileForResourceId) {
_))
.Times(1);
- file_system_->GetFileForResourceId(file->resource_id(),
+ file_system_->GetFileByResourceId(file->resource_id(),
callback);
RunAllPendingForIO(); // Try to get from the cache.
RunAllPendingForIO(); // Check if we have space before downloading.
@@ -2963,7 +2972,7 @@ TEST_F(GDataFileSystemTest, GetFileForResourceId) {
callback_helper_->download_path_.value());
}
-TEST_F(GDataFileSystemTest, GetFileForResourceId_FromCache) {
+TEST_F(GDataFileSystemTest, GetFileByResourceId_FromCache) {
EXPECT_CALL(*mock_sync_client_, OnCacheInitialized()).Times(1);
LoadRootFeedDocument("root_feed.json");
@@ -2990,8 +2999,8 @@ TEST_F(GDataFileSystemTest, GetFileForResourceId_FromCache) {
EXPECT_CALL(*mock_doc_service_, DownloadFile(_, _, _, _))
.Times(0);
- file_system_->GetFileForResourceId(file->resource_id(),
- callback);
+ file_system_->GetFileByResourceId(file->resource_id(),
+ callback);
RunAllPendingForIO();
EXPECT_EQ(REGULAR_FILE, callback_helper_->file_type_);
diff --git a/chrome/browser/chromeos/gdata/gdata_protocol_handler.cc b/chrome/browser/chromeos/gdata/gdata_protocol_handler.cc
index c8a36f5..34432cd 100644
--- a/chrome/browser/chromeos/gdata/gdata_protocol_handler.cc
+++ b/chrome/browser/chromeos/gdata/gdata_protocol_handler.cc
@@ -150,11 +150,11 @@ class GDataURLRequestJob : public net::URLRequestJob {
void StartAsync(GDataFileSystem** file_system);
// Helper callback for handling async responses from
- // GDataFileSystem::GetFileForResourceId().
- void OnGetFileForResourceId(base::PlatformFileError error,
- const FilePath& local_file_path,
- const std::string& mime_type,
- GDataFileType file_type);
+ // GDataFileSystem::GetFileByResourceId().
+ void OnGetFileByResourceId(base::PlatformFileError error,
+ const FilePath& local_file_path,
+ const std::string& mime_type,
+ GDataFileType file_type);
// Helper callback for GetFileSizeOnIOThreadPool that sets |remaining_bytes_|
// to |file_size|, and notifies result for Start().
@@ -261,7 +261,7 @@ void GDataURLRequestJob::Kill() {
CloseFileStream();
// If download operation for gdata file (via
- // GDataFileSystem::GetFileForResourceId) is still in progress (i.e.
+ // GDataFileSystem::GetFileByResourceId) is still in progress (i.e.
// |local_file_path_| is still empty), cancel it by posting a task on the UI
// thread.
if (file_system_ && !gdata_file_path_.empty() && local_file_path_.empty()) {
@@ -422,13 +422,13 @@ void GDataURLRequestJob::StartAsync(GDataFileSystem** file_system) {
mime_type_ = delegate.mime_type();
gdata_file_path_ = delegate.gdata_file_path();
- file_system_->GetFileForResourceId(
+ file_system_->GetFileByResourceId(
resource_id,
- base::Bind(&GDataURLRequestJob::OnGetFileForResourceId,
+ base::Bind(&GDataURLRequestJob::OnGetFileByResourceId,
weak_factory_.GetWeakPtr()));
}
-void GDataURLRequestJob::OnGetFileForResourceId(
+void GDataURLRequestJob::OnGetFileByResourceId(
base::PlatformFileError error,
const FilePath& local_file_path,
const std::string& mime_type,
diff --git a/chrome/browser/chromeos/gdata/gdata_sync_client.cc b/chrome/browser/chromeos/gdata/gdata_sync_client.cc
index 2827090..5906320 100644
--- a/chrome/browser/chromeos/gdata/gdata_sync_client.cc
+++ b/chrome/browser/chromeos/gdata/gdata_sync_client.cc
@@ -134,7 +134,7 @@ void GDataSyncClient::DoFetchLoop() {
queue_.pop_front();
DVLOG(1) << "Fetching " << resource_id;
- file_system_->GetFileForResourceId(
+ file_system_->GetFileByResourceId(
resource_id,
base::Bind(&GDataSyncClient::OnFetchFileComplete,
weak_ptr_factory_.GetWeakPtr(),
diff --git a/chrome/browser/chromeos/gdata/gdata_sync_client_unittest.cc b/chrome/browser/chromeos/gdata/gdata_sync_client_unittest.cc
index 5e7e4a0..8714926 100644
--- a/chrome/browser/chromeos/gdata/gdata_sync_client_unittest.cc
+++ b/chrome/browser/chromeos/gdata/gdata_sync_client_unittest.cc
@@ -139,8 +139,8 @@ class GDataSyncClientTest : public testing::Test {
scoped_ptr<chromeos::Network> active_network_;
};
-// Action used to set mock expectations for GetFileForResourceId().
-ACTION_P4(MockGetFileForResourceId, error, local_path, mime_type, file_type) {
+// Action used to set mock expectations for GetFileByResourceId().
+ACTION_P4(MockGetFileByResourceId, error, local_path, mime_type, file_type) {
arg1.Run(error, local_path, mime_type, file_type);
}
@@ -179,25 +179,25 @@ TEST_F(GDataSyncClientTest, StartFetchLoop) {
sync_client_->AddResourceIdForTesting("resource_id_not_fetched_bar");
sync_client_->AddResourceIdForTesting("resource_id_not_fetched_baz");
- // The three files will be fetched by GetFileForResourceId(), once
+ // The three files will be fetched by GetFileByResourceId(), once
// StartFetchLoop() starts.
EXPECT_CALL(*mock_file_system_,
- GetFileForResourceId("resource_id_not_fetched_foo", _))
- .WillOnce(MockGetFileForResourceId(
+ GetFileByResourceId("resource_id_not_fetched_foo", _))
+ .WillOnce(MockGetFileByResourceId(
base::PLATFORM_FILE_OK,
FilePath::FromUTF8Unsafe("local_path_does_not_matter"),
std::string("mime_type_does_not_matter"),
REGULAR_FILE));
EXPECT_CALL(*mock_file_system_,
- GetFileForResourceId("resource_id_not_fetched_bar", _))
- .WillOnce(MockGetFileForResourceId(
+ GetFileByResourceId("resource_id_not_fetched_bar", _))
+ .WillOnce(MockGetFileByResourceId(
base::PLATFORM_FILE_OK,
FilePath::FromUTF8Unsafe("local_path_does_not_matter"),
std::string("mime_type_does_not_matter"),
REGULAR_FILE));
EXPECT_CALL(*mock_file_system_,
- GetFileForResourceId("resource_id_not_fetched_baz", _))
- .WillOnce(MockGetFileForResourceId(
+ GetFileByResourceId("resource_id_not_fetched_baz", _))
+ .WillOnce(MockGetFileByResourceId(
base::PLATFORM_FILE_OK,
FilePath::FromUTF8Unsafe("local_path_does_not_matter"),
std::string("mime_type_does_not_matter"),
@@ -214,9 +214,9 @@ TEST_F(GDataSyncClientTest, StartFetchLoop_Offline) {
sync_client_->AddResourceIdForTesting("resource_id_not_fetched_bar");
sync_client_->AddResourceIdForTesting("resource_id_not_fetched_baz");
- // The three files will not be fetched by GetFileForResourceId(), as
+ // The three files will not be fetched by GetFileByResourceId(), as
// network is not connected.
- EXPECT_CALL(*mock_file_system_, GetFileForResourceId(_, _)).Times(0);
+ EXPECT_CALL(*mock_file_system_, GetFileByResourceId(_, _)).Times(0);
sync_client_->StartFetchLoop();
}
@@ -229,9 +229,9 @@ TEST_F(GDataSyncClientTest, StartFetchLoop_CelluarDisabled) {
sync_client_->AddResourceIdForTesting("resource_id_not_fetched_bar");
sync_client_->AddResourceIdForTesting("resource_id_not_fetched_baz");
- // The three files will not be fetched by GetFileForResourceId(), as
+ // The three files will not be fetched by GetFileByResourceId(), as
// fetching over cellular network is disabled by default.
- EXPECT_CALL(*mock_file_system_, GetFileForResourceId(_, _)).Times(0);
+ EXPECT_CALL(*mock_file_system_, GetFileByResourceId(_, _)).Times(0);
sync_client_->StartFetchLoop();
}
@@ -246,25 +246,25 @@ TEST_F(GDataSyncClientTest, StartFetchLoop_CelluarEnabled) {
sync_client_->AddResourceIdForTesting("resource_id_not_fetched_bar");
sync_client_->AddResourceIdForTesting("resource_id_not_fetched_baz");
- // The three files will be fetched by GetFileForResourceId(), as fetching
+ // The three files will be fetched by GetFileByResourceId(), as fetching
// over cellular network is explicitly enabled.
EXPECT_CALL(*mock_file_system_,
- GetFileForResourceId("resource_id_not_fetched_foo", _))
- .WillOnce(MockGetFileForResourceId(
+ GetFileByResourceId("resource_id_not_fetched_foo", _))
+ .WillOnce(MockGetFileByResourceId(
base::PLATFORM_FILE_OK,
FilePath::FromUTF8Unsafe("local_path_does_not_matter"),
std::string("mime_type_does_not_matter"),
REGULAR_FILE));
EXPECT_CALL(*mock_file_system_,
- GetFileForResourceId("resource_id_not_fetched_bar", _))
- .WillOnce(MockGetFileForResourceId(
+ GetFileByResourceId("resource_id_not_fetched_bar", _))
+ .WillOnce(MockGetFileByResourceId(
base::PLATFORM_FILE_OK,
FilePath::FromUTF8Unsafe("local_path_does_not_matter"),
std::string("mime_type_does_not_matter"),
REGULAR_FILE));
EXPECT_CALL(*mock_file_system_,
- GetFileForResourceId("resource_id_not_fetched_baz", _))
- .WillOnce(MockGetFileForResourceId(
+ GetFileByResourceId("resource_id_not_fetched_baz", _))
+ .WillOnce(MockGetFileByResourceId(
base::PLATFORM_FILE_OK,
FilePath::FromUTF8Unsafe("local_path_does_not_matter"),
std::string("mime_type_does_not_matter"),
@@ -284,9 +284,9 @@ TEST_F(GDataSyncClientTest, StartFetchLoop_GDataDisabled) {
sync_client_->AddResourceIdForTesting("resource_id_not_fetched_bar");
sync_client_->AddResourceIdForTesting("resource_id_not_fetched_baz");
- // The three files will not be fetched by GetFileForResourceId(), as the
+ // The three files will not be fetched by GetFileByResourceId(), as the
// GData feature is disabled.
- EXPECT_CALL(*mock_file_system_, GetFileForResourceId(_, _)).Times(0);
+ EXPECT_CALL(*mock_file_system_, GetFileByResourceId(_, _)).Times(0);
sync_client_->StartFetchLoop();
}
@@ -295,11 +295,11 @@ TEST_F(GDataSyncClientTest, OnFilePinned) {
SetUpTestFiles();
ConnectToWifi();
- // This file will be fetched by GetFileForResourceId() as OnFilePinned()
+ // This file will be fetched by GetFileByResourceId() as OnFilePinned()
// will kick off the fetch loop.
EXPECT_CALL(*mock_file_system_,
- GetFileForResourceId("resource_id_not_fetched_foo", _))
- .WillOnce(MockGetFileForResourceId(
+ GetFileByResourceId("resource_id_not_fetched_foo", _))
+ .WillOnce(MockGetFileByResourceId(
base::PLATFORM_FILE_OK,
FilePath::FromUTF8Unsafe("local_path_does_not_matter"),
std::string("mime_type_does_not_matter"),
diff --git a/chrome/browser/chromeos/gdata/gdata_util.cc b/chrome/browser/chromeos/gdata/gdata_util.cc
index 21b2129..c8d66a8 100644
--- a/chrome/browser/chromeos/gdata/gdata_util.cc
+++ b/chrome/browser/chromeos/gdata/gdata_util.cc
@@ -198,7 +198,7 @@ void InsertGDataCachePathsPermissions(
return;
GDataFileProperties file_properties;
- file_system->GetFileInfoFromPath(gdata_path, &file_properties);
+ file_system->GetFileInfoByPath(gdata_path, &file_properties);
std::string resource_id = file_properties.resource_id;
std::string file_md5 = file_properties.file_md5;
diff --git a/chrome/browser/chromeos/gdata/mock_gdata_file_system.h b/chrome/browser/chromeos/gdata/mock_gdata_file_system.h
index 4e58412..3442c6e5 100644
--- a/chrome/browser/chromeos/gdata/mock_gdata_file_system.h
+++ b/chrome/browser/chromeos/gdata/mock_gdata_file_system.h
@@ -46,14 +46,14 @@ class MockGDataFileSystem : public GDataFileSystemInterface {
bool is_exclusive,
bool is_recursive,
const FileOperationCallback& callback));
- MOCK_METHOD2(GetFile, void(const FilePath& file_path,
- const GetFileCallback& callback));
- MOCK_METHOD2(GetFileForResourceId,
+ MOCK_METHOD2(GetFileByPath, void(const FilePath& file_path,
+ const GetFileCallback& callback));
+ MOCK_METHOD2(GetFileByResourceId,
void(const std::string& resource_id,
const GetFileCallback& callback));
- MOCK_METHOD2(GetFromCacheForPath,
+ MOCK_METHOD2(GetFileFromCacheByPath,
void(const FilePath& gdata_file_path,
- const GetFromCacheCallback& callback));
+ const GetFileFromCacheCallback& callback));
MOCK_METHOD0(GetProgressStatusList,
std::vector<GDataOperationRegistry::ProgressStatus>());
MOCK_METHOD1(CancelOperation, bool(const FilePath& file_path));
@@ -64,8 +64,8 @@ class MockGDataFileSystem : public GDataFileSystemInterface {
MOCK_METHOD3(GetCacheState, void(const std::string& resource_id,
const std::string& md5,
const GetCacheStateCallback& callback));
- MOCK_METHOD2(GetFileInfoFromPath, bool(const FilePath& gdata_file_path,
- GDataFileProperties* properties));
+ MOCK_METHOD2(GetFileInfoByPath, bool(const FilePath& gdata_file_path,
+ GDataFileProperties* properties));
MOCK_CONST_METHOD0(GetGDataCacheTmpDirectory, FilePath());
MOCK_CONST_METHOD0(GetGDataTempDownloadFolderPath, FilePath());
MOCK_CONST_METHOD0(GetGDataTempDocumentFolderPath, FilePath());