diff options
author | kochi@chromium.org <kochi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-23 16:28:15 +0000 |
---|---|---|
committer | kochi@chromium.org <kochi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-23 16:28:15 +0000 |
commit | 11f60db5baba6b239972e6aa1866bbd252aca2e4 (patch) | |
tree | 57117dc44e75e6d0e25e9e3031387b42ea05e1f7 /chrome/browser/chromeos | |
parent | 0a1808bacff8883c5edd630e61883b715d89768f (diff) | |
download | chromium_src-11f60db5baba6b239972e6aa1866bbd252aca2e4.zip chromium_src-11f60db5baba6b239972e6aa1866bbd252aca2e4.tar.gz chromium_src-11f60db5baba6b239972e6aa1866bbd252aca2e4.tar.bz2 |
Rename GDataErrorCode to DriveErrorCode, GDataFileError to DriveFileError
In this CL, folloing changes are contained:
* gdata_errocode.h has been renamed to drive_errocode.h
* enum GDataErrorCode has been renamed to DriveErrorCode
* enum GDataFileError has been renamed to DriveFileError
* error codes in GDataErrorCode and GDataFileError whose prefix is "GDATA_"
have been renamed to "DRIVE_*"
BUG=137151
TEST=pass all existing tests
TBR=derat@chromium.org, abodenha@chromium.org, estade@chromium.org, satorux@chromium.org, ben@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10877006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153005 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos')
46 files changed, 844 insertions, 857 deletions
diff --git a/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc b/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc index d433920..875d607 100644 --- a/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc +++ b/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc @@ -12,7 +12,6 @@ #include "base/scoped_temp_dir.h" #include "base/threading/worker_pool.h" #include "base/values.h" -#include "chrome/browser/chromeos/gdata/gdata_errorcode.h" #include "chrome/browser/chromeos/gdata/gdata_file_system.h" #include "chrome/browser/chromeos/gdata/gdata_system_service.h" #include "chrome/browser/chromeos/gdata/gdata_util.h" diff --git a/chrome/browser/chromeos/extensions/file_browser_private_api.cc b/chrome/browser/chromeos/extensions/file_browser_private_api.cc index 3913e58..7f9229c 100644 --- a/chrome/browser/chromeos/extensions/file_browser_private_api.cc +++ b/chrome/browser/chromeos/extensions/file_browser_private_api.cc @@ -398,7 +398,7 @@ void RequestLocalFileSystemFunction::RespondSuccessOnUIThread( SetResult(dict); dict->SetString("name", name); dict->SetString("path", root_path.spec()); - dict->SetInteger("error", gdata::GDATA_FILE_OK); + dict->SetInteger("error", gdata::DRIVE_FILE_OK); SendResponse(true); } @@ -1107,13 +1107,13 @@ void AddMountFunction::GetLocalPathsResponseOnUIThread( display_name)); } else { OnMountedStateSet(mount_type_str, display_name, - gdata::GDATA_FILE_OK, source_path); + gdata::DRIVE_FILE_OK, source_path); } } void AddMountFunction::OnMountedStateSet(const std::string& mount_type, const FilePath::StringType& file_name, - gdata::GDataFileError error, + gdata::DriveFileError error, const FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DiskMountManager* disk_mount_manager = DiskMountManager::GetInstance(); @@ -1247,12 +1247,12 @@ void GetSizeStatsFunction::GetLocalPathsResponseOnUIThread( } void GetSizeStatsFunction::GetGDataAvailableSpaceCallback( - gdata::GDataFileError error, + gdata::DriveFileError error, int64 bytes_total, int64 bytes_used) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (error == gdata::GDATA_FILE_OK) { + if (error == gdata::DRIVE_FILE_OK) { int64 bytes_remaining = bytes_total - bytes_used; GetSizeStatsCallbackOnUIThread(static_cast<size_t>(bytes_total/1024), static_cast<size_t>(bytes_remaining/1024)); @@ -1727,7 +1727,7 @@ void GetGDataFilePropertiesFunction::DoOperation( // Nothing to do here so simply call OnOperationComplete(). OnOperationComplete(file_path, property_dict, - gdata::GDATA_FILE_OK, + gdata::DRIVE_FILE_OK, entry_proto.Pass()); } @@ -1789,14 +1789,14 @@ void GetGDataFilePropertiesFunction::CompleteGetFileProperties() { void GetGDataFilePropertiesFunction::OnGetFileInfo( const FilePath& file_path, base::DictionaryValue* property_dict, - gdata::GDataFileError error, + gdata::DriveFileError error, scoped_ptr<gdata::DriveEntryProto> entry_proto) { DCHECK(property_dict); if (entry_proto.get() && !entry_proto->has_file_specific_info()) - error = gdata::GDATA_FILE_ERROR_NOT_FOUND; + error = gdata::DRIVE_FILE_ERROR_NOT_FOUND; - if (error == gdata::GDATA_FILE_OK) + if (error == gdata::DRIVE_FILE_OK) DoOperation(file_path, property_dict, entry_proto.Pass()); else OnOperationComplete(file_path, property_dict, error, entry_proto.Pass()); @@ -1805,12 +1805,12 @@ void GetGDataFilePropertiesFunction::OnGetFileInfo( void GetGDataFilePropertiesFunction::OnOperationComplete( const FilePath& file_path, base::DictionaryValue* property_dict, - gdata::GDataFileError error, + gdata::DriveFileError error, scoped_ptr<gdata::DriveEntryProto> entry_proto) { if (entry_proto.get() && !entry_proto->has_file_specific_info()) - error = gdata::GDATA_FILE_ERROR_NOT_FOUND; + error = gdata::DRIVE_FILE_ERROR_NOT_FOUND; - if (error != gdata::GDATA_FILE_OK) { + if (error != gdata::DRIVE_FILE_OK) { property_dict->SetInteger("errorCode", error); CompleteGetFileProperties(); return; @@ -1941,7 +1941,7 @@ void PinGDataFileFunction::OnPinStateSet( const FilePath& path, base::DictionaryValue* properties, scoped_ptr<gdata::DriveEntryProto> entry_proto, - gdata::GDataFileError error, + gdata::DriveFileError error, const std::string& /* resource_id */, const std::string& /* md5 */) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -2057,13 +2057,13 @@ void GetGDataFilesFunction::GetFileOrSendResponse() { void GetGDataFilesFunction::OnFileReady( - gdata::GDataFileError error, + gdata::DriveFileError error, const FilePath& local_path, const std::string& unused_mime_type, gdata::DriveFileType file_type) { FilePath gdata_path = remaining_gdata_paths_.front(); - if (error == gdata::GDATA_FILE_OK) { + if (error == gdata::DRIVE_FILE_OK) { local_paths_->Append(Value::CreateStringValue(local_path.value())); DVLOG(1) << "Got " << gdata_path.value() << " as " << local_path.value(); @@ -2244,13 +2244,13 @@ void TransferFileFunction::GetLocalPathsResponseOnUIThread( } } -void TransferFileFunction::OnTransferCompleted(gdata::GDataFileError error) { - if (error == gdata::GDATA_FILE_OK) { +void TransferFileFunction::OnTransferCompleted(gdata::DriveFileError error) { + if (error == gdata::DRIVE_FILE_OK) { SendResponse(true); } else { error_ = base::StringPrintf("%d", static_cast<int>( fileapi::PlatformFileErrorToWebFileError( - gdata::util::GDataFileErrorToPlatformError(error)))); + gdata::util::DriveFileErrorToPlatformError(error)))); SendResponse(false); } } @@ -2342,10 +2342,10 @@ void SearchDriveFunction::OnFileSystemOpened( } void SearchDriveFunction::OnSearch( - gdata::GDataFileError error, + gdata::DriveFileError error, const GURL& next_feed, scoped_ptr<std::vector<gdata::SearchResultInfo> > results) { - if (error != gdata::GDATA_FILE_OK) { + if (error != gdata::DRIVE_FILE_OK) { SendResponse(false); return; } diff --git a/chrome/browser/chromeos/extensions/file_browser_private_api.h b/chrome/browser/chromeos/extensions/file_browser_private_api.h index c2812cc..343e82e 100644 --- a/chrome/browser/chromeos/extensions/file_browser_private_api.h +++ b/chrome/browser/chromeos/extensions/file_browser_private_api.h @@ -316,7 +316,7 @@ class AddMountFunction : public FileBrowserFunction { // A callback method to handle the result of SetMountedState. void OnMountedStateSet(const std::string& mount_type, const FilePath::StringType& file_name, - gdata::GDataFileError error, + gdata::DriveFileError error, const FilePath& file_path); }; @@ -388,9 +388,9 @@ class GetSizeStatsFunction : public FileBrowserFunction { // GetLocalPathsOnFileThreadAndRunCallbackOnUIThread. void GetLocalPathsResponseOnUIThread(const SelectedFileInfoList& files); - void GetGDataAvailableSpaceCallback(gdata::GDataFileError error, - int64 bytes_total, - int64 bytes_used); + void GetGDataAvailableSpaceCallback(gdata::DriveFileError error, + int64 bytes_total, + int64 bytes_used); void GetSizeStatsCallbackOnUIThread(size_t total_size_kb, size_t remaining_size_kb); @@ -457,7 +457,7 @@ class FileDialogStringsFunction : public SyncExtensionFunction { // Retrieve property information for multiple files, returning a list of the // same length as the input list of file URLs. If a particular file has an // error, then return a dictionary with the key "error" set to the error number -// (gdata::GDataFileError) for that entry in the returned list. +// (gdata::DriveFileError) for that entry in the returned list. class GetGDataFilePropertiesFunction : public FileBrowserFunction { public: DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getGDataFileProperties"); @@ -478,7 +478,7 @@ class GetGDataFilePropertiesFunction : public FileBrowserFunction { void OnOperationComplete(const FilePath& file_path, base::DictionaryValue* properties, - gdata::GDataFileError error, + gdata::DriveFileError error, scoped_ptr<gdata::DriveEntryProto> entry_proto); // AsyncExtensionFunction overrides. @@ -490,7 +490,7 @@ class GetGDataFilePropertiesFunction : public FileBrowserFunction { private: void OnGetFileInfo(const FilePath& file_path, base::DictionaryValue* property_dict, - gdata::GDataFileError error, + gdata::DriveFileError error, scoped_ptr<gdata::DriveEntryProto> entry_proto); void CacheStateReceived(base::DictionaryValue* property_dict, @@ -506,7 +506,7 @@ class GetGDataFilePropertiesFunction : public FileBrowserFunction { // properties with the updated cache state. The returned array is the // same length as the input list of file URLs. If a particular file // has an error, then return a dictionary with the key "error" set to -// the error number (gdata::GDataFileError) for that entry in the +// the error number (gdata::DriveFileError) for that entry in the // returned list. class PinGDataFileFunction : public GetGDataFilePropertiesFunction { public: @@ -531,7 +531,7 @@ class PinGDataFileFunction : public GetGDataFilePropertiesFunction { void OnPinStateSet(const FilePath& path, base::DictionaryValue* properties, scoped_ptr<gdata::DriveEntryProto> entry_proto, - gdata::GDataFileError error, + gdata::DriveFileError error, const std::string& resource_id, const std::string& md5); @@ -591,7 +591,7 @@ class GetGDataFilesFunction : public FileBrowserFunction { // Called by GDataFileSystem::GetFile(). Pops the file from // |remaining_gdata_paths_|, and calls GetFileOrSendResponse(). - void OnFileReady(gdata::GDataFileError error, + void OnFileReady(gdata::DriveFileError error, const FilePath& local_path, const std::string& unused_mime_type, gdata::DriveFileType file_type); @@ -652,7 +652,7 @@ class TransferFileFunction : public FileBrowserFunction { void GetLocalPathsResponseOnUIThread(const SelectedFileInfoList& files); // Helper callback for handling response from GDataFileSystem::TransferFile(). - void OnTransferCompleted(gdata::GDataFileError error); + void OnTransferCompleted(gdata::DriveFileError error); }; // Read setting value. @@ -694,7 +694,7 @@ class SearchDriveFunction : public AsyncExtensionFunction { const std::string& file_system_name, const GURL& file_system_url); // Callback for gdata::SearchAsync called after file system is opened. - void OnSearch(gdata::GDataFileError error, + void OnSearch(gdata::DriveFileError error, const GURL& next_feed, scoped_ptr<std::vector<gdata::SearchResultInfo> > result_paths); diff --git a/chrome/browser/chromeos/extensions/file_manager_util.cc b/chrome/browser/chromeos/extensions/file_manager_util.cc index 74a50b2..8899891 100644 --- a/chrome/browser/chromeos/extensions/file_manager_util.cc +++ b/chrome/browser/chromeos/extensions/file_manager_util.cc @@ -233,14 +233,14 @@ void ShowWarningMessageBox(Profile* profile, const FilePath& path) { void OnGDataFileFound(Profile* profile, const FilePath& file_path, gdata::DriveFileType file_type, - gdata::GDataFileError error, + gdata::DriveFileError error, scoped_ptr<gdata::DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (entry_proto.get() && !entry_proto->has_file_specific_info()) - error = gdata::GDATA_FILE_ERROR_NOT_FOUND; + error = gdata::DRIVE_FILE_ERROR_NOT_FOUND; - if (error == gdata::GDATA_FILE_OK) { + if (error == gdata::DRIVE_FILE_OK) { GURL page_url; if (file_type == gdata::REGULAR_FILE) { page_url = gdata::util::GetFileResourceUrl( diff --git a/chrome/browser/chromeos/gdata/drive_api_service.h b/chrome/browser/chromeos/gdata/drive_api_service.h index a282c64..bcc7ea7 100644 --- a/chrome/browser/chromeos/gdata/drive_api_service.h +++ b/chrome/browser/chromeos/gdata/drive_api_service.h @@ -12,7 +12,6 @@ #include "chrome/browser/chromeos/gdata/auth_service.h" #include "chrome/browser/chromeos/gdata/drive_service_interface.h" #include "chrome/browser/chromeos/gdata/gdata_operations.h" -#include "chrome/browser/chromeos/gdata/gdata_errorcode.h" class FilePath; class GURL; diff --git a/chrome/browser/chromeos/gdata/drive_cache.cc b/chrome/browser/chromeos/gdata/drive_cache.cc index 7e7dec2..d33a65a 100644 --- a/chrome/browser/chromeos/gdata/drive_cache.cc +++ b/chrome/browser/chromeos/gdata/drive_cache.cc @@ -107,7 +107,7 @@ void RemoveAllFiles(const FilePath& directory) { // - deleting symlink if |symlink_path| is not empty // - creating symlink if |symlink_path| is not empty and |create_symlink| is // true. -GDataFileError ModifyCacheState( +DriveFileError ModifyCacheState( const FilePath& source_path, const FilePath& dest_path, DriveCache::FileOperationType file_operation_type, @@ -126,7 +126,7 @@ GDataFileError ModifyCacheState( "move " : "copy ") << source_path.value() << " to " << dest_path.value(); - return GDATA_FILE_ERROR_FAILED; + return DRIVE_FILE_ERROR_FAILED; } else { DVLOG(1) << (file_operation_type == DriveCache::FILE_OPERATION_MOVE ? "Moved " : "Copied ") @@ -138,7 +138,7 @@ GDataFileError ModifyCacheState( } if (symlink_path.empty()) - return GDATA_FILE_OK; + return DRIVE_FILE_OK; // Remove symlink regardless of |create_symlink| because creating a link will // not overwrite an existing one. @@ -148,16 +148,16 @@ GDataFileError ModifyCacheState( file_util::Delete(symlink_path, false); if (!create_symlink) - return GDATA_FILE_OK; + return DRIVE_FILE_OK; // Create new symlink to |dest_path|. if (!file_util::CreateSymbolicLink(dest_path, symlink_path)) { LOG(ERROR) << "Failed to create a symlink from " << symlink_path.value() << " to " << dest_path.value(); - return GDATA_FILE_ERROR_FAILED; + return DRIVE_FILE_ERROR_FAILED; } - return GDATA_FILE_OK; + return DRIVE_FILE_OK; } // Deletes all files that match |path_to_delete_pattern| except for @@ -229,7 +229,7 @@ void CollectAnyFile(std::vector<std::string>* resource_ids, // Runs callback with pointers dereferenced. // Used to implement SetMountedStateOnUIThread and ClearAllOnUIThread. void RunChangeCacheStateCallback(const ChangeCacheStateCallback& callback, - const GDataFileError* error, + const DriveFileError* error, const FilePath* cache_file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(error); @@ -242,7 +242,7 @@ void RunChangeCacheStateCallback(const ChangeCacheStateCallback& callback, // Runs callback with pointers dereferenced. // Used to implement *OnUIThread methods. void RunCacheOperationCallback(const CacheOperationCallback& callback, - GDataFileError* error, + DriveFileError* error, const std::string& resource_id, const std::string& md5) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -255,7 +255,7 @@ void RunCacheOperationCallback(const CacheOperationCallback& callback, // Runs callback with pointers dereferenced. // Used to implement *OnUIThread methods. void RunGetFileFromCacheCallback(const GetFileFromCacheCallback& callback, - GDataFileError* error, + DriveFileError* error, const std::string& resource_id, const std::string& md5, FilePath* cache_file_path) { @@ -470,8 +470,7 @@ void DriveCache::GetFileOnUIThread(const std::string& resource_id, const GetFileFromCacheCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - GDataFileError* error = - new GDataFileError(GDATA_FILE_OK); + DriveFileError* error = new DriveFileError(DRIVE_FILE_OK); FilePath* cache_file_path = new FilePath; blocking_task_runner_->PostTaskAndReply( FROM_HERE, @@ -496,8 +495,7 @@ void DriveCache::StoreOnUIThread(const std::string& resource_id, const CacheOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - GDataFileError* error = - new GDataFileError(GDATA_FILE_OK); + DriveFileError* error = new DriveFileError(DRIVE_FILE_OK); blocking_task_runner_->PostTaskAndReply( FROM_HERE, base::Bind(&DriveCache::Store, @@ -519,8 +517,7 @@ void DriveCache::PinOnUIThread(const std::string& resource_id, const CacheOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - GDataFileError* error = - new GDataFileError(GDATA_FILE_OK); + DriveFileError* error = new DriveFileError(DRIVE_FILE_OK); blocking_task_runner_->PostTaskAndReply( FROM_HERE, base::Bind(&DriveCache::Pin, @@ -541,8 +538,7 @@ void DriveCache::UnpinOnUIThread(const std::string& resource_id, const std::string& md5, const CacheOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - GDataFileError* error = - new GDataFileError(GDATA_FILE_OK); + DriveFileError* error = new DriveFileError(DRIVE_FILE_OK); blocking_task_runner_->PostTaskAndReply( FROM_HERE, base::Bind(&DriveCache::Unpin, @@ -565,8 +561,7 @@ void DriveCache::SetMountedStateOnUIThread( const ChangeCacheStateCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - GDataFileError* error = - new GDataFileError(GDATA_FILE_OK); + DriveFileError* error = new DriveFileError(DRIVE_FILE_OK); FilePath* cache_file_path = new FilePath; blocking_task_runner_->PostTaskAndReply( FROM_HERE, @@ -587,8 +582,7 @@ void DriveCache::MarkDirtyOnUIThread(const std::string& resource_id, const GetFileFromCacheCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - GDataFileError* error = - new GDataFileError(GDATA_FILE_OK); + DriveFileError* error = new DriveFileError(DRIVE_FILE_OK); FilePath* cache_file_path = new FilePath; blocking_task_runner_->PostTaskAndReply( FROM_HERE, @@ -612,7 +606,7 @@ void DriveCache::CommitDirtyOnUIThread(const std::string& resource_id, const CacheOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - GDataFileError* error = new GDataFileError(GDATA_FILE_OK); + DriveFileError* error = new DriveFileError(DRIVE_FILE_OK); blocking_task_runner_->PostTaskAndReply( FROM_HERE, base::Bind(&DriveCache::CommitDirty, @@ -634,8 +628,7 @@ void DriveCache::ClearDirtyOnUIThread(const std::string& resource_id, const CacheOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - GDataFileError* error = - new GDataFileError(GDATA_FILE_OK); + DriveFileError* error = new DriveFileError(DRIVE_FILE_OK); blocking_task_runner_->PostTaskAndReply( FROM_HERE, base::Bind(&DriveCache::ClearDirty, @@ -655,9 +648,7 @@ void DriveCache::RemoveOnUIThread(const std::string& resource_id, const CacheOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - GDataFileError* error = - new GDataFileError(GDATA_FILE_OK); - + DriveFileError* error = new DriveFileError(DRIVE_FILE_OK); blocking_task_runner_->PostTaskAndReply( FROM_HERE, base::Bind(&DriveCache::Remove, @@ -674,8 +665,7 @@ void DriveCache::RemoveOnUIThread(const std::string& resource_id, void DriveCache::ClearAllOnUIThread(const ChangeCacheStateCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - GDataFileError* error = new GDataFileError(GDATA_FILE_OK); - + DriveFileError* error = new DriveFileError(DRIVE_FILE_OK); blocking_task_runner_->PostTaskAndReply( FROM_HERE, base::Bind(&DriveCache::ClearAll, @@ -796,7 +786,7 @@ void DriveCache::GetResourceIdsOfAllFiles( void DriveCache::GetFile(const std::string& resource_id, const std::string& md5, - GDataFileError* error, + DriveFileError* error, FilePath* cache_file_path) { AssertOnSequencedWorkerPool(); DCHECK(error); @@ -818,9 +808,9 @@ void DriveCache::GetFile(const std::string& resource_id, md5, GetSubDirectoryType(cache_entry), file_origin); - *error = GDATA_FILE_OK; + *error = DRIVE_FILE_OK; } else { - *error = GDATA_FILE_ERROR_NOT_FOUND; + *error = DRIVE_FILE_ERROR_NOT_FOUND; } } @@ -828,7 +818,7 @@ void DriveCache::Store(const std::string& resource_id, const std::string& md5, const FilePath& source_path, FileOperationType file_operation_type, - GDataFileError* error) { + DriveFileError* error) { AssertOnSequencedWorkerPool(); DCHECK(error); @@ -836,14 +826,14 @@ void DriveCache::Store(const std::string& resource_id, int64 file_size; if (!file_util::GetFileSize(source_path, &file_size)) { LOG(WARNING) << "Couldn't get file size for: " << source_path.value(); - *error = GDATA_FILE_ERROR_FAILED; + *error = DRIVE_FILE_ERROR_FAILED; return; } bool enough_space = false; FreeDiskSpaceIfNeededFor(file_size, &enough_space); if (!enough_space) { - *error = GDATA_FILE_ERROR_NO_SPACE; + *error = DRIVE_FILE_ERROR_NO_SPACE; return; } } @@ -862,7 +852,7 @@ void DriveCache::Store(const std::string& resource_id, << (cache_entry.is_dirty() ? "dirty" : "mounted") << " file: res_id=" << resource_id << ", md5=" << md5; - *error = GDATA_FILE_ERROR_IN_USE; + *error = DRIVE_FILE_ERROR_IN_USE; return; } @@ -912,7 +902,7 @@ void DriveCache::Store(const std::string& resource_id, // Delete files that match |stale_filenames_pattern| except for |dest_path|. DeleteFilesSelectively(stale_filenames_pattern, dest_path); - if (*error == GDATA_FILE_OK) { + if (*error == DRIVE_FILE_OK) { // Now that file operations have completed, update cache map. cache_entry.set_md5(md5); cache_entry.set_is_present(true); @@ -924,7 +914,7 @@ void DriveCache::Store(const std::string& resource_id, void DriveCache::Pin(const std::string& resource_id, const std::string& md5, FileOperationType file_operation_type, - GDataFileError* error) { + DriveFileError* error) { AssertOnSequencedWorkerPool(); DCHECK(error); @@ -999,7 +989,7 @@ void DriveCache::Pin(const std::string& resource_id, symlink_path, create_symlink); - if (*error == GDATA_FILE_OK) { + if (*error == DRIVE_FILE_OK) { // Now that file operations have completed, update cache map. cache_entry.set_md5(md5); cache_entry.set_is_pinned(true); @@ -1011,7 +1001,7 @@ void DriveCache::Pin(const std::string& resource_id, void DriveCache::Unpin(const std::string& resource_id, const std::string& md5, FileOperationType file_operation_type, - GDataFileError* error) { + DriveFileError* error) { AssertOnSequencedWorkerPool(); DCHECK(error); @@ -1021,7 +1011,7 @@ void DriveCache::Unpin(const std::string& resource_id, LOG(WARNING) << "Can't unpin a file that wasn't pinned or cached: res_id=" << resource_id << ", md5=" << md5; - *error = GDATA_FILE_ERROR_NOT_FOUND; + *error = DRIVE_FILE_ERROR_NOT_FOUND; return; } @@ -1079,7 +1069,7 @@ void DriveCache::Unpin(const std::string& resource_id, symlink_path, // This will be deleted if it exists. false /* don't create symlink*/); - if (*error == GDATA_FILE_OK) { + if (*error == DRIVE_FILE_OK) { // Now that file operations have completed, update cache map. if (cache_entry.is_present()) { cache_entry.set_md5(md5); @@ -1095,7 +1085,7 @@ void DriveCache::Unpin(const std::string& resource_id, void DriveCache::SetMountedState(const FilePath& file_path, bool to_mount, - GDataFileError *error, + DriveFileError *error, FilePath* cache_file_path) { AssertOnSequencedWorkerPool(); DCHECK(error); @@ -1112,11 +1102,11 @@ void DriveCache::SetMountedState(const FilePath& file_path, // Get cache entry associated with the resource_id and md5 DriveCacheEntry cache_entry; if (!GetCacheEntry(resource_id, md5, &cache_entry)) { - *error = GDATA_FILE_ERROR_NOT_FOUND; + *error = DRIVE_FILE_ERROR_NOT_FOUND; return; } if (to_mount == cache_entry.is_mounted()) { - *error = GDATA_FILE_ERROR_INVALID_OPERATION; + *error = DRIVE_FILE_ERROR_INVALID_OPERATION; return; } @@ -1149,7 +1139,7 @@ void DriveCache::SetMountedState(const FilePath& file_path, // Move cache blob from source path to destination path. *error = ModifyCacheState(source_path, *cache_file_path, FILE_OPERATION_MOVE, FilePath(), false); - if (*error == GDATA_FILE_OK) { + if (*error == DRIVE_FILE_OK) { // Now that cache operation is complete, update cache map cache_entry.set_md5(md5); cache_entry.set_is_persistent(dest_subdir == CACHE_TYPE_PERSISTENT); @@ -1160,7 +1150,7 @@ void DriveCache::SetMountedState(const FilePath& file_path, void DriveCache::MarkDirty(const std::string& resource_id, const std::string& md5, FileOperationType file_operation_type, - GDataFileError* error, + DriveFileError* error, FilePath* cache_file_path) { AssertOnSequencedWorkerPool(); DCHECK(error); @@ -1179,7 +1169,7 @@ void DriveCache::MarkDirty(const std::string& resource_id, LOG(WARNING) << "Can't mark dirty a file that wasn't cached: res_id=" << resource_id << ", md5=" << md5; - *error = GDATA_FILE_ERROR_NOT_FOUND; + *error = DRIVE_FILE_ERROR_NOT_FOUND; return; } @@ -1211,7 +1201,7 @@ void DriveCache::MarkDirty(const std::string& resource_id, false /* don't create symlink */); // Determine current path of dirty file. - if (*error == GDATA_FILE_OK) { + if (*error == DRIVE_FILE_OK) { *cache_file_path = GetCacheFilePath( resource_id, md5, @@ -1253,7 +1243,7 @@ void DriveCache::MarkDirty(const std::string& resource_id, symlink_path, !symlink_path.empty() /* create symlink */); - if (*error == GDATA_FILE_OK) { + if (*error == DRIVE_FILE_OK) { // Now that file operations have completed, update cache map. cache_entry.set_md5(md5); cache_entry.set_is_dirty(true); @@ -1265,7 +1255,7 @@ void DriveCache::MarkDirty(const std::string& resource_id, void DriveCache::CommitDirty(const std::string& resource_id, const std::string& md5, FileOperationType file_operation_type, - GDataFileError* error) { + DriveFileError* error) { AssertOnSequencedWorkerPool(); DCHECK(error); @@ -1282,7 +1272,7 @@ void DriveCache::CommitDirty(const std::string& resource_id, LOG(WARNING) << "Can't commit dirty a file that wasn't cached: res_id=" << resource_id << ", md5=" << md5; - *error = GDATA_FILE_ERROR_NOT_FOUND; + *error = DRIVE_FILE_ERROR_NOT_FOUND; return; } @@ -1292,7 +1282,7 @@ void DriveCache::CommitDirty(const std::string& resource_id, LOG(WARNING) << "Can't commit a non-dirty file: res_id=" << resource_id << ", md5=" << md5; - *error = GDATA_FILE_ERROR_INVALID_OPERATION; + *error = DRIVE_FILE_ERROR_INVALID_OPERATION; return; } @@ -1324,7 +1314,7 @@ void DriveCache::CommitDirty(const std::string& resource_id, void DriveCache::ClearDirty(const std::string& resource_id, const std::string& md5, FileOperationType file_operation_type, - GDataFileError* error) { + DriveFileError* error) { AssertOnSequencedWorkerPool(); DCHECK(error); @@ -1339,7 +1329,7 @@ void DriveCache::ClearDirty(const std::string& resource_id, LOG(WARNING) << "Can't clear dirty state of a file that wasn't cached: " << "res_id=" << resource_id << ", md5=" << md5; - *error = GDATA_FILE_ERROR_NOT_FOUND; + *error = DRIVE_FILE_ERROR_NOT_FOUND; return; } @@ -1349,7 +1339,7 @@ void DriveCache::ClearDirty(const std::string& resource_id, LOG(WARNING) << "Can't clear dirty state of a non-dirty file: res_id=" << resource_id << ", md5=" << md5; - *error = GDATA_FILE_ERROR_INVALID_OPERATION; + *error = DRIVE_FILE_ERROR_INVALID_OPERATION; return; } @@ -1385,7 +1375,7 @@ void DriveCache::ClearDirty(const std::string& resource_id, false /* don't create symlink */); // If file is pinned, update symlink in pinned dir. - if (*error == GDATA_FILE_OK && cache_entry.is_pinned()) { + if (*error == DRIVE_FILE_OK && cache_entry.is_pinned()) { symlink_path = GetCacheFilePath(resource_id, std::string(), CACHE_TYPE_PINNED, @@ -1401,7 +1391,7 @@ void DriveCache::ClearDirty(const std::string& resource_id, true /* create symlink */); } - if (*error == GDATA_FILE_OK) { + if (*error == DRIVE_FILE_OK) { // Now that file operations have completed, update cache map. cache_entry.set_md5(md5); cache_entry.set_is_dirty(false); @@ -1411,7 +1401,7 @@ void DriveCache::ClearDirty(const std::string& resource_id, } void DriveCache::Remove(const std::string& resource_id, - GDataFileError* error) { + DriveFileError* error) { AssertOnSequencedWorkerPool(); DCHECK(error); @@ -1429,7 +1419,7 @@ void DriveCache::Remove(const std::string& resource_id, (cache_entry.is_dirty() ? "dirty" : "mounted") : "non-existent") << " in cache, not removing"; - *error = GDATA_FILE_OK; + *error = DRIVE_FILE_OK; return; } @@ -1470,20 +1460,20 @@ void DriveCache::Remove(const std::string& resource_id, // Now that all file operations have completed, remove from cache map. metadata_->RemoveCacheEntry(resource_id); - *error = GDATA_FILE_OK; + *error = DRIVE_FILE_OK; } -void DriveCache::ClearAll(GDataFileError* error) { +void DriveCache::ClearAll(DriveFileError* error) { AssertOnSequencedWorkerPool(); DCHECK(error); bool success = file_util::Delete(cache_root_path_, true); Initialize(); - *error = success ? GDATA_FILE_OK : GDATA_FILE_ERROR_FAILED; + *error = success ? DRIVE_FILE_OK : DRIVE_FILE_ERROR_FAILED; } -void DriveCache::OnPinned(GDataFileError* error, +void DriveCache::OnPinned(DriveFileError* error, const std::string& resource_id, const std::string& md5, const CacheOperationCallback& callback) { @@ -1493,11 +1483,11 @@ void DriveCache::OnPinned(GDataFileError* error, if (!callback.is_null()) callback.Run(*error, resource_id, md5); - if (*error == GDATA_FILE_OK) + if (*error == DRIVE_FILE_OK) FOR_EACH_OBSERVER(Observer, observers_, OnCachePinned(resource_id, md5)); } -void DriveCache::OnUnpinned(GDataFileError* error, +void DriveCache::OnUnpinned(DriveFileError* error, const std::string& resource_id, const std::string& md5, const CacheOperationCallback& callback) { @@ -1507,7 +1497,7 @@ void DriveCache::OnUnpinned(GDataFileError* error, if (!callback.is_null()) callback.Run(*error, resource_id, md5); - if (*error == GDATA_FILE_OK) + if (*error == DRIVE_FILE_OK) FOR_EACH_OBSERVER(Observer, observers_, OnCacheUnpinned(resource_id, md5)); // Now the file is moved from "persistent" to "tmp" directory. @@ -1521,7 +1511,7 @@ void DriveCache::OnUnpinned(GDataFileError* error, base::Owned(has_enough_space))); } -void DriveCache::OnCommitDirty(GDataFileError* error, +void DriveCache::OnCommitDirty(DriveFileError* error, const std::string& resource_id, const std::string& md5, const CacheOperationCallback& callback) { @@ -1531,7 +1521,7 @@ void DriveCache::OnCommitDirty(GDataFileError* error, if (!callback.is_null()) callback.Run(*error, resource_id, md5); - if (*error == GDATA_FILE_OK) + if (*error == DRIVE_FILE_OK) FOR_EACH_OBSERVER(Observer, observers_, OnCacheCommitted(resource_id)); } diff --git a/chrome/browser/chromeos/gdata/drive_cache.h b/chrome/browser/chromeos/gdata/drive_cache.h index 00715c6..2b43e6e 100644 --- a/chrome/browser/chromeos/gdata/drive_cache.h +++ b/chrome/browser/chromeos/gdata/drive_cache.h @@ -31,17 +31,17 @@ class DriveCacheEntry; class DriveCacheMetadata; // Callback for SetMountedStateOnUIThread and ClearAllOnUIThread. -typedef base::Callback<void(GDataFileError error, +typedef base::Callback<void(DriveFileError error, const FilePath& file_path)> ChangeCacheStateCallback; // Callback for completion of cache operation. -typedef base::Callback<void(GDataFileError error, +typedef base::Callback<void(DriveFileError error, const std::string& resource_id, const std::string& md5)> CacheOperationCallback; // Callback for GetFileFromCache. -typedef base::Callback<void(GDataFileError error, +typedef base::Callback<void(DriveFileError error, const std::string& resource_id, const std::string& md5, const FilePath& cache_file_path)> @@ -358,7 +358,7 @@ class DriveCache { // Used to implement GetFileOnUIThread. void GetFile(const std::string& resource_id, const std::string& md5, - GDataFileError* error, + DriveFileError* error, FilePath* cache_file_path); // Used to implement StoreOnUIThread. @@ -366,66 +366,66 @@ class DriveCache { const std::string& md5, const FilePath& source_path, FileOperationType file_operation_type, - GDataFileError* error); + DriveFileError* error); // Used to implement PinOnUIThread. void Pin(const std::string& resource_id, const std::string& md5, FileOperationType file_operation_type, - GDataFileError* error); + DriveFileError* error); // Used to implement UnpinOnUIThread. void Unpin(const std::string& resource_id, const std::string& md5, FileOperationType file_operation_type, - GDataFileError* error); + DriveFileError* error); // Used to implement SetMountedStateOnUIThread. void SetMountedState(const FilePath& file_path, bool to_mount, - GDataFileError* error, + DriveFileError* error, FilePath* cache_file_path); // Used to implement MarkDirtyOnUIThread. void MarkDirty(const std::string& resource_id, const std::string& md5, FileOperationType file_operation_type, - GDataFileError* error, + DriveFileError* error, FilePath* cache_file_path); // Used to implement CommitDirtyOnUIThread. void CommitDirty(const std::string& resource_id, const std::string& md5, FileOperationType file_operation_type, - GDataFileError* error); + DriveFileError* error); // Used to implement ClearDirtyOnUIThread. void ClearDirty(const std::string& resource_id, const std::string& md5, FileOperationType file_operation_type, - GDataFileError* error); + DriveFileError* error); // Used to implement RemoveOnUIThread. void Remove(const std::string& resource_id, - GDataFileError* error); + DriveFileError* error); // Used to implement ClearAllUIThread. - void ClearAll(GDataFileError* error); + void ClearAll(DriveFileError* error); // Runs callback and notifies the observers when file is pinned. - void OnPinned(GDataFileError* error, + void OnPinned(DriveFileError* error, const std::string& resource_id, const std::string& md5, const CacheOperationCallback& callback); // Runs callback and notifies the observers when file is unpinned. - void OnUnpinned(GDataFileError* error, + void OnUnpinned(DriveFileError* error, const std::string& resource_id, const std::string& md5, const CacheOperationCallback& callback); // Runs callback and notifies the observers when file is committed. - void OnCommitDirty(GDataFileError* error, + void OnCommitDirty(DriveFileError* error, const std::string& resource_id, const std::string& md5, const CacheOperationCallback& callback); diff --git a/chrome/browser/chromeos/gdata/drive_cache_unittest.cc b/chrome/browser/chromeos/gdata/drive_cache_unittest.cc index 841e07e..9431bb3 100644 --- a/chrome/browser/chromeos/gdata/drive_cache_unittest.cc +++ b/chrome/browser/chromeos/gdata/drive_cache_unittest.cc @@ -115,9 +115,9 @@ void OnGetResourceIds(std::vector<std::string>* out_resource_ids, } // Copies results from ClearAllOnUIThread. -void OnClearAll(GDataFileError* out_error, +void OnClearAll(DriveFileError* out_error, FilePath* out_file_path, - GDataFileError error, + DriveFileError error, const FilePath& file_path) { *out_file_path = file_path; *out_error = error; @@ -132,7 +132,7 @@ class DriveCacheTest : public testing::Test { io_thread_(content::BrowserThread::IO), cache_(NULL), num_callback_invocations_(0), - expected_error_(GDATA_FILE_OK), + expected_error_(DRIVE_FILE_OK), expected_cache_state_(0), expected_sub_dir_type_(DriveCache::CACHE_TYPE_META), expected_success_(true), @@ -248,8 +248,8 @@ class DriveCacheTest : public testing::Test { resource.resource_id, resource.md5, test_util::ToCacheEntry(resource.cache_state).is_present() ? - GDATA_FILE_OK : - GDATA_FILE_ERROR_NOT_FOUND, + DRIVE_FILE_OK : + DRIVE_FILE_ERROR_NOT_FOUND, resource.expected_file_extension); EXPECT_EQ(1, num_callback_invocations_); @@ -271,7 +271,7 @@ class DriveCacheTest : public testing::Test { void TestGetFileFromCacheByResourceIdAndMd5( const std::string& resource_id, const std::string& md5, - GDataFileError expected_error, + DriveFileError expected_error, const std::string& expected_file_extension) { expected_error_ = expected_error; expected_file_extension_ = expected_file_extension; @@ -288,7 +288,7 @@ class DriveCacheTest : public testing::Test { const std::string& resource_id, const std::string& md5, const FilePath& source_path, - GDataFileError expected_error, + DriveFileError expected_error, int expected_cache_state, DriveCache::CacheSubDirectoryType expected_sub_dir_type) { expected_error_ = expected_error; @@ -304,7 +304,7 @@ class DriveCacheTest : public testing::Test { test_util::RunBlockingPoolTask(); } - void VerifyGetFromCache(GDataFileError error, + void VerifyGetFromCache(DriveFileError error, const std::string& resource_id, const std::string& md5, const FilePath& cache_file_path) { @@ -312,7 +312,7 @@ class DriveCacheTest : public testing::Test { EXPECT_EQ(expected_error_, error); - if (error == GDATA_FILE_OK) { + if (error == DRIVE_FILE_OK) { // Verify filename of |cache_file_path|. FilePath base_name = cache_file_path.BaseName(); EXPECT_EQ(util::EscapeCacheFileName(resource_id) + @@ -327,7 +327,7 @@ class DriveCacheTest : public testing::Test { } void TestRemoveFromCache(const std::string& resource_id, - GDataFileError expected_error) { + DriveFileError expected_error) { expected_error_ = expected_error; cache_->RemoveOnUIThread( @@ -338,7 +338,7 @@ class DriveCacheTest : public testing::Test { test_util::RunBlockingPoolTask(); } - void VerifyRemoveFromCache(GDataFileError error, + void VerifyRemoveFromCache(DriveFileError error, const std::string& resource_id, const std::string& md5) { ++num_callback_invocations_; @@ -436,7 +436,7 @@ class DriveCacheTest : public testing::Test { void TestPin( const std::string& resource_id, const std::string& md5, - GDataFileError expected_error, + DriveFileError expected_error, int expected_cache_state, DriveCache::CacheSubDirectoryType expected_sub_dir_type) { expected_error_ = expected_error; @@ -454,7 +454,7 @@ class DriveCacheTest : public testing::Test { void TestUnpin( const std::string& resource_id, const std::string& md5, - GDataFileError expected_error, + DriveFileError expected_error, int expected_cache_state, DriveCache::CacheSubDirectoryType expected_sub_dir_type) { expected_error_ = expected_error; @@ -472,7 +472,7 @@ class DriveCacheTest : public testing::Test { void TestMarkDirty( const std::string& resource_id, const std::string& md5, - GDataFileError expected_error, + DriveFileError expected_error, int expected_cache_state, DriveCache::CacheSubDirectoryType expected_sub_dir_type) { expected_error_ = expected_error; @@ -488,14 +488,14 @@ class DriveCacheTest : public testing::Test { test_util::RunBlockingPoolTask(); } - void VerifyMarkDirty(GDataFileError error, + void VerifyMarkDirty(DriveFileError error, const std::string& resource_id, const std::string& md5, const FilePath& cache_file_path) { VerifyCacheFileState(error, resource_id, md5); // Verify filename of |cache_file_path|. - if (error == GDATA_FILE_OK) { + if (error == DRIVE_FILE_OK) { FilePath base_name = cache_file_path.BaseName(); EXPECT_EQ(util::EscapeCacheFileName(resource_id) + FilePath::kExtensionSeparator + @@ -509,7 +509,7 @@ class DriveCacheTest : public testing::Test { void TestCommitDirty( const std::string& resource_id, const std::string& md5, - GDataFileError expected_error, + DriveFileError expected_error, int expected_cache_state, DriveCache::CacheSubDirectoryType expected_sub_dir_type) { expected_error_ = expected_error; @@ -528,7 +528,7 @@ class DriveCacheTest : public testing::Test { void TestClearDirty( const std::string& resource_id, const std::string& md5, - GDataFileError expected_error, + DriveFileError expected_error, int expected_cache_state, DriveCache::CacheSubDirectoryType expected_sub_dir_type) { expected_error_ = expected_error; @@ -548,7 +548,7 @@ class DriveCacheTest : public testing::Test { const std::string& md5, const FilePath& file_path, bool to_mount, - GDataFileError expected_error, + DriveFileError expected_error, int expected_cache_state, DriveCache::CacheSubDirectoryType expected_sub_dir_type) { expected_error_ = expected_error; @@ -566,7 +566,7 @@ class DriveCacheTest : public testing::Test { void VerifySetMountedState(const std::string& resource_id, const std::string& md5, bool to_mount, - GDataFileError error, + DriveFileError error, const FilePath& file_path) { ++num_callback_invocations_; EXPECT_TRUE(file_util::PathExists(file_path)); @@ -579,7 +579,7 @@ class DriveCacheTest : public testing::Test { DriveCache::CACHED_FILE_FROM_SERVER)); } - void VerifyCacheFileState(GDataFileError error, + void VerifyCacheFileState(DriveFileError error, const std::string& resource_id, const std::string& md5) { ++num_callback_invocations_; @@ -774,7 +774,7 @@ class DriveCacheTest : public testing::Test { scoped_ptr<StrictMock<MockDriveCacheObserver> > mock_cache_observer_; int num_callback_invocations_; - GDataFileError expected_error_; + DriveFileError expected_error_; int expected_cache_state_; DriveCache::CacheSubDirectoryType expected_sub_dir_type_; bool expected_success_; @@ -818,14 +818,14 @@ TEST_F(DriveCacheTest, StoreToCacheSimple) { // Store an existing file. TestStoreToCache(resource_id, md5, GetTestFilePath("root_feed.json"), - GDATA_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); EXPECT_EQ(1, num_callback_invocations_); // Store a non-existent file to the same |resource_id| and |md5|. num_callback_invocations_ = 0; TestStoreToCache(resource_id, md5, FilePath("./non_existent.json"), - GDATA_FILE_ERROR_FAILED, + DRIVE_FILE_ERROR_FAILED, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); EXPECT_EQ(1, num_callback_invocations_); @@ -835,7 +835,7 @@ TEST_F(DriveCacheTest, StoreToCacheSimple) { md5 = "new_md5"; num_callback_invocations_ = 0; TestStoreToCache(resource_id, md5, GetTestFilePath("subdir_feed.json"), - GDATA_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); EXPECT_EQ(1, num_callback_invocations_); @@ -852,20 +852,20 @@ TEST_F(DriveCacheTest, GetFromCacheSimple) { std::string md5("abcdef0123456789"); // First store a file to cache. TestStoreToCache(resource_id, md5, GetTestFilePath("root_feed.json"), - GDATA_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); // Then try to get the existing file from cache. num_callback_invocations_ = 0; TestGetFileFromCacheByResourceIdAndMd5( - resource_id, md5, GDATA_FILE_OK, md5); + resource_id, md5, DRIVE_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; TestGetFileFromCacheByResourceIdAndMd5( - resource_id, "9999", GDATA_FILE_ERROR_NOT_FOUND, md5); + resource_id, "9999", DRIVE_FILE_ERROR_NOT_FOUND, md5); EXPECT_EQ(1, num_callback_invocations_); // Get file from cache with different resource id from existing file but same @@ -873,7 +873,7 @@ TEST_F(DriveCacheTest, GetFromCacheSimple) { num_callback_invocations_ = 0; resource_id = "document:1a2b"; TestGetFileFromCacheByResourceIdAndMd5( - resource_id, md5, GDATA_FILE_ERROR_NOT_FOUND, md5); + resource_id, md5, DRIVE_FILE_ERROR_NOT_FOUND, md5); EXPECT_EQ(1, num_callback_invocations_); } @@ -886,23 +886,23 @@ TEST_F(DriveCacheTest, RemoveFromCacheSimple) { std::string md5("abcdef0123456789"); // First store a file to cache. TestStoreToCache(resource_id, md5, GetTestFilePath("root_feed.json"), - GDATA_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); // Then try to remove existing file from cache. num_callback_invocations_ = 0; - TestRemoveFromCache(resource_id, GDATA_FILE_OK); + TestRemoveFromCache(resource_id, DRIVE_FILE_OK); EXPECT_EQ(1, num_callback_invocations_); // Repeat using non-alphanumeric characters for resource id, including '.' // which is an extension separator. resource_id = "pdf:`~!@#$%^&*()-_=+[{|]}\\;',<.>/?"; TestStoreToCache(resource_id, md5, GetTestFilePath("root_feed.json"), - GDATA_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); num_callback_invocations_ = 0; - TestRemoveFromCache(resource_id, GDATA_FILE_OK); + TestRemoveFromCache(resource_id, DRIVE_FILE_OK); EXPECT_EQ(1, num_callback_invocations_); } @@ -918,12 +918,12 @@ TEST_F(DriveCacheTest, PinAndUnpin) { // First store a file to cache. TestStoreToCache(resource_id, md5, GetTestFilePath("root_feed.json"), - GDATA_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); // Pin the existing file in cache. num_callback_invocations_ = 0; - TestPin(resource_id, md5, GDATA_FILE_OK, + TestPin(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_PINNED | test_util::TEST_CACHE_STATE_PERSISTENT, @@ -932,14 +932,14 @@ TEST_F(DriveCacheTest, PinAndUnpin) { // Unpin the existing file in cache. num_callback_invocations_ = 0; - TestUnpin(resource_id, md5, GDATA_FILE_OK, + TestUnpin(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); EXPECT_EQ(1, num_callback_invocations_); // Pin back the same existing file in cache. num_callback_invocations_ = 0; - TestPin(resource_id, md5, GDATA_FILE_OK, + TestPin(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_PINNED | test_util::TEST_CACHE_STATE_PERSISTENT, @@ -953,14 +953,14 @@ TEST_F(DriveCacheTest, PinAndUnpin) { .Times(1); num_callback_invocations_ = 0; - TestPin(resource_id, md5, GDATA_FILE_OK, + TestPin(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PINNED, DriveCache::CACHE_TYPE_TMP); EXPECT_EQ(1, num_callback_invocations_); // Unpin the previously pinned non-existent file in cache. num_callback_invocations_ = 0; - TestUnpin(resource_id, md5, GDATA_FILE_OK, + TestUnpin(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_NONE, DriveCache::CACHE_TYPE_TMP); EXPECT_EQ(1, num_callback_invocations_); @@ -973,7 +973,7 @@ TEST_F(DriveCacheTest, PinAndUnpin) { .Times(0); num_callback_invocations_ = 0; - TestUnpin(resource_id, md5, GDATA_FILE_ERROR_NOT_FOUND, + TestUnpin(resource_id, md5, DRIVE_FILE_ERROR_NOT_FOUND, test_util::TEST_CACHE_STATE_NONE, DriveCache::CACHE_TYPE_TMP /* non-applicable */); EXPECT_EQ(1, num_callback_invocations_); @@ -988,14 +988,14 @@ TEST_F(DriveCacheTest, StoreToCachePinned) { EXPECT_CALL(*mock_cache_observer_, OnCachePinned(resource_id, md5)).Times(1); // Pin a non-existent file. - TestPin(resource_id, md5, GDATA_FILE_OK, + TestPin(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PINNED, DriveCache::CACHE_TYPE_TMP); // Store an existing file to a previously pinned file. num_callback_invocations_ = 0; TestStoreToCache(resource_id, md5, GetTestFilePath("root_feed.json"), - GDATA_FILE_OK, + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_PINNED | test_util::TEST_CACHE_STATE_PERSISTENT, @@ -1005,7 +1005,7 @@ TEST_F(DriveCacheTest, StoreToCachePinned) { // Store a non-existent file to a previously pinned and stored file. num_callback_invocations_ = 0; TestStoreToCache(resource_id, md5, FilePath("./non_existent.json"), - GDATA_FILE_ERROR_FAILED, + DRIVE_FILE_ERROR_FAILED, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_PINNED | test_util::TEST_CACHE_STATE_PERSISTENT, @@ -1022,19 +1022,19 @@ TEST_F(DriveCacheTest, GetFromCachePinned) { EXPECT_CALL(*mock_cache_observer_, OnCachePinned(resource_id, md5)).Times(1); // Pin a non-existent file. - TestPin(resource_id, md5, GDATA_FILE_OK, + TestPin(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PINNED, DriveCache::CACHE_TYPE_TMP); // Get the non-existent pinned file from cache. num_callback_invocations_ = 0; TestGetFileFromCacheByResourceIdAndMd5( - resource_id, md5, GDATA_FILE_ERROR_NOT_FOUND, md5); + resource_id, md5, DRIVE_FILE_ERROR_NOT_FOUND, md5); EXPECT_EQ(1, num_callback_invocations_); // Store an existing file to the previously pinned non-existent file. TestStoreToCache(resource_id, md5, GetTestFilePath("root_feed.json"), - GDATA_FILE_OK, + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_PINNED | test_util::TEST_CACHE_STATE_PERSISTENT, @@ -1043,7 +1043,7 @@ TEST_F(DriveCacheTest, GetFromCachePinned) { // Get the previously pinned and stored file from cache. num_callback_invocations_ = 0; TestGetFileFromCacheByResourceIdAndMd5( - resource_id, md5, GDATA_FILE_OK, md5); + resource_id, md5, DRIVE_FILE_OK, md5); EXPECT_EQ(1, num_callback_invocations_); } @@ -1058,9 +1058,9 @@ TEST_F(DriveCacheTest, RemoveFromCachePinned) { // Store a file to cache, and pin it. TestStoreToCache(resource_id, md5, GetTestFilePath("root_feed.json"), - GDATA_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); - TestPin(resource_id, md5, GDATA_FILE_OK, + TestPin(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_PINNED | test_util::TEST_CACHE_STATE_PERSISTENT, @@ -1068,7 +1068,7 @@ TEST_F(DriveCacheTest, RemoveFromCachePinned) { // Remove |resource_id| from cache. num_callback_invocations_ = 0; - TestRemoveFromCache(resource_id, GDATA_FILE_OK); + TestRemoveFromCache(resource_id, DRIVE_FILE_OK); EXPECT_EQ(1, num_callback_invocations_); // Repeat using non-alphanumeric characters for resource id, including '.' @@ -1077,16 +1077,16 @@ TEST_F(DriveCacheTest, RemoveFromCachePinned) { EXPECT_CALL(*mock_cache_observer_, OnCachePinned(resource_id, md5)).Times(1); TestStoreToCache(resource_id, md5, GetTestFilePath("root_feed.json"), - GDATA_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); - TestPin(resource_id, md5, GDATA_FILE_OK, + TestPin(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_PINNED | test_util::TEST_CACHE_STATE_PERSISTENT, DriveCache::CACHE_TYPE_PERSISTENT); num_callback_invocations_ = 0; - TestRemoveFromCache(resource_id, GDATA_FILE_OK); + TestRemoveFromCache(resource_id, DRIVE_FILE_OK); EXPECT_EQ(1, num_callback_invocations_); } @@ -1100,12 +1100,12 @@ TEST_F(DriveCacheTest, DirtyCacheSimple) { // First store a file to cache. TestStoreToCache(resource_id, md5, GetTestFilePath("root_feed.json"), - GDATA_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); // Mark the file dirty. num_callback_invocations_ = 0; - TestMarkDirty(resource_id, md5, GDATA_FILE_OK, + TestMarkDirty(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_DIRTY | test_util::TEST_CACHE_STATE_PERSISTENT, @@ -1114,7 +1114,7 @@ TEST_F(DriveCacheTest, DirtyCacheSimple) { // Commit the file dirty. num_callback_invocations_ = 0; - TestCommitDirty(resource_id, md5, GDATA_FILE_OK, + TestCommitDirty(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_DIRTY | test_util::TEST_CACHE_STATE_PERSISTENT, @@ -1123,7 +1123,7 @@ TEST_F(DriveCacheTest, DirtyCacheSimple) { // Clear dirty state of the file. num_callback_invocations_ = 0; - TestClearDirty(resource_id, md5, GDATA_FILE_OK, + TestClearDirty(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); EXPECT_EQ(1, num_callback_invocations_); @@ -1140,9 +1140,9 @@ TEST_F(DriveCacheTest, DirtyCachePinned) { // First store a file to cache and pin it. TestStoreToCache(resource_id, md5, GetTestFilePath("root_feed.json"), - GDATA_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); - TestPin(resource_id, md5, GDATA_FILE_OK, + TestPin(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_PINNED | test_util::TEST_CACHE_STATE_PERSISTENT, @@ -1150,7 +1150,7 @@ TEST_F(DriveCacheTest, DirtyCachePinned) { // Mark the file dirty. num_callback_invocations_ = 0; - TestMarkDirty(resource_id, md5, GDATA_FILE_OK, + TestMarkDirty(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_DIRTY | test_util::TEST_CACHE_STATE_PINNED | @@ -1160,7 +1160,7 @@ TEST_F(DriveCacheTest, DirtyCachePinned) { // Commit the file dirty. num_callback_invocations_ = 0; - TestCommitDirty(resource_id, md5, GDATA_FILE_OK, + TestCommitDirty(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_DIRTY | test_util::TEST_CACHE_STATE_PINNED | @@ -1170,7 +1170,7 @@ TEST_F(DriveCacheTest, DirtyCachePinned) { // Clear dirty state of the file. num_callback_invocations_ = 0; - TestClearDirty(resource_id, md5, GDATA_FILE_OK, + TestClearDirty(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_PINNED | test_util::TEST_CACHE_STATE_PERSISTENT, @@ -1191,9 +1191,9 @@ TEST_F(DriveCacheTest, PinAndUnpinDirtyCache) { // First store a file to cache and mark it as dirty. TestStoreToCache(resource_id, md5, GetTestFilePath("root_feed.json"), - GDATA_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); - TestMarkDirty(resource_id, md5, GDATA_FILE_OK, + TestMarkDirty(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_DIRTY | test_util::TEST_CACHE_STATE_PERSISTENT, @@ -1208,7 +1208,7 @@ TEST_F(DriveCacheTest, PinAndUnpinDirtyCache) { EXPECT_TRUE(file_util::PathExists(dirty_path)); // Pin the dirty file. - TestPin(resource_id, md5, GDATA_FILE_OK, + TestPin(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_DIRTY | test_util::TEST_CACHE_STATE_PINNED | @@ -1219,7 +1219,7 @@ TEST_F(DriveCacheTest, PinAndUnpinDirtyCache) { EXPECT_TRUE(file_util::PathExists(dirty_path)); // Unpin the dirty file. - TestUnpin(resource_id, md5, GDATA_FILE_OK, + TestUnpin(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_DIRTY | test_util::TEST_CACHE_STATE_PERSISTENT, @@ -1239,12 +1239,12 @@ TEST_F(DriveCacheTest, DirtyCacheRepetitive) { // First store a file to cache. TestStoreToCache(resource_id, md5, GetTestFilePath("root_feed.json"), - GDATA_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); // Mark the file dirty. num_callback_invocations_ = 0; - TestMarkDirty(resource_id, md5, GDATA_FILE_OK, + TestMarkDirty(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_DIRTY | test_util::TEST_CACHE_STATE_PERSISTENT, @@ -1253,7 +1253,7 @@ TEST_F(DriveCacheTest, DirtyCacheRepetitive) { // Again, mark the file dirty. Nothing should change. num_callback_invocations_ = 0; - TestMarkDirty(resource_id, md5, GDATA_FILE_OK, + TestMarkDirty(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_DIRTY | test_util::TEST_CACHE_STATE_PERSISTENT, @@ -1262,7 +1262,7 @@ TEST_F(DriveCacheTest, DirtyCacheRepetitive) { // Commit the file dirty. Outgoing symlink should be created. num_callback_invocations_ = 0; - TestCommitDirty(resource_id, md5, GDATA_FILE_OK, + TestCommitDirty(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_DIRTY | test_util::TEST_CACHE_STATE_PERSISTENT, @@ -1271,7 +1271,7 @@ TEST_F(DriveCacheTest, DirtyCacheRepetitive) { // Again, commit the file dirty. Nothing should change. num_callback_invocations_ = 0; - TestCommitDirty(resource_id, md5, GDATA_FILE_OK, + TestCommitDirty(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_DIRTY | test_util::TEST_CACHE_STATE_PERSISTENT, @@ -1281,7 +1281,7 @@ TEST_F(DriveCacheTest, DirtyCacheRepetitive) { // Mark the file dirty agian after it's being committed. Outgoing symlink // should be deleted. num_callback_invocations_ = 0; - TestMarkDirty(resource_id, md5, GDATA_FILE_OK, + TestMarkDirty(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_DIRTY | test_util::TEST_CACHE_STATE_PERSISTENT, @@ -1290,7 +1290,7 @@ TEST_F(DriveCacheTest, DirtyCacheRepetitive) { // Commit the file dirty. Outgoing symlink should be created again. num_callback_invocations_ = 0; - TestCommitDirty(resource_id, md5, GDATA_FILE_OK, + TestCommitDirty(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_DIRTY | test_util::TEST_CACHE_STATE_PERSISTENT, @@ -1299,14 +1299,14 @@ TEST_F(DriveCacheTest, DirtyCacheRepetitive) { // Clear dirty state of the file. num_callback_invocations_ = 0; - TestClearDirty(resource_id, md5, GDATA_FILE_OK, + TestClearDirty(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); EXPECT_EQ(1, num_callback_invocations_); // Again, clear dirty state of the file, which is no longer dirty. num_callback_invocations_ = 0; - TestClearDirty(resource_id, md5, GDATA_FILE_ERROR_INVALID_OPERATION, + TestClearDirty(resource_id, md5, DRIVE_FILE_ERROR_INVALID_OPERATION, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); EXPECT_EQ(1, num_callback_invocations_); @@ -1321,47 +1321,47 @@ TEST_F(DriveCacheTest, DirtyCacheInvalid) { // Mark a non-existent file dirty. num_callback_invocations_ = 0; - TestMarkDirty(resource_id, md5, GDATA_FILE_ERROR_NOT_FOUND, + TestMarkDirty(resource_id, md5, DRIVE_FILE_ERROR_NOT_FOUND, test_util::TEST_CACHE_STATE_NONE, DriveCache::CACHE_TYPE_TMP); EXPECT_EQ(1, num_callback_invocations_); // Commit a non-existent file dirty. num_callback_invocations_ = 0; - TestCommitDirty(resource_id, md5, GDATA_FILE_ERROR_NOT_FOUND, + TestCommitDirty(resource_id, md5, DRIVE_FILE_ERROR_NOT_FOUND, test_util::TEST_CACHE_STATE_NONE, DriveCache::CACHE_TYPE_TMP); EXPECT_EQ(1, num_callback_invocations_); // Clear dirty state of a non-existent file. num_callback_invocations_ = 0; - TestClearDirty(resource_id, md5, GDATA_FILE_ERROR_NOT_FOUND, + TestClearDirty(resource_id, md5, DRIVE_FILE_ERROR_NOT_FOUND, test_util::TEST_CACHE_STATE_NONE, DriveCache::CACHE_TYPE_TMP); EXPECT_EQ(1, num_callback_invocations_); // Store a file to cache. TestStoreToCache(resource_id, md5, GetTestFilePath("root_feed.json"), - GDATA_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); // Commit a non-dirty existing file dirty. num_callback_invocations_ = 0; - TestCommitDirty(resource_id, md5, GDATA_FILE_ERROR_INVALID_OPERATION, + TestCommitDirty(resource_id, md5, DRIVE_FILE_ERROR_INVALID_OPERATION, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); EXPECT_EQ(1, num_callback_invocations_); // Clear dirty state of a non-dirty existing file. num_callback_invocations_ = 0; - TestClearDirty(resource_id, md5, GDATA_FILE_ERROR_INVALID_OPERATION, + TestClearDirty(resource_id, md5, DRIVE_FILE_ERROR_INVALID_OPERATION, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); EXPECT_EQ(1, num_callback_invocations_); // Mark an existing file dirty, then store a new file to the same resource id // but different md5, which should fail. - TestMarkDirty(resource_id, md5, GDATA_FILE_OK, + TestMarkDirty(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_DIRTY | test_util::TEST_CACHE_STATE_PERSISTENT, @@ -1369,7 +1369,7 @@ TEST_F(DriveCacheTest, DirtyCacheInvalid) { num_callback_invocations_ = 0; md5 = "new_md5"; TestStoreToCache(resource_id, md5, GetTestFilePath("subdir_feed.json"), - GDATA_FILE_ERROR_IN_USE, + DRIVE_FILE_ERROR_IN_USE, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_DIRTY | test_util::TEST_CACHE_STATE_PERSISTENT, @@ -1388,20 +1388,20 @@ TEST_F(DriveCacheTest, RemoveFromDirtyCache) { // Store a file to cache, pin it, mark it dirty and commit it. TestStoreToCache(resource_id, md5, GetTestFilePath("root_feed.json"), - GDATA_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); - TestPin(resource_id, md5, GDATA_FILE_OK, + TestPin(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_PINNED | test_util::TEST_CACHE_STATE_PERSISTENT, DriveCache::CACHE_TYPE_PERSISTENT); - TestMarkDirty(resource_id, md5, GDATA_FILE_OK, + TestMarkDirty(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_PINNED | test_util::TEST_CACHE_STATE_DIRTY | test_util::TEST_CACHE_STATE_PERSISTENT, DriveCache::CACHE_TYPE_PERSISTENT); - TestCommitDirty(resource_id, md5, GDATA_FILE_OK, + TestCommitDirty(resource_id, md5, DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_PINNED | test_util::TEST_CACHE_STATE_DIRTY | @@ -1411,7 +1411,7 @@ TEST_F(DriveCacheTest, RemoveFromDirtyCache) { // Try to remove the file. Since file is dirty, it and the corresponding // pinned and outgoing symlinks should not be removed. num_callback_invocations_ = 0; - TestRemoveFromCache(resource_id, GDATA_FILE_OK); + TestRemoveFromCache(resource_id, DRIVE_FILE_OK); EXPECT_EQ(1, num_callback_invocations_); } @@ -1425,7 +1425,7 @@ TEST_F(DriveCacheTest, MountUnmount) { // First store a file to cache in the tmp subdir. TestStoreToCache(resource_id, md5, GetTestFilePath("root_feed.json"), - GDATA_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); // Mark the file mounted. @@ -1434,7 +1434,7 @@ TEST_F(DriveCacheTest, MountUnmount) { DriveCache::CACHE_TYPE_TMP, DriveCache::CACHED_FILE_FROM_SERVER); TestSetMountedState(resource_id, md5, file_path, true, - GDATA_FILE_OK, + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_MOUNTED | test_util::TEST_CACHE_STATE_PERSISTENT, @@ -1449,7 +1449,7 @@ TEST_F(DriveCacheTest, MountUnmount) { DriveCache::CACHE_TYPE_PERSISTENT, DriveCache::CACHED_FILE_MOUNTED); TestSetMountedState(resource_id, md5, file_path, false, - GDATA_FILE_OK, + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); EXPECT_EQ(1, num_callback_invocations_); @@ -1457,7 +1457,7 @@ TEST_F(DriveCacheTest, MountUnmount) { // Try to remove the file. num_callback_invocations_ = 0; - TestRemoveFromCache(resource_id, GDATA_FILE_OK); + TestRemoveFromCache(resource_id, DRIVE_FILE_OK); EXPECT_EQ(1, num_callback_invocations_); } @@ -1524,7 +1524,7 @@ TEST_F(DriveCacheTest, ClearAllOnUIThread) { // Store an existing file. TestStoreToCache(resource_id, md5, GetTestFilePath("root_feed.json"), - GDATA_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); EXPECT_EQ(1, num_callback_invocations_); @@ -1532,13 +1532,13 @@ TEST_F(DriveCacheTest, ClearAllOnUIThread) { EXPECT_EQ(1U, CountCacheFiles(resource_id, md5)); // Clear cache. - GDataFileError error = GDATA_FILE_OK; + DriveFileError error = DRIVE_FILE_OK; FilePath file_path; cache_->ClearAllOnUIThread(base::Bind(&OnClearAll, &error, &file_path)); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_OK, error); + EXPECT_EQ(DRIVE_FILE_OK, error); // Verify that all the cache is removed. VerifyRemoveFromCache(error, resource_id, md5); @@ -1554,7 +1554,7 @@ TEST_F(DriveCacheTest, StoreToCacheNoSpace) { // Try to store an existing file. TestStoreToCache(resource_id, md5, GetTestFilePath("root_feed.json"), - GDATA_FILE_ERROR_NO_SPACE, + DRIVE_FILE_ERROR_NO_SPACE, test_util::TEST_CACHE_STATE_NONE, DriveCache::CACHE_TYPE_TMP); EXPECT_EQ(1, num_callback_invocations_); diff --git a/chrome/browser/chromeos/gdata/drive_files.h b/chrome/browser/chromeos/gdata/drive_files.h index f25c5d5..ea28f37 100644 --- a/chrome/browser/chromeos/gdata/drive_files.h +++ b/chrome/browser/chromeos/gdata/drive_files.h @@ -26,7 +26,7 @@ class DriveResourceMetadata; class PlatformFileInfoProto; // Used to read a directory from the file system. -// If |error| is not GDATA_FILE_OK, |entries| is set to NULL. +// If |error| is not DRIVE_FILE_OK, |entries| is set to NULL. // |entries| are contents, both files and directories, of the directory. typedef std::vector<DriveEntryProto> DriveEntryProtoVector; diff --git a/chrome/browser/chromeos/gdata/drive_resource_metadata.cc b/chrome/browser/chromeos/gdata/drive_resource_metadata.cc index c7f26ca..1fc37be 100644 --- a/chrome/browser/chromeos/gdata/drive_resource_metadata.cc +++ b/chrome/browser/chromeos/gdata/drive_resource_metadata.cc @@ -30,7 +30,7 @@ const char kDBKeyResourceIdPrefix[] = "r:"; } // namespace -EntryInfoResult::EntryInfoResult() : error(GDATA_FILE_ERROR_FAILED) { +EntryInfoResult::EntryInfoResult() : error(DRIVE_FILE_ERROR_FAILED) { } EntryInfoResult::~EntryInfoResult() { @@ -230,7 +230,7 @@ void DriveResourceMetadata::AddEntryToDirectory( directory->AddEntry(new_entry); DVLOG(1) << "AddEntryToDirectory " << new_entry->GetFilePath().value(); base::MessageLoopProxy::current()->PostTask(FROM_HERE, - base::Bind(callback, GDATA_FILE_OK, new_entry->GetFilePath())); + base::Bind(callback, DRIVE_FILE_OK, new_entry->GetFilePath())); } void DriveResourceMetadata::MoveEntryToDirectory( @@ -246,15 +246,15 @@ void DriveResourceMetadata::MoveEntryToDirectory( DriveEntry* destination = FindEntryByPathSync(directory_path); FilePath moved_file_path; - GDataFileError error = GDATA_FILE_ERROR_FAILED; + DriveFileError error = DRIVE_FILE_ERROR_FAILED; if (!destination) { - error = GDATA_FILE_ERROR_NOT_FOUND; + error = DRIVE_FILE_ERROR_NOT_FOUND; } else if (!destination->AsDriveDirectory()) { - error = GDATA_FILE_ERROR_NOT_A_DIRECTORY; + error = DRIVE_FILE_ERROR_NOT_A_DIRECTORY; } else { destination->AsDriveDirectory()->AddEntry(entry); moved_file_path = entry->GetFilePath(); - error = GDATA_FILE_OK; + error = DRIVE_FILE_OK; } DVLOG(1) << "MoveEntryToDirectory " << moved_file_path.value(); base::MessageLoopProxy::current()->PostTask( @@ -271,7 +271,7 @@ void DriveResourceMetadata::RemoveEntryFromParent( parent->RemoveEntry(entry); base::MessageLoopProxy::current()->PostTask(FROM_HERE, - base::Bind(callback, GDATA_FILE_OK, parent->GetFilePath())); + base::Bind(callback, DRIVE_FILE_OK, parent->GetFilePath())); } void DriveResourceMetadata::AddEntryToResourceMap(DriveEntry* entry) { @@ -336,17 +336,17 @@ void DriveResourceMetadata::GetEntryInfoByResourceId( DCHECK(!callback.is_null()); scoped_ptr<DriveEntryProto> entry_proto; - GDataFileError error = GDATA_FILE_ERROR_FAILED; + DriveFileError error = DRIVE_FILE_ERROR_FAILED; FilePath drive_file_path; DriveEntry* entry = GetEntryByResourceId(resource_id); if (entry) { entry_proto.reset(new DriveEntryProto); entry->ToProtoFull(entry_proto.get()); - error = GDATA_FILE_OK; + error = DRIVE_FILE_OK; drive_file_path = entry->GetFilePath(); } else { - error = GDATA_FILE_ERROR_NOT_FOUND; + error = DRIVE_FILE_ERROR_NOT_FOUND; } base::MessageLoopProxy::current()->PostTask( @@ -364,15 +364,15 @@ void DriveResourceMetadata::GetEntryInfoByPath( DCHECK(!callback.is_null()); scoped_ptr<DriveEntryProto> entry_proto; - GDataFileError error = GDATA_FILE_ERROR_FAILED; + DriveFileError error = DRIVE_FILE_ERROR_FAILED; DriveEntry* entry = FindEntryByPathSync(path); if (entry) { entry_proto.reset(new DriveEntryProto); entry->ToProtoFull(entry_proto.get()); - error = GDATA_FILE_OK; + error = DRIVE_FILE_OK; } else { - error = GDATA_FILE_ERROR_NOT_FOUND; + error = DRIVE_FILE_ERROR_NOT_FOUND; } base::MessageLoopProxy::current()->PostTask( @@ -387,16 +387,16 @@ void DriveResourceMetadata::ReadDirectoryByPath( DCHECK(!callback.is_null()); scoped_ptr<DriveEntryProtoVector> entries; - GDataFileError error = GDATA_FILE_ERROR_FAILED; + DriveFileError error = DRIVE_FILE_ERROR_FAILED; DriveEntry* entry = FindEntryByPathSync(path); if (entry && entry->AsDriveDirectory()) { entries = entry->AsDriveDirectory()->ToProtoVector(); - error = GDATA_FILE_OK; + error = DRIVE_FILE_OK; } else if (entry && !entry->AsDriveDirectory()) { - error = GDATA_FILE_ERROR_NOT_A_DIRECTORY; + error = DRIVE_FILE_ERROR_NOT_A_DIRECTORY; } else { - error = GDATA_FILE_ERROR_NOT_FOUND; + error = DRIVE_FILE_ERROR_NOT_FOUND; } base::MessageLoopProxy::current()->PostTask( @@ -466,13 +466,13 @@ void DriveResourceMetadata::RefreshDirectoryInternal( DCHECK(!callback.is_null()); if (!directory_entry) { - callback.Run(GDATA_FILE_ERROR_NOT_FOUND, FilePath()); + callback.Run(DRIVE_FILE_ERROR_NOT_FOUND, FilePath()); return; } DriveDirectory* directory = directory_entry->AsDriveDirectory(); if (!directory) { - callback.Run(GDATA_FILE_ERROR_NOT_A_DIRECTORY, FilePath()); + callback.Run(DRIVE_FILE_ERROR_NOT_A_DIRECTORY, FilePath()); return; } @@ -488,7 +488,7 @@ void DriveResourceMetadata::RefreshDirectoryInternal( directory->AddEntry(entry.release()); } - callback.Run(GDATA_FILE_OK, directory->GetFilePath()); + callback.Run(DRIVE_FILE_OK, directory->GetFilePath()); } void DriveResourceMetadata::InitFromDB( @@ -501,7 +501,7 @@ void DriveResourceMetadata::InitFromDB( if (resource_metadata_db_.get()) { if (!callback.is_null()) - callback.Run(GDATA_FILE_ERROR_FAILED); + callback.Run(DRIVE_FILE_ERROR_FAILED); return; } @@ -533,7 +533,7 @@ void DriveResourceMetadata::InitResourceMap( if (serialized_resources->empty()) { origin_ = INITIALIZING; if (!callback.is_null()) - callback.Run(GDATA_FILE_ERROR_NOT_FOUND); + callback.Run(DRIVE_FILE_ERROR_NOT_FOUND); return; } @@ -546,7 +546,7 @@ void DriveResourceMetadata::InitResourceMap( !base::StringToInt(iter->second, &version) || version != kProtoVersion) { if (!callback.is_null()) - callback.Run(GDATA_FILE_ERROR_FAILED); + callback.Run(DRIVE_FILE_ERROR_FAILED); return; } serialized_resources->erase(iter); @@ -557,7 +557,7 @@ void DriveResourceMetadata::InitResourceMap( !base::StringToInt64(iter->second, &largest_changestamp_)) { NOTREACHED() << "Could not find/parse largest_changestamp"; if (!callback.is_null()) - callback.Run(GDATA_FILE_ERROR_FAILED); + callback.Run(DRIVE_FILE_ERROR_FAILED); return; } else { DVLOG(1) << "InitResourceMap largest_changestamp_" << largest_changestamp_; @@ -616,7 +616,7 @@ void DriveResourceMetadata::InitResourceMap( origin_ = FROM_CACHE; if (!callback.is_null()) - callback.Run(GDATA_FILE_OK); + callback.Run(DRIVE_FILE_OK); } void DriveResourceMetadata::SaveToDB() { @@ -714,7 +714,7 @@ void DriveResourceMetadata::GetEntryInfoPairByPathsAfterGetFirst( const FilePath& first_path, const FilePath& second_path, const GetEntryInfoPairCallback& callback, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -725,7 +725,7 @@ void DriveResourceMetadata::GetEntryInfoPairByPathsAfterGetFirst( result->first.proto = entry_proto.Pass(); // If the first one is not found, don't continue. - if (error != GDATA_FILE_OK) { + if (error != DRIVE_FILE_OK) { callback.Run(result.Pass()); return; } @@ -744,7 +744,7 @@ void DriveResourceMetadata::GetEntryInfoPairByPathsAfterGetSecond( const FilePath& second_path, const GetEntryInfoPairCallback& callback, scoped_ptr<EntryInfoPairResult> result, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); diff --git a/chrome/browser/chromeos/gdata/drive_resource_metadata.h b/chrome/browser/chromeos/gdata/drive_resource_metadata.h index 083d22a..8d871e1 100644 --- a/chrome/browser/chromeos/gdata/drive_resource_metadata.h +++ b/chrome/browser/chromeos/gdata/drive_resource_metadata.h @@ -66,36 +66,36 @@ const int32 kProtoVersion = 2; // Callback type used to get result of file search. // If |error| is not PLATFORM_FILE_OK, |entry| is set to NULL. -typedef base::Callback<void(GDataFileError error, DriveEntry* entry)> +typedef base::Callback<void(DriveFileError error, DriveEntry* entry)> FindEntryCallback; // Used for file operations like removing files. -typedef base::Callback<void(GDataFileError error)> +typedef base::Callback<void(DriveFileError error)> FileOperationCallback; // Callback similar to FileOperationCallback but with a given |file_path|. // Used for operations that change a file path like moving files. -typedef base::Callback<void(GDataFileError error, +typedef base::Callback<void(DriveFileError error, const FilePath& file_path)> FileMoveCallback; // Used to get entry info from the file system. -// If |error| is not GDATA_FILE_OK, |entry_info| is set to NULL. -typedef base::Callback<void(GDataFileError error, +// If |error| is not DRIVE_FILE_OK, |entry_info| is set to NULL. +typedef base::Callback<void(DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto)> GetEntryInfoCallback; -typedef base::Callback<void(GDataFileError error, +typedef base::Callback<void(DriveFileError error, scoped_ptr<DriveEntryProtoVector> entries)> ReadDirectoryCallback; // Used to get entry info from the file system, with the Drive file path. -// If |error| is not GDATA_FILE_OK, |entry_proto| is set to NULL. +// If |error| is not DRIVE_FILE_OK, |entry_proto| is set to NULL. // // |drive_file_path| parameter is provided as DriveEntryProto does not contain // the Drive file path (i.e. only contains the base name without parent // directory names). -typedef base::Callback<void(GDataFileError error, +typedef base::Callback<void(DriveFileError error, const FilePath& drive_file_path, scoped_ptr<DriveEntryProto> entry_proto)> GetEntryInfoWithFilePathCallback; @@ -106,7 +106,7 @@ struct EntryInfoResult { ~EntryInfoResult(); FilePath path; - GDataFileError error; + DriveFileError error; scoped_ptr<DriveEntryProto> proto; }; @@ -283,7 +283,7 @@ class DriveResourceMetadata { const FilePath& first_path, const FilePath& second_path, const GetEntryInfoPairCallback& callback, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto); // Continues with GetIntroInfoPairByPaths after the second DriveEntry has been @@ -292,7 +292,7 @@ class DriveResourceMetadata { const FilePath& second_path, const GetEntryInfoPairCallback& callback, scoped_ptr<EntryInfoPairResult> result, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto); // These internal functions need friend access to private DriveDirectory diff --git a/chrome/browser/chromeos/gdata/drive_resource_metadata_unittest.cc b/chrome/browser/chromeos/gdata/drive_resource_metadata_unittest.cc index 04ba10e..e58c1fc 100644 --- a/chrome/browser/chromeos/gdata/drive_resource_metadata_unittest.cc +++ b/chrome/browser/chromeos/gdata/drive_resource_metadata_unittest.cc @@ -39,7 +39,7 @@ DriveDirectory* AddDirectory(DriveDirectory* parent, dir_name; dir->set_title(dir_name); dir->set_resource_id(resource_id); - GDataFileError error = GDATA_FILE_ERROR_FAILED; + DriveFileError error = DRIVE_FILE_ERROR_FAILED; FilePath moved_file_path; resource_metadata->MoveEntryToDirectory( parent->GetFilePath(), @@ -48,7 +48,7 @@ DriveDirectory* AddDirectory(DriveDirectory* parent, &error, &moved_file_path)); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_OK, error); + EXPECT_EQ(DRIVE_FILE_OK, error); EXPECT_EQ(parent->GetFilePath().AppendASCII(dir_name), moved_file_path); return dir; } @@ -65,7 +65,7 @@ DriveFile* AddFile(DriveDirectory* parent, file->set_title(title); file->set_resource_id(resource_id); file->set_file_md5(std::string("file_md5:") + title); - GDataFileError error = GDATA_FILE_ERROR_FAILED; + DriveFileError error = DRIVE_FILE_ERROR_FAILED; FilePath moved_file_path; resource_metadata->MoveEntryToDirectory( parent->GetFilePath(), @@ -74,7 +74,7 @@ DriveFile* AddFile(DriveDirectory* parent, &error, &moved_file_path)); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_OK, error); + EXPECT_EQ(DRIVE_FILE_OK, error); EXPECT_EQ(parent->GetFilePath().AppendASCII(title), moved_file_path); return file; } @@ -185,17 +185,17 @@ void VerifyDirectoryService(DriveResourceMetadata* resource_metadata) { } // Callback for DriveResourceMetadata::InitFromDB. -void InitFromDBCallback(GDataFileError expected_error, - GDataFileError actual_error) { +void InitFromDBCallback(DriveFileError expected_error, + DriveFileError actual_error) { EXPECT_EQ(expected_error, actual_error); } // Callback for DriveResourceMetadata::ReadDirectoryByPath. void ReadDirectoryByPathCallback( scoped_ptr<DriveEntryProtoVector>* result, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProtoVector> entries) { - EXPECT_EQ(GDATA_FILE_OK, error); + EXPECT_EQ(DRIVE_FILE_OK, error); *result = entries.Pass(); } @@ -248,7 +248,7 @@ TEST(DriveResourceMetadataTest, RefreshFile) { directory_entry->set_resource_id("folder:directory_resource_id"); directory_entry->set_title("directory"); directory_entry->SetBaseNameFromTitle(); - GDataFileError error = GDATA_FILE_ERROR_FAILED; + DriveFileError error = DRIVE_FILE_ERROR_FAILED; FilePath moved_file_path; FilePath root_path(kDriveRootDirectory); resource_metadata.MoveEntryToDirectory( @@ -258,7 +258,7 @@ TEST(DriveResourceMetadataTest, RefreshFile) { &error, &moved_file_path)); test_util::RunBlockingPoolTask(); - ASSERT_EQ(GDATA_FILE_OK, error); + ASSERT_EQ(DRIVE_FILE_OK, error); EXPECT_EQ(root_path.AppendASCII(directory_entry->base_name()), moved_file_path); @@ -267,7 +267,7 @@ TEST(DriveResourceMetadataTest, RefreshFile) { initial_file_entry->set_resource_id("file:file_resource_id"); initial_file_entry->set_title("file"); initial_file_entry->SetBaseNameFromTitle(); - error = GDATA_FILE_ERROR_FAILED; + error = DRIVE_FILE_ERROR_FAILED; moved_file_path.clear(); resource_metadata.MoveEntryToDirectory( directory_entry->GetFilePath(), @@ -276,7 +276,7 @@ TEST(DriveResourceMetadataTest, RefreshFile) { &error, &moved_file_path)); test_util::RunBlockingPoolTask(); - ASSERT_EQ(GDATA_FILE_OK, error); + ASSERT_EQ(DRIVE_FILE_OK, error); EXPECT_EQ(directory_entry->GetFilePath().AppendASCII( initial_file_entry->base_name()), moved_file_path); @@ -323,7 +323,7 @@ TEST(DriveResourceMetadataTest, GetEntryInfoByResourceId) { InitDirectoryService(&resource_metadata); // Confirm that an existing file is found. - GDataFileError error = GDATA_FILE_ERROR_FAILED; + DriveFileError error = DRIVE_FILE_ERROR_FAILED; FilePath drive_file_path; scoped_ptr<DriveEntryProto> entry_proto; resource_metadata.GetEntryInfoByResourceId( @@ -331,20 +331,20 @@ TEST(DriveResourceMetadataTest, GetEntryInfoByResourceId) { base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback, &error, &drive_file_path, &entry_proto)); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_OK, error); + EXPECT_EQ(DRIVE_FILE_OK, error); EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file4"), drive_file_path); ASSERT_TRUE(entry_proto.get()); EXPECT_EQ("file4", entry_proto->base_name()); // Confirm that a non existing file is not found. - error = GDATA_FILE_ERROR_FAILED; + error = DRIVE_FILE_ERROR_FAILED; entry_proto.reset(); resource_metadata.GetEntryInfoByResourceId( "file:non_existing", base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback, &error, &drive_file_path, &entry_proto)); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_ERROR_NOT_FOUND, error); + EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); EXPECT_FALSE(entry_proto.get()); } @@ -356,26 +356,26 @@ TEST(DriveResourceMetadataTest, GetEntryInfoByPath) { InitDirectoryService(&resource_metadata); // Confirm that an existing file is found. - GDataFileError error = GDATA_FILE_ERROR_FAILED; + DriveFileError error = DRIVE_FILE_ERROR_FAILED; scoped_ptr<DriveEntryProto> entry_proto; resource_metadata.GetEntryInfoByPath( FilePath::FromUTF8Unsafe("drive/dir1/file4"), base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback, &error, &entry_proto)); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_OK, error); + EXPECT_EQ(DRIVE_FILE_OK, error); ASSERT_TRUE(entry_proto.get()); EXPECT_EQ("file4", entry_proto->base_name()); // Confirm that a non existing file is not found. - error = GDATA_FILE_ERROR_FAILED; + error = DRIVE_FILE_ERROR_FAILED; entry_proto.reset(); resource_metadata.GetEntryInfoByPath( FilePath::FromUTF8Unsafe("drive/dir1/non_existing"), base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback, &error, &entry_proto)); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_ERROR_NOT_FOUND, error); + EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); EXPECT_FALSE(entry_proto.get()); } @@ -387,14 +387,14 @@ TEST(DriveResourceMetadataTest, ReadDirectoryByPath) { InitDirectoryService(&resource_metadata); // Confirm that an existing directory is found. - GDataFileError error = GDATA_FILE_ERROR_FAILED; + DriveFileError error = DRIVE_FILE_ERROR_FAILED; scoped_ptr<DriveEntryProtoVector> entries; resource_metadata.ReadDirectoryByPath( FilePath::FromUTF8Unsafe("drive/dir1"), base::Bind(&test_util::CopyResultsFromReadDirectoryCallback, &error, &entries)); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_OK, error); + EXPECT_EQ(DRIVE_FILE_OK, error); ASSERT_TRUE(entries.get()); ASSERT_EQ(3U, entries->size()); @@ -409,25 +409,25 @@ TEST(DriveResourceMetadataTest, ReadDirectoryByPath) { EXPECT_EQ("file5", base_names[2]); // Confirm that a non existing directory is not found. - error = GDATA_FILE_ERROR_FAILED; + error = DRIVE_FILE_ERROR_FAILED; entries.reset(); resource_metadata.ReadDirectoryByPath( FilePath::FromUTF8Unsafe("drive/non_existing"), base::Bind(&test_util::CopyResultsFromReadDirectoryCallback, &error, &entries)); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_ERROR_NOT_FOUND, error); + EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); EXPECT_FALSE(entries.get()); - // Confirm that reading a file results in GDATA_FILE_ERROR_NOT_A_DIRECTORY. - error = GDATA_FILE_ERROR_FAILED; + // Confirm that reading a file results in DRIVE_FILE_ERROR_NOT_A_DIRECTORY. + error = DRIVE_FILE_ERROR_FAILED; entries.reset(); resource_metadata.ReadDirectoryByPath( FilePath::FromUTF8Unsafe("drive/dir1/file4"), base::Bind(&test_util::CopyResultsFromReadDirectoryCallback, &error, &entries)); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_ERROR_NOT_A_DIRECTORY, error); + EXPECT_EQ(DRIVE_FILE_ERROR_NOT_A_DIRECTORY, error); EXPECT_FALSE(entries.get()); } @@ -447,13 +447,13 @@ TEST(DriveResourceMetadataTest, GetEntryInfoPairByPaths) { &pair_result)); test_util::RunBlockingPoolTask(); // The first entry should be found. - EXPECT_EQ(GDATA_FILE_OK, pair_result->first.error); + EXPECT_EQ(DRIVE_FILE_OK, pair_result->first.error); EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file4"), pair_result->first.path); ASSERT_TRUE(pair_result->first.proto.get()); EXPECT_EQ("file4", pair_result->first.proto->base_name()); // The second entry should be found. - EXPECT_EQ(GDATA_FILE_OK, pair_result->second.error); + EXPECT_EQ(DRIVE_FILE_OK, pair_result->second.error); EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file5"), pair_result->second.path); ASSERT_TRUE(pair_result->second.proto.get()); @@ -468,12 +468,12 @@ TEST(DriveResourceMetadataTest, GetEntryInfoPairByPaths) { &pair_result)); test_util::RunBlockingPoolTask(); // The first entry should not be found. - EXPECT_EQ(GDATA_FILE_ERROR_NOT_FOUND, pair_result->first.error); + EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, pair_result->first.error); EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/non_existent"), pair_result->first.path); ASSERT_FALSE(pair_result->first.proto.get()); // The second entry should not be found, because the first one failed. - EXPECT_EQ(GDATA_FILE_ERROR_FAILED, pair_result->second.error); + EXPECT_EQ(DRIVE_FILE_ERROR_FAILED, pair_result->second.error); EXPECT_EQ(FilePath(), pair_result->second.path); ASSERT_FALSE(pair_result->second.proto.get()); @@ -486,13 +486,13 @@ TEST(DriveResourceMetadataTest, GetEntryInfoPairByPaths) { &pair_result)); test_util::RunBlockingPoolTask(); // The first entry should be found. - EXPECT_EQ(GDATA_FILE_OK, pair_result->first.error); + EXPECT_EQ(DRIVE_FILE_OK, pair_result->first.error); EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file4"), pair_result->first.path); ASSERT_TRUE(pair_result->first.proto.get()); EXPECT_EQ("file4", pair_result->first.proto->base_name()); // The second entry should not be found. - EXPECT_EQ(GDATA_FILE_ERROR_NOT_FOUND, pair_result->second.error); + EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, pair_result->second.error); EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/non_existent"), pair_result->second.path); ASSERT_FALSE(pair_result->second.proto.get()); @@ -512,10 +512,10 @@ TEST(DriveResourceMetadataTest, DBTest) { DriveResourceMetadata resource_metadata; FilePath db_path(DriveCache::GetCacheRootPath(profile.get()). AppendASCII("meta").AppendASCII("resource_metadata.db")); - // InitFromDB should fail with GDATA_FILE_ERROR_NOT_FOUND since the db + // InitFromDB should fail with DRIVE_FILE_ERROR_NOT_FOUND since the db // doesn't exist. resource_metadata.InitFromDB(db_path, blocking_task_runner, - base::Bind(&InitFromDBCallback, GDATA_FILE_ERROR_NOT_FOUND)); + base::Bind(&InitFromDBCallback, DRIVE_FILE_ERROR_NOT_FOUND)); test_util::RunBlockingPoolTask(); InitDirectoryService(&resource_metadata); @@ -524,9 +524,9 @@ TEST(DriveResourceMetadataTest, DBTest) { test_util::RunBlockingPoolTask(); DriveResourceMetadata resource_metadata2; - // InitFromDB should succeed with GDATA_FILE_OK as the db now exists. + // InitFromDB should succeed with DRIVE_FILE_OK as the db now exists. resource_metadata2.InitFromDB(db_path, blocking_task_runner, - base::Bind(&InitFromDBCallback, GDATA_FILE_OK)); + base::Bind(&InitFromDBCallback, DRIVE_FILE_OK)); test_util::RunBlockingPoolTask(); VerifyDirectoryService(&resource_metadata2); diff --git a/chrome/browser/chromeos/gdata/drive_task_executor.cc b/chrome/browser/chromeos/gdata/drive_task_executor.cc index 610f56c..d3d0be7 100644 --- a/chrome/browser/chromeos/gdata/drive_task_executor.cc +++ b/chrome/browser/chromeos/gdata/drive_task_executor.cc @@ -79,7 +79,7 @@ bool DriveTaskExecutor::ExecuteAndNotify( } void DriveTaskExecutor::OnFileEntryFetched( - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { // If we aborted, then this will be zero. if (!current_index_) @@ -90,9 +90,9 @@ void DriveTaskExecutor::OnFileEntryFetched( // Here, we are only insterested in files. if (entry_proto.get() && !entry_proto->has_file_specific_info()) - error = GDATA_FILE_ERROR_NOT_FOUND; + error = DRIVE_FILE_ERROR_NOT_FOUND; - if (!system_service || error != GDATA_FILE_OK) { + if (!system_service || error != DRIVE_FILE_OK) { Done(false); return; } diff --git a/chrome/browser/chromeos/gdata/drive_task_executor.h b/chrome/browser/chromeos/gdata/drive_task_executor.h index f4980b5..b2273b3 100644 --- a/chrome/browser/chromeos/gdata/drive_task_executor.h +++ b/chrome/browser/chromeos/gdata/drive_task_executor.h @@ -36,7 +36,7 @@ class DriveTaskExecutor : public file_handler_util::FileTaskExecutor { const std::string& action_id); virtual ~DriveTaskExecutor(); - void OnFileEntryFetched(GDataFileError error, + void OnFileEntryFetched(DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto); void OnAppAuthorized(const std::string& resource_id, GDataErrorCode error, diff --git a/chrome/browser/chromeos/gdata/file_write_helper.cc b/chrome/browser/chromeos/gdata/file_write_helper.cc index a6b7137..3a2b670 100644 --- a/chrome/browser/chromeos/gdata/file_write_helper.cc +++ b/chrome/browser/chromeos/gdata/file_write_helper.cc @@ -40,10 +40,10 @@ void FileWriteHelper::PrepareWritableFileAndRun( void FileWriteHelper::PrepareWritableFileAndRunAfterCreateFile( const FilePath& file_path, const OpenFileCallback& callback, - GDataFileError error) { + DriveFileError error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (error != gdata::GDATA_FILE_OK) { + if (error != gdata::DRIVE_FILE_OK) { if (!callback.is_null()) { content::BrowserThread::GetBlockingPool()->PostTask( FROM_HERE, @@ -62,11 +62,11 @@ void FileWriteHelper::PrepareWritableFileAndRunAfterCreateFile( void FileWriteHelper::PrepareWritableFileAndRunAfterOpenFile( const FilePath& file_path, const OpenFileCallback& callback, - GDataFileError error, + DriveFileError error, const FilePath& local_cache_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (error != gdata::GDATA_FILE_OK) { + if (error != gdata::DRIVE_FILE_OK) { if (!callback.is_null()) { content::BrowserThread::GetBlockingPool()->PostTask( FROM_HERE, @@ -78,7 +78,7 @@ void FileWriteHelper::PrepareWritableFileAndRunAfterOpenFile( if (!callback.is_null()) { content::BrowserThread::GetBlockingPool()->PostTaskAndReply( FROM_HERE, - base::Bind(callback, GDATA_FILE_OK, local_cache_path), + base::Bind(callback, DRIVE_FILE_OK, local_cache_path), base::Bind(&FileWriteHelper::PrepareWritableFileAndRunAfterCallback, weak_ptr_factory_.GetWeakPtr(), file_path)); diff --git a/chrome/browser/chromeos/gdata/file_write_helper.h b/chrome/browser/chromeos/gdata/file_write_helper.h index c405bf1..c5dca70 100644 --- a/chrome/browser/chromeos/gdata/file_write_helper.h +++ b/chrome/browser/chromeos/gdata/file_write_helper.h @@ -36,11 +36,11 @@ class FileWriteHelper { void PrepareWritableFileAndRunAfterCreateFile( const FilePath& file_path, const OpenFileCallback& callback, - GDataFileError result); + DriveFileError result); void PrepareWritableFileAndRunAfterOpenFile( const FilePath& file_path, const OpenFileCallback& callback, - GDataFileError result, + DriveFileError result, const FilePath& local_cache_path); void PrepareWritableFileAndRunAfterCallback(const FilePath& file_path); diff --git a/chrome/browser/chromeos/gdata/file_write_helper_unittest.cc b/chrome/browser/chromeos/gdata/file_write_helper_unittest.cc index e5718d3..8f8d3c2 100644 --- a/chrome/browser/chromeos/gdata/file_write_helper_unittest.cc +++ b/chrome/browser/chromeos/gdata/file_write_helper_unittest.cc @@ -36,9 +36,9 @@ ACTION_P(MockCloseFile, error) { arg1.Run(error); } -void RecordOpenFileCallbackArguments(GDataFileError* error, +void RecordOpenFileCallbackArguments(DriveFileError* error, FilePath* path, - GDataFileError error_arg, + DriveFileError error_arg, const FilePath& path_arg) { base::ThreadRestrictions::AssertIOAllowed(); *error = error_arg; @@ -65,20 +65,20 @@ TEST_F(FileWriteHelperTest, PrepareFileForWritingSuccess) { const FilePath kLocalPath("/tmp/dummy.txt"); EXPECT_CALL(*mock_file_system_, CreateFile(kDrivePath, false, _)) - .WillOnce(MockCreateFile(GDATA_FILE_OK)); + .WillOnce(MockCreateFile(DRIVE_FILE_OK)); EXPECT_CALL(*mock_file_system_, OpenFile(kDrivePath, _)) - .WillOnce(MockOpenFile(GDATA_FILE_OK, kLocalPath)); + .WillOnce(MockOpenFile(DRIVE_FILE_OK, kLocalPath)); EXPECT_CALL(*mock_file_system_, CloseFile(kDrivePath, _)) - .WillOnce(MockCloseFile(GDATA_FILE_OK)); + .WillOnce(MockCloseFile(DRIVE_FILE_OK)); FileWriteHelper file_write_helper(mock_file_system_.get()); - GDataFileError error = GDATA_FILE_ERROR_FAILED; + DriveFileError error = DRIVE_FILE_ERROR_FAILED; FilePath path; file_write_helper.PrepareWritableFileAndRun( kDrivePath, base::Bind(&RecordOpenFileCallbackArguments, &error, &path)); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_OK, error); + EXPECT_EQ(DRIVE_FILE_OK, error); EXPECT_EQ(kLocalPath, path); } @@ -86,18 +86,18 @@ TEST_F(FileWriteHelperTest, PrepareFileForWritingCreateFail) { const FilePath kDrivePath("/drive/file.txt"); EXPECT_CALL(*mock_file_system_, CreateFile(kDrivePath, false, _)) - .WillOnce(MockCreateFile(GDATA_FILE_ERROR_ACCESS_DENIED)); + .WillOnce(MockCreateFile(DRIVE_FILE_ERROR_ACCESS_DENIED)); EXPECT_CALL(*mock_file_system_, OpenFile(_, _)).Times(0); EXPECT_CALL(*mock_file_system_, CloseFile(_, _)).Times(0); FileWriteHelper file_write_helper(mock_file_system_.get()); - GDataFileError error = GDATA_FILE_ERROR_FAILED; + DriveFileError error = DRIVE_FILE_ERROR_FAILED; FilePath path; file_write_helper.PrepareWritableFileAndRun( kDrivePath, base::Bind(&RecordOpenFileCallbackArguments, &error, &path)); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_ERROR_ACCESS_DENIED, error); + EXPECT_EQ(DRIVE_FILE_ERROR_ACCESS_DENIED, error); EXPECT_EQ(FilePath(), path); } @@ -105,19 +105,19 @@ TEST_F(FileWriteHelperTest, PrepareFileForWritingOpenFail) { const FilePath kDrivePath("/drive/file.txt"); EXPECT_CALL(*mock_file_system_, CreateFile(kDrivePath, false, _)) - .WillOnce(MockCreateFile(GDATA_FILE_OK)); + .WillOnce(MockCreateFile(DRIVE_FILE_OK)); EXPECT_CALL(*mock_file_system_, OpenFile(kDrivePath, _)) - .WillOnce(MockOpenFile(GDATA_FILE_ERROR_IN_USE, FilePath())); + .WillOnce(MockOpenFile(DRIVE_FILE_ERROR_IN_USE, FilePath())); EXPECT_CALL(*mock_file_system_, CloseFile(_, _)).Times(0); FileWriteHelper file_write_helper(mock_file_system_.get()); - GDataFileError error = GDATA_FILE_ERROR_FAILED; + DriveFileError error = DRIVE_FILE_ERROR_FAILED; FilePath path; file_write_helper.PrepareWritableFileAndRun( kDrivePath, base::Bind(&RecordOpenFileCallbackArguments, &error, &path)); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_ERROR_IN_USE, error); + EXPECT_EQ(DRIVE_FILE_ERROR_IN_USE, error); EXPECT_EQ(FilePath(), path); } diff --git a/chrome/browser/chromeos/gdata/gdata_contacts_service.cc b/chrome/browser/chromeos/gdata/gdata_contacts_service.cc index b8ef3f4..f57f6df 100644 --- a/chrome/browser/chromeos/gdata/gdata_contacts_service.cc +++ b/chrome/browser/chromeos/gdata/gdata_contacts_service.cc @@ -20,6 +20,7 @@ #include "base/timer.h" #include "base/values.h" #include "chrome/browser/chromeos/contacts/contact.pb.h" +#include "chrome/browser/chromeos/gdata/gdata_errorcode.h" #include "chrome/browser/chromeos/gdata/gdata_operations.h" #include "chrome/browser/chromeos/gdata/gdata_util.h" #include "chrome/browser/chromeos/gdata/operation_registry.h" diff --git a/chrome/browser/chromeos/gdata/gdata_contacts_service.h b/chrome/browser/chromeos/gdata/gdata_contacts_service.h index 011812e..0179d4b 100644 --- a/chrome/browser/chromeos/gdata/gdata_contacts_service.h +++ b/chrome/browser/chromeos/gdata/gdata_contacts_service.h @@ -15,7 +15,6 @@ #include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" #include "base/time.h" -#include "chrome/browser/chromeos/gdata/gdata_errorcode.h" #include "googleurl/src/gurl.h" class Profile; diff --git a/chrome/browser/chromeos/gdata/gdata_download_observer.cc b/chrome/browser/chromeos/gdata/gdata_download_observer.cc index 6249a56..757aa21b 100644 --- a/chrome/browser/chromeos/gdata/gdata_download_observer.cc +++ b/chrome/browser/chromeos/gdata/gdata_download_observer.cc @@ -135,9 +135,9 @@ void SubstituteGDataDownloadPathInternal(Profile* profile, // Callback for GDataFileSystem::CreateDirectory. void OnCreateDirectory(const base::Closure& substitute_callback, - GDataFileError error) { + DriveFileError error) { DVLOG(1) << "OnCreateDirectory " << error; - if (error == GDATA_FILE_OK) { + if (error == DRIVE_FILE_OK) { substitute_callback.Run(); } else { // TODO(achuith): Handle this. @@ -149,15 +149,15 @@ void OnCreateDirectory(const base::Closure& substitute_callback, void OnEntryFound(Profile* profile, const FilePath& gdata_dir_path, const base::Closure& substitute_callback, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { - if (error == GDATA_FILE_ERROR_NOT_FOUND) { + if (error == DRIVE_FILE_ERROR_NOT_FOUND) { // Destination gdata directory doesn't exist, so create it. const bool is_exclusive = false, is_recursive = true; GetSystemService(profile)->file_system()->CreateDirectory( gdata_dir_path, is_exclusive, is_recursive, base::Bind(&OnCreateDirectory, substitute_callback)); - } else if (error == GDATA_FILE_OK) { + } else if (error == DRIVE_FILE_OK) { substitute_callback.Run(); } else { // TODO(achuith): Handle this. @@ -505,7 +505,7 @@ void GDataDownloadObserver::CreateUploadFileInfo(DownloadItem* download) { void GDataDownloadObserver::CreateUploadFileInfoAfterCheckExistence( int32 download_id, scoped_ptr<UploadFileInfo> upload_file_info, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(upload_file_info.get()); @@ -559,7 +559,7 @@ void GDataDownloadObserver::CreateUploadFileInfoAfterCheckExistence( void GDataDownloadObserver::CreateUploadFileInfoAfterCheckTargetDir( int32 download_id, scoped_ptr<UploadFileInfo> upload_file_info, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(upload_file_info.get()); @@ -609,7 +609,7 @@ void GDataDownloadObserver::StartUpload( void GDataDownloadObserver::OnUploadComplete( int32 download_id, - GDataFileError error, + DriveFileError error, scoped_ptr<UploadFileInfo> upload_file_info) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(upload_file_info.get()); diff --git a/chrome/browser/chromeos/gdata/gdata_download_observer.h b/chrome/browser/chromeos/gdata/gdata_download_observer.h index 80a990c..08e8b79 100644 --- a/chrome/browser/chromeos/gdata/gdata_download_observer.h +++ b/chrome/browser/chromeos/gdata/gdata_download_observer.h @@ -119,7 +119,7 @@ class GDataDownloadObserver : public content::DownloadManager::Observer, void CreateUploadFileInfoAfterCheckExistence( int32 download_id, scoped_ptr<UploadFileInfo> upload_file_info, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto); // Callback for handling results of GDataFileSystem::GetEntryInfoByPath() @@ -129,7 +129,7 @@ class GDataDownloadObserver : public content::DownloadManager::Observer, void CreateUploadFileInfoAfterCheckTargetDir( int32 download_id, scoped_ptr<UploadFileInfo> upload_file_info, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto); // Starts the upload. @@ -142,7 +142,7 @@ class GDataDownloadObserver : public content::DownloadManager::Observer, // |upload_file_info| for use by MoveFileToDriveCache(). It also invokes the // MaybeCompleteDownload() method on the DownloadItem to allow it to complete. void OnUploadComplete(int32 download_id, - GDataFileError error, + DriveFileError error, scoped_ptr<UploadFileInfo> upload_file_info); // Moves the downloaded file to gdata cache. diff --git a/chrome/browser/chromeos/gdata/gdata_errorcode.h b/chrome/browser/chromeos/gdata/gdata_errorcode.h index e7072e7..e2d22e7 100644 --- a/chrome/browser/chromeos/gdata/gdata_errorcode.h +++ b/chrome/browser/chromeos/gdata/gdata_errorcode.h @@ -30,24 +30,24 @@ enum GDataErrorCode { GDATA_NO_CONNECTION = -104, }; -enum GDataFileError { - GDATA_FILE_OK = 0, - GDATA_FILE_ERROR_FAILED = -1, - GDATA_FILE_ERROR_IN_USE = -2, - GDATA_FILE_ERROR_EXISTS = -3, - GDATA_FILE_ERROR_NOT_FOUND = -4, - GDATA_FILE_ERROR_ACCESS_DENIED = -5, - GDATA_FILE_ERROR_TOO_MANY_OPENED = -6, - GDATA_FILE_ERROR_NO_MEMORY = -7, - GDATA_FILE_ERROR_NO_SPACE = -8, - GDATA_FILE_ERROR_NOT_A_DIRECTORY = -9, - GDATA_FILE_ERROR_INVALID_OPERATION = -10, - GDATA_FILE_ERROR_SECURITY = -11, - GDATA_FILE_ERROR_ABORT = -12, - GDATA_FILE_ERROR_NOT_A_FILE = -13, - GDATA_FILE_ERROR_NOT_EMPTY = -14, - GDATA_FILE_ERROR_INVALID_URL = -15, - GDATA_FILE_ERROR_NO_CONNECTION = -16, +enum DriveFileError { + DRIVE_FILE_OK = 0, + DRIVE_FILE_ERROR_FAILED = -1, + DRIVE_FILE_ERROR_IN_USE = -2, + DRIVE_FILE_ERROR_EXISTS = -3, + DRIVE_FILE_ERROR_NOT_FOUND = -4, + DRIVE_FILE_ERROR_ACCESS_DENIED = -5, + DRIVE_FILE_ERROR_TOO_MANY_OPENED = -6, + DRIVE_FILE_ERROR_NO_MEMORY = -7, + DRIVE_FILE_ERROR_NO_SPACE = -8, + DRIVE_FILE_ERROR_NOT_A_DIRECTORY = -9, + DRIVE_FILE_ERROR_INVALID_OPERATION = -10, + DRIVE_FILE_ERROR_SECURITY = -11, + DRIVE_FILE_ERROR_ABORT = -12, + DRIVE_FILE_ERROR_NOT_A_FILE = -13, + DRIVE_FILE_ERROR_NOT_EMPTY = -14, + DRIVE_FILE_ERROR_INVALID_URL = -15, + DRIVE_FILE_ERROR_NO_CONNECTION = -16, }; } // namespace gdata diff --git a/chrome/browser/chromeos/gdata/gdata_file_system.cc b/chrome/browser/chromeos/gdata/gdata_file_system.cc index 6c5679c..88cde5e 100644 --- a/chrome/browser/chromeos/gdata/gdata_file_system.cc +++ b/chrome/browser/chromeos/gdata/gdata_file_system.cc @@ -57,7 +57,7 @@ const int kGDataUpdateCheckIntervalInSec = 60; // Runs GetFileCallback with pointers dereferenced. // Used for PostTaskAndReply(). void RunGetFileCallbackHelper(const GetFileCallback& callback, - GDataFileError* error, + DriveFileError* error, FilePath* file_path, std::string* mime_type, DriveFileType* file_type) { @@ -73,7 +73,7 @@ void RunGetFileCallbackHelper(const GetFileCallback& callback, // Ditto for FileOperationCallback void RunFileOperationCallbackHelper( const FileOperationCallback& callback, - GDataFileError* error) { + DriveFileError* error) { DCHECK(error); if (!callback.is_null()) @@ -83,7 +83,7 @@ void RunFileOperationCallbackHelper( // Callback for cache file operations invoked by AddUploadedFileOnUIThread. void OnCacheUpdatedForAddUploadedFile( const base::Closure& callback, - GDataFileError /* error */, + DriveFileError /* error */, const std::string& /* resource_id */, const std::string& /* md5 */) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -95,7 +95,7 @@ void OnCacheUpdatedForAddUploadedFile( // OnTransferCompleted. void OnAddUploadFileCompleted( const FileOperationCallback& callback, - GDataFileError error) { + DriveFileError error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (!callback.is_null()) callback.Run(error); @@ -123,21 +123,21 @@ class InitialLoadObserver : public GDataFileSystemInterface::Observer { // Gets the file size of |local_file|. void GetLocalFileSizeOnBlockingPool(const FilePath& local_file, - GDataFileError* error, + DriveFileError* error, int64* file_size) { DCHECK(error); DCHECK(file_size); *file_size = 0; *error = file_util::GetFileSize(local_file, file_size) ? - GDATA_FILE_OK : - GDATA_FILE_ERROR_NOT_FOUND; + DRIVE_FILE_OK : + DRIVE_FILE_ERROR_NOT_FOUND; } // Gets the file size and the content type of |local_file|. void GetLocalFileInfoOnBlockingPool( const FilePath& local_file, - GDataFileError* error, + DriveFileError* error, int64* file_size, std::string* content_type) { DCHECK(error); @@ -149,8 +149,8 @@ void GetLocalFileInfoOnBlockingPool( *file_size = 0; *error = file_util::GetFileSize(local_file, file_size) ? - GDATA_FILE_OK : - GDATA_FILE_ERROR_NOT_FOUND; + DRIVE_FILE_OK : + DRIVE_FILE_ERROR_NOT_FOUND; } // Checks if a local file at |local_file_path| is a JSON file referencing a @@ -177,7 +177,7 @@ void CreateDocumentJsonFileOnBlockingPool( const FilePath& document_dir, const GURL& edit_url, const std::string& resource_id, - GDataFileError* error, + DriveFileError* error, FilePath* temp_file_path, std::string* mime_type, DriveFileType* file_type) { @@ -186,7 +186,7 @@ void CreateDocumentJsonFileOnBlockingPool( DCHECK(mime_type); DCHECK(file_type); - *error = GDATA_FILE_ERROR_FAILED; + *error = DRIVE_FILE_ERROR_FAILED; if (file_util::CreateTemporaryFileInDir(document_dir, temp_file_path)) { std::string document_content = base::StringPrintf( @@ -195,13 +195,13 @@ void CreateDocumentJsonFileOnBlockingPool( int document_size = static_cast<int>(document_content.size()); if (file_util::WriteFile(*temp_file_path, document_content.data(), document_size) == document_size) { - *error = GDATA_FILE_OK; + *error = DRIVE_FILE_OK; } } *mime_type = kMimeTypeJson; *file_type = HOSTED_DOCUMENT; - if (*error != GDATA_FILE_OK) + if (*error != DRIVE_FILE_OK) temp_file_path->clear(); } @@ -215,16 +215,16 @@ void GetFileInfoOnBlockingPool(const FilePath& path, // Copies a file from |src_file_path| to |dest_file_path| on the local // file system using file_util::CopyFile. |error| is set to -// GDATA_FILE_OK on success or GDATA_FILE_ERROR_FAILED +// DRIVE_FILE_OK on success or DRIVE_FILE_ERROR_FAILED // otherwise. void CopyLocalFileOnBlockingPool( const FilePath& src_file_path, const FilePath& dest_file_path, - GDataFileError* error) { + DriveFileError* error) { DCHECK(error); *error = file_util::CopyFile(src_file_path, dest_file_path) ? - GDATA_FILE_OK : GDATA_FILE_ERROR_FAILED; + DRIVE_FILE_OK : DRIVE_FILE_ERROR_FAILED; } // Callback for GetEntryByResourceIdAsync. @@ -236,7 +236,7 @@ void AddEntryToSearchResults( std::vector<SearchResultInfo>* results, const SearchCallback& callback, const base::Closure& entry_skipped_callback, - GDataFileError error, + DriveFileError error, bool run_callback, const GURL& next_feed, DriveEntry* entry) { @@ -264,7 +264,7 @@ void AddEntryToSearchResults( void RunGetEntryInfoWithFilePathCallback( const GetEntryInfoWithFilePathCallback& callback, const FilePath& path, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { if (!callback.is_null()) callback.Run(error, path, entry_proto.Pass()); @@ -466,10 +466,10 @@ void GDataFileSystem::CheckForUpdates() { } void GDataFileSystem::OnUpdateChecked(ContentOrigin initial_origin, - GDataFileError error) { + DriveFileError error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (error != GDATA_FILE_OK) + if (error != DRIVE_FILE_OK) resource_metadata_->set_origin(initial_origin); } @@ -560,7 +560,7 @@ void GDataFileSystem::GetEntryInfoByEntryOnUIThread( base::Bind(&RunGetEntryInfoWithFilePathCallback, callback, entry->GetFilePath())); } else { - callback.Run(GDATA_FILE_ERROR_NOT_FOUND, + callback.Run(DRIVE_FILE_ERROR_NOT_FOUND, FilePath(), scoped_ptr<DriveEntryProto>()); } @@ -575,7 +575,7 @@ void GDataFileSystem::LoadFeedIfNeeded(const FileOperationCallback& callback) { // already started, add an observer to execute the remaining task after // the end of the initialization. AddObserver(new InitialLoadObserver(this, - base::Bind(callback, GDATA_FILE_OK))); + base::Bind(callback, DRIVE_FILE_OK))); return; } else if (resource_metadata_->origin() == UNINITIALIZED) { // Load root feed from this disk cache. Upon completion, kick off server @@ -594,7 +594,7 @@ void GDataFileSystem::LoadFeedIfNeeded(const FileOperationCallback& callback) { // LoadFeedIfNeeded() is asynchronous. base::MessageLoopProxy::current()->PostTask( FROM_HERE, - base::Bind(callback, GDATA_FILE_OK)); + base::Bind(callback, DRIVE_FILE_OK)); } void GDataFileSystem::TransferFileFromRemoteToLocal( @@ -634,12 +634,12 @@ void GDataFileSystem::TransferFileFromLocalToRemoteAfterGetEntryInfo( const FilePath& local_src_file_path, const FilePath& remote_dest_file_path, const FileOperationCallback& callback, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); - if (error != GDATA_FILE_OK) { + if (error != DRIVE_FILE_OK) { callback.Run(error); return; } @@ -647,7 +647,7 @@ void GDataFileSystem::TransferFileFromLocalToRemoteAfterGetEntryInfo( DCHECK(entry_proto.get()); if (!entry_proto->file_info().is_directory()) { // The parent of |remote_dest_file_path| is not a directory. - callback.Run(GDATA_FILE_ERROR_NOT_A_DIRECTORY); + callback.Run(DRIVE_FILE_ERROR_NOT_A_DIRECTORY); return; } @@ -698,8 +698,8 @@ void GDataFileSystem::TransferRegularFile( const FileOperationCallback& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - GDataFileError* error = - new GDataFileError(GDATA_FILE_OK); + DriveFileError* error = + new DriveFileError(DRIVE_FILE_OK); int64* file_size = new int64; std::string* content_type = new std::string; util::PostBlockingPoolSequencedTaskAndReply( @@ -722,7 +722,7 @@ void GDataFileSystem::TransferRegularFile( void GDataFileSystem::StartFileUploadOnUIThread( const StartFileUploadParams& params, - GDataFileError* error, + DriveFileError* error, int64* file_size, std::string* content_type) { // This method needs to run on the UI thread as required by @@ -732,7 +732,7 @@ void GDataFileSystem::StartFileUploadOnUIThread( DCHECK(file_size); DCHECK(content_type); - if (*error != GDATA_FILE_OK) { + if (*error != DRIVE_FILE_OK) { if (!params.callback.is_null()) params.callback.Run(*error); @@ -754,14 +754,14 @@ void GDataFileSystem::StartFileUploadOnUIThreadAfterGetEntryInfo( const StartFileUploadParams& params, int64 file_size, std::string content_type, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (entry_proto.get() && !entry_proto->file_info().is_directory()) - error = GDATA_FILE_ERROR_NOT_A_DIRECTORY; + error = DRIVE_FILE_ERROR_NOT_A_DIRECTORY; - if (error != GDATA_FILE_OK) { + if (error != DRIVE_FILE_OK) { if (!params.callback.is_null()) params.callback.Run(error); return; @@ -790,12 +790,12 @@ void GDataFileSystem::StartFileUploadOnUIThreadAfterGetEntryInfo( void GDataFileSystem::OnTransferCompleted( const FileOperationCallback& callback, - GDataFileError error, + DriveFileError error, scoped_ptr<UploadFileInfo> upload_file_info) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(upload_file_info.get()); - if (error == GDATA_FILE_OK && upload_file_info->entry.get()) { + if (error == DRIVE_FILE_OK && upload_file_info->entry.get()) { AddUploadedFile(UPLOAD_NEW_FILE, upload_file_info->gdata_path.DirName(), upload_file_info->entry.Pass(), @@ -844,10 +844,10 @@ void GDataFileSystem::CopyOnUIThreadAfterGetEntryInfoPair( DCHECK(!callback.is_null()); DCHECK(result.get()); - if (result->first.error != GDATA_FILE_OK) { + if (result->first.error != DRIVE_FILE_OK) { callback.Run(result->first.error); return; - } else if (result->second.error != GDATA_FILE_OK) { + } else if (result->second.error != DRIVE_FILE_OK) { callback.Run(result->second.error); return; } @@ -856,13 +856,13 @@ void GDataFileSystem::CopyOnUIThreadAfterGetEntryInfoPair( scoped_ptr<DriveEntryProto> dest_parent_proto = result->second.proto.Pass(); if (!dest_parent_proto->file_info().is_directory()) { - callback.Run(GDATA_FILE_ERROR_NOT_A_DIRECTORY); + callback.Run(DRIVE_FILE_ERROR_NOT_A_DIRECTORY); return; } else if (src_file_proto->file_info().is_directory()) { // TODO(kochi): Implement copy for directories. In the interim, // we handle recursive directory copy in the file manager. // crbug.com/141596 - callback.Run(GDATA_FILE_ERROR_INVALID_OPERATION); + callback.Run(DRIVE_FILE_ERROR_INVALID_OPERATION); return; } @@ -890,14 +890,14 @@ void GDataFileSystem::CopyOnUIThreadAfterGetEntryInfoPair( void GDataFileSystem::OnGetFileCompleteForCopy( const FilePath& remote_dest_file_path, const FileOperationCallback& callback, - GDataFileError error, + DriveFileError error, const FilePath& local_file_path, const std::string& unused_mime_type, DriveFileType file_type) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); - if (error != GDATA_FILE_OK) { + if (error != DRIVE_FILE_OK) { callback.Run(error); return; } @@ -910,14 +910,14 @@ void GDataFileSystem::OnGetFileCompleteForCopy( void GDataFileSystem::OnGetFileCompleteForTransferFile( const FilePath& local_dest_file_path, const FileOperationCallback& callback, - GDataFileError error, + DriveFileError error, const FilePath& local_file_path, const std::string& unused_mime_type, DriveFileType file_type) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); - if (error != GDATA_FILE_OK) { + if (error != DRIVE_FILE_OK) { callback.Run(error); return; } @@ -925,8 +925,8 @@ void GDataFileSystem::OnGetFileCompleteForTransferFile( // GetFileByPath downloads the file from gdata to a local cache, which is then // copied to the actual destination path on the local file system using // CopyLocalFileOnBlockingPool. - GDataFileError* copy_file_error = - new GDataFileError(GDATA_FILE_OK); + DriveFileError* copy_file_error = + new DriveFileError(DRIVE_FILE_OK); util::PostBlockingPoolSequencedTaskAndReply( FROM_HERE, blocking_task_runner_, @@ -962,7 +962,7 @@ void GDataFileSystem::Rename(const FilePath& file_path, // It is a no-op if the file is renamed to the same name. if (file_path.BaseName().value() == new_name) { - callback.Run(GDATA_FILE_OK, file_path); + callback.Run(DRIVE_FILE_OK, file_path); return; } @@ -981,11 +981,11 @@ void GDataFileSystem::RenameAfterGetEntryInfo( const FilePath& file_path, const FilePath::StringType& new_name, const FileMoveCallback& callback, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (error != GDATA_FILE_OK) { + if (error != DRIVE_FILE_OK) { if (!callback.is_null()) callback.Run(error, file_path); return; @@ -1052,17 +1052,17 @@ void GDataFileSystem::MoveOnUIThreadAfterGetEntryInfoPair( DCHECK(!callback.is_null()); DCHECK(result.get()); - if (result->first.error != GDATA_FILE_OK) { + if (result->first.error != DRIVE_FILE_OK) { callback.Run(result->first.error); return; - } else if (result->second.error != GDATA_FILE_OK) { + } else if (result->second.error != DRIVE_FILE_OK) { callback.Run(result->second.error); return; } scoped_ptr<DriveEntryProto> dest_parent_proto = result->second.proto.Pass(); if (!dest_parent_proto->file_info().is_directory()) { - callback.Run(GDATA_FILE_ERROR_NOT_A_DIRECTORY); + callback.Run(DRIVE_FILE_ERROR_NOT_A_DIRECTORY); return; } @@ -1107,14 +1107,14 @@ void GDataFileSystem::MoveOnUIThreadAfterGetEntryInfoPair( void GDataFileSystem::MoveEntryFromRootDirectory( const FilePath& dir_path, const FileOperationCallback& callback, - GDataFileError error, + DriveFileError error, const FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); DCHECK_EQ(kDriveRootDirectory, file_path.DirName().value()); // Return if there is an error or |dir_path| is the root directory. - if (error != GDATA_FILE_OK || dir_path == FilePath(kDriveRootDirectory)) { + if (error != DRIVE_FILE_OK || dir_path == FilePath(kDriveRootDirectory)) { callback.Run(error); return; } @@ -1135,10 +1135,10 @@ void GDataFileSystem::MoveEntryFromRootDirectoryAfterGetEntryInfoPair( DCHECK(!callback.is_null()); DCHECK(result.get()); - if (result->first.error != GDATA_FILE_OK) { + if (result->first.error != DRIVE_FILE_OK) { callback.Run(result->first.error); return; - } else if (result->second.error != GDATA_FILE_OK) { + } else if (result->second.error != DRIVE_FILE_OK) { callback.Run(result->second.error); return; } @@ -1147,7 +1147,7 @@ void GDataFileSystem::MoveEntryFromRootDirectoryAfterGetEntryInfoPair( scoped_ptr<DriveEntryProto> dir_proto = result->second.proto.Pass(); if (!dir_proto->file_info().is_directory()) { - callback.Run(GDATA_FILE_ERROR_NOT_A_DIRECTORY); + callback.Run(DRIVE_FILE_ERROR_NOT_A_DIRECTORY); return; } @@ -1165,14 +1165,14 @@ void GDataFileSystem::MoveEntryFromRootDirectoryAfterGetEntryInfoPair( void GDataFileSystem::RemoveEntryFromNonRootDirectory( const FileMoveCallback& callback, - GDataFileError error, + DriveFileError error, const FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); const FilePath dir_path = file_path.DirName(); // Return if there is an error or |dir_path| is the root directory. - if (error != GDATA_FILE_OK || dir_path == FilePath(kDriveRootDirectory)) { + if (error != DRIVE_FILE_OK || dir_path == FilePath(kDriveRootDirectory)) { callback.Run(error, file_path); return; } @@ -1195,10 +1195,10 @@ void GDataFileSystem::RemoveEntryFromNonRootDirectoryAfterEntryInfoPair( const FilePath& file_path = result->first.path; const FilePath& dir_path = result->second.path; - if (result->first.error != GDATA_FILE_OK) { + if (result->first.error != DRIVE_FILE_OK) { callback.Run(result->first.error, file_path); return; - } else if (result->second.error != GDATA_FILE_OK) { + } else if (result->second.error != DRIVE_FILE_OK) { callback.Run(result->second.error, file_path); return; } @@ -1207,7 +1207,7 @@ void GDataFileSystem::RemoveEntryFromNonRootDirectoryAfterEntryInfoPair( scoped_ptr<DriveEntryProto> dir_proto = result->second.proto.Pass(); if (!dir_proto->file_info().is_directory()) { - callback.Run(GDATA_FILE_ERROR_NOT_A_DIRECTORY, file_path); + callback.Run(DRIVE_FILE_ERROR_NOT_A_DIRECTORY, file_path); return; } @@ -1255,11 +1255,11 @@ void GDataFileSystem::RemoveOnUIThreadAfterGetEntryInfo( const FilePath& file_path, bool /* is_recursive */, const FileOperationCallback& callback, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (error != GDATA_FILE_OK) { + if (error != DRIVE_FILE_OK) { if (!callback.is_null()) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, base::Bind(callback, error)); @@ -1309,7 +1309,7 @@ void GDataFileSystem::CreateDirectoryOnUIThread( case FOUND_INVALID: { if (!callback.is_null()) { MessageLoop::current()->PostTask(FROM_HERE, - base::Bind(callback, GDATA_FILE_ERROR_NOT_FOUND)); + base::Bind(callback, DRIVE_FILE_ERROR_NOT_FOUND)); } return; @@ -1318,8 +1318,8 @@ void GDataFileSystem::CreateDirectoryOnUIThread( if (!callback.is_null()) { MessageLoop::current()->PostTask(FROM_HERE, base::Bind(callback, - is_exclusive ? GDATA_FILE_ERROR_EXISTS : - GDATA_FILE_OK)); + is_exclusive ? DRIVE_FILE_ERROR_EXISTS : + DRIVE_FILE_OK)); } return; @@ -1340,7 +1340,7 @@ void GDataFileSystem::CreateDirectoryOnUIThread( if (directory_path != first_missing_path && !is_recursive) { if (!callback.is_null()) { MessageLoop::current()->PostTask(FROM_HERE, - base::Bind(callback, GDATA_FILE_ERROR_NOT_FOUND)); + base::Bind(callback, DRIVE_FILE_ERROR_NOT_FOUND)); } return; } @@ -1393,32 +1393,32 @@ void GDataFileSystem::OnGetEntryInfoForCreateFile( const FilePath& file_path, bool is_exclusive, const FileOperationCallback& callback, - GDataFileError result, + DriveFileError result, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); // The |file_path| is invalid. It is an error. - if (result != GDATA_FILE_ERROR_NOT_FOUND && - result != GDATA_FILE_OK) { + if (result != DRIVE_FILE_ERROR_NOT_FOUND && + result != DRIVE_FILE_OK) { callback.Run(result); return; } // An entry already exists at |file_path|. - if (result == GDATA_FILE_OK) { + if (result == DRIVE_FILE_OK) { DCHECK(entry_proto.get()); // If an exclusive mode is requested, or the entry is not a regular file, // it is an error. if (is_exclusive || entry_proto->file_info().is_directory() || entry_proto->file_specific_info().is_hosted_document()) { - callback.Run(GDATA_FILE_ERROR_EXISTS); + callback.Run(DRIVE_FILE_ERROR_EXISTS); return; } // Otherwise nothing more to do. Succeeded. - callback.Run(GDATA_FILE_OK); + callback.Run(DRIVE_FILE_OK); return; } @@ -1461,12 +1461,12 @@ void GDataFileSystem::OnGetEntryInfoCompleteForGetFileByPath( const FilePath& file_path, const GetFileCallback& get_file_callback, const GetContentCallback& get_content_callback, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // If |error| == PLATFORM_FILE_OK then |entry_proto| must be valid. - DCHECK(error != GDATA_FILE_OK || + DCHECK(error != DRIVE_FILE_OK || (entry_proto.get() && !entry_proto->resource_id().empty())); GetResolvedFileByPath(file_path, get_file_callback, @@ -1479,19 +1479,19 @@ void GDataFileSystem::GetResolvedFileByPath( const FilePath& file_path, const GetFileCallback& get_file_callback, const GetContentCallback& get_content_callback, - GDataFileError error, + DriveFileError error, const DriveEntryProto* entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (entry_proto && !entry_proto->has_file_specific_info()) - error = GDATA_FILE_ERROR_NOT_FOUND; + error = DRIVE_FILE_ERROR_NOT_FOUND; - if (error != GDATA_FILE_OK) { + if (error != DRIVE_FILE_OK) { if (!get_file_callback.is_null()) { MessageLoop::current()->PostTask( FROM_HERE, base::Bind(get_file_callback, - GDATA_FILE_ERROR_NOT_FOUND, + DRIVE_FILE_ERROR_NOT_FOUND, FilePath(), std::string(), REGULAR_FILE)); @@ -1504,8 +1504,8 @@ void GDataFileSystem::GetResolvedFileByPath( // formats. The JSON file contains the edit URL and resource ID of the // document. if (entry_proto->file_specific_info().is_hosted_document()) { - GDataFileError* error = - new GDataFileError(GDATA_FILE_OK); + DriveFileError* error = + new DriveFileError(DRIVE_FILE_OK); FilePath* temp_file_path = new FilePath; std::string* mime_type = new std::string; DriveFileType* file_type = new DriveFileType(REGULAR_FILE); @@ -1600,7 +1600,7 @@ void GDataFileSystem::GetFileByEntryOnUIThread( base::MessageLoopProxy::current()->PostTask( FROM_HERE, base::Bind(get_file_callback, - GDATA_FILE_ERROR_NOT_FOUND, + DRIVE_FILE_ERROR_NOT_FOUND, FilePath(), std::string(), REGULAR_FILE)); @@ -1612,14 +1612,14 @@ void GDataFileSystem::GetFileByEntryOnUIThread( } void GDataFileSystem::OnGetFileFromCache(const GetFileFromCacheParams& params, - GDataFileError error, + DriveFileError error, const std::string& resource_id, const std::string& md5, const FilePath& cache_file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // Have we found the file in cache? If so, return it back to the caller. - if (error == GDATA_FILE_OK) { + if (error == DRIVE_FILE_OK) { if (!params.get_file_callback.is_null()) { params.get_file_callback.Run(error, cache_file_path, @@ -1661,20 +1661,20 @@ void GDataFileSystem::OnGetDocumentEntry(const FilePath& cache_file_path, scoped_ptr<base::Value> data) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - GDataFileError error = util::GDataToGDataFileError(status); + DriveFileError error = util::GDataToDriveFileError(status); scoped_ptr<DriveEntry> fresh_entry; - if (error == GDATA_FILE_OK) { + if (error == DRIVE_FILE_OK) { scoped_ptr<DocumentEntry> doc_entry(DocumentEntry::ExtractAndParse(*data)); if (doc_entry.get()) fresh_entry.reset(resource_metadata_->FromDocumentEntry(*doc_entry)); if (!fresh_entry.get() || !fresh_entry->AsDriveFile()) { LOG(ERROR) << "Got invalid entry from server for " << params.resource_id; - error = GDATA_FILE_ERROR_FAILED; + error = DRIVE_FILE_ERROR_FAILED; } } - if (error != GDATA_FILE_OK) { + if (error != DRIVE_FILE_OK) { if (!params.get_file_callback.is_null()) { params.get_file_callback.Run(error, cache_file_path, @@ -1718,7 +1718,7 @@ void GDataFileSystem::StartDownloadFileIfEnoughSpace( if (!*has_enough_space) { // If no enough space, return PLATFORM_FILE_ERROR_NO_SPACE. if (!params.get_file_callback.is_null()) { - params.get_file_callback.Run(GDATA_FILE_ERROR_NO_SPACE, + params.get_file_callback.Run(DRIVE_FILE_ERROR_NO_SPACE, cache_file_path, params.mime_type, REGULAR_FILE); @@ -1766,11 +1766,11 @@ void GDataFileSystem::GetEntryInfoByPathOnUIThread( void GDataFileSystem::GetEntryInfoByPathOnUIThreadAfterLoad( const FilePath& file_path, const GetEntryInfoCallback& callback, - GDataFileError error) { + DriveFileError error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); - if (error != GDATA_FILE_OK) { + if (error != DRIVE_FILE_OK) { callback.Run(error, scoped_ptr<DriveEntryProto>()); return; } @@ -1784,12 +1784,12 @@ void GDataFileSystem::GetEntryInfoByPathOnUIThreadAfterLoad( void GDataFileSystem::GetEntryInfoByPathOnUIThreadAfterGetEntry( const GetEntryInfoCallback& callback, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); - if (error != GDATA_FILE_OK) { + if (error != DRIVE_FILE_OK) { callback.Run(error, scoped_ptr<DriveEntryProto>()); return; } @@ -1828,11 +1828,11 @@ void GDataFileSystem::ReadDirectoryByPathOnUIThread( void GDataFileSystem::ReadDirectoryByPathOnUIThreadAfterLoad( const FilePath& file_path, const ReadDirectoryWithSettingCallback& callback, - GDataFileError error) { + DriveFileError error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); - if (error != GDATA_FILE_OK) { + if (error != DRIVE_FILE_OK) { callback.Run(error, hide_hosted_docs_, scoped_ptr<DriveEntryProtoVector>()); @@ -1848,12 +1848,12 @@ void GDataFileSystem::ReadDirectoryByPathOnUIThreadAfterLoad( void GDataFileSystem::ReadDirectoryByPathOnUIThreadAfterRead( const ReadDirectoryWithSettingCallback& callback, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProtoVector> entries) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); - if (error != GDATA_FILE_OK) { + if (error != DRIVE_FILE_OK) { callback.Run(error, hide_hosted_docs_, scoped_ptr<DriveEntryProtoVector>()); @@ -1861,7 +1861,7 @@ void GDataFileSystem::ReadDirectoryByPathOnUIThreadAfterRead( } DCHECK(entries.get()); // This is valid for emptry directories too. - callback.Run(GDATA_FILE_OK, hide_hosted_docs_, entries.Pass()); + callback.Run(DRIVE_FILE_OK, hide_hosted_docs_, entries.Pass()); } void GDataFileSystem::RequestDirectoryRefresh(const FilePath& file_path) { @@ -1888,11 +1888,11 @@ void GDataFileSystem::RequestDirectoryRefreshOnUIThread( void GDataFileSystem::RequestDirectoryRefreshOnUIThreadAfterGetEntryInfo( const FilePath& file_path, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (error != GDATA_FILE_OK || + if (error != DRIVE_FILE_OK || !entry_proto->file_info().is_directory()) { LOG(ERROR) << "Directory entry not found: " << file_path.value(); return; @@ -1909,11 +1909,11 @@ void GDataFileSystem::RequestDirectoryRefreshOnUIThreadAfterGetEntryInfo( void GDataFileSystem::OnRequestDirectoryRefresh( const FilePath& directory_path, GetDocumentsParams* params, - GDataFileError error) { + DriveFileError error) { DCHECK(params); DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (error != GDATA_FILE_OK) { + if (error != DRIVE_FILE_OK) { LOG(ERROR) << "Failed to refresh directory: " << directory_path.value() << ": " << error; return; @@ -1928,7 +1928,7 @@ void GDataFileSystem::OnRequestDirectoryRefresh( &file_map, &unused_delta_feed_changestamp, &unused_uma_stats); - if (error != GDATA_FILE_OK) { + if (error != DRIVE_FILE_OK) { LOG(ERROR) << "Failed to convert feed: " << directory_path.value() << ": " << error; return; @@ -1972,20 +1972,20 @@ void GDataFileSystem::UpdateFileByResourceIdOnUIThread( void GDataFileSystem::UpdateFileByEntryInfo( const FileOperationCallback& callback, - GDataFileError error, + DriveFileError error, const FilePath& /* dive_file_path */, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); - if (error != GDATA_FILE_OK) { + if (error != DRIVE_FILE_OK) { callback.Run(error); return; } DCHECK(entry_proto.get()); if (entry_proto->file_info().is_directory()) { - callback.Run(GDATA_FILE_ERROR_NOT_FOUND); + callback.Run(DRIVE_FILE_ERROR_NOT_FOUND); return; } @@ -1999,21 +1999,21 @@ void GDataFileSystem::UpdateFileByEntryInfo( void GDataFileSystem::OnGetFileCompleteForUpdateFile( const FileOperationCallback& callback, - GDataFileError error, + DriveFileError error, const std::string& resource_id, const std::string& /* md5 */, const FilePath& cache_file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); - if (error != GDATA_FILE_OK) { + if (error != DRIVE_FILE_OK) { callback.Run(error); return; } // Gets the size of the cache file. Since the file is locally modified, the // file size information stored in DriveEntry is not correct. - GDataFileError* get_size_error = new GDataFileError(GDATA_FILE_ERROR_FAILED); + DriveFileError* get_size_error = new DriveFileError(DRIVE_FILE_ERROR_FAILED); int64* file_size = new int64(-1); util::PostBlockingPoolSequencedTaskAndReply( FROM_HERE, @@ -2035,12 +2035,12 @@ void GDataFileSystem::OnGetFileSizeCompleteForUpdateFile( const FileOperationCallback& callback, const std::string& resource_id, const FilePath& cache_file_path, - GDataFileError* error, + DriveFileError* error, int64* file_size) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); - if (*error != GDATA_FILE_OK) { + if (*error != DRIVE_FILE_OK) { callback.Run(*error); return; } @@ -2060,20 +2060,20 @@ void GDataFileSystem::OnGetFileCompleteForUpdateFileByEntry( const FileOperationCallback& callback, int64 file_size, const FilePath& cache_file_path, - GDataFileError error, + DriveFileError error, const FilePath& drive_file_path, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); - if (error != GDATA_FILE_OK) { + if (error != DRIVE_FILE_OK) { callback.Run(error); return; } DCHECK(entry_proto.get()); if (entry_proto->file_info().is_directory()) { - callback.Run(GDATA_FILE_ERROR_NOT_FOUND); + callback.Run(DRIVE_FILE_ERROR_NOT_FOUND); return; } @@ -2090,12 +2090,12 @@ void GDataFileSystem::OnGetFileCompleteForUpdateFileByEntry( void GDataFileSystem::OnUpdatedFileUploaded( const FileOperationCallback& callback, - GDataFileError error, + DriveFileError error, scoped_ptr<UploadFileInfo> upload_file_info) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(upload_file_info.get()); - if (error != GDATA_FILE_OK) { + if (error != DRIVE_FILE_OK) { if (!callback.is_null()) callback.Run(error); return; @@ -2140,8 +2140,8 @@ void GDataFileSystem::OnGetAvailableSpace( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); - GDataFileError error = util::GDataToGDataFileError(status); - if (error != GDATA_FILE_OK) { + DriveFileError error = util::GDataToDriveFileError(status); + if (error != DRIVE_FILE_OK) { callback.Run(error, -1, -1); return; } @@ -2150,11 +2150,11 @@ void GDataFileSystem::OnGetAvailableSpace( if (data.get()) feed = AccountMetadataFeed::CreateFrom(*data); if (!feed.get()) { - callback.Run(GDATA_FILE_ERROR_FAILED, -1, -1); + callback.Run(DRIVE_FILE_ERROR_FAILED, -1, -1); return; } - callback.Run(GDATA_FILE_OK, + callback.Run(DRIVE_FILE_OK, feed->quota_bytes_total(), feed->quota_bytes_used()); } @@ -2166,8 +2166,8 @@ void GDataFileSystem::OnGetAboutResource( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); - GDataFileError error = util::GDataToGDataFileError(status); - if (error != GDATA_FILE_OK) { + DriveFileError error = util::GDataToDriveFileError(status); + if (error != DRIVE_FILE_OK) { callback.Run(error, -1, -1); return; } @@ -2177,11 +2177,11 @@ void GDataFileSystem::OnGetAboutResource( about = AboutResource::CreateFrom(*resource_json); if (!about.get()) { - callback.Run(GDATA_FILE_ERROR_FAILED, -1, -1); + callback.Run(DRIVE_FILE_ERROR_FAILED, -1, -1); return; } - callback.Run(GDATA_FILE_OK, + callback.Run(DRIVE_FILE_OK, about->quota_bytes_total(), about->quota_bytes_used()); } @@ -2192,8 +2192,8 @@ void GDataFileSystem::OnCreateDirectoryCompleted( scoped_ptr<base::Value> data) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - GDataFileError error = util::GDataToGDataFileError(status); - if (error != GDATA_FILE_OK) { + DriveFileError error = util::GDataToDriveFileError(status); + if (error != DRIVE_FILE_OK) { if (!params.callback.is_null()) params.callback.Run(error); @@ -2207,7 +2207,7 @@ void GDataFileSystem::OnCreateDirectoryCompleted( error = AddNewDirectory(params.created_directory_path.DirName(), created_entry); - if (error != GDATA_FILE_OK) { + if (error != DRIVE_FILE_OK) { if (!params.callback.is_null()) params.callback.Run(error); @@ -2226,16 +2226,16 @@ void GDataFileSystem::OnCreateDirectoryCompleted( if (!params.callback.is_null()) { // Finally done with the create request. - params.callback.Run(GDATA_FILE_OK); + params.callback.Run(DRIVE_FILE_OK); } } void GDataFileSystem::OnSearch(const SearchCallback& callback, GetDocumentsParams* params, - GDataFileError error) { + DriveFileError error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (error != GDATA_FILE_OK) { + if (error != DRIVE_FILE_OK) { if (!callback.is_null()) callback.Run(error, GURL(), scoped_ptr<std::vector<SearchResultInfo> >()); return; @@ -2351,7 +2351,7 @@ void GDataFileSystem::LoadRootFeedFromCacheForTesting() { FileOperationCallback()); } -GDataFileError GDataFileSystem::UpdateFromFeedForTesting( +DriveFileError GDataFileSystem::UpdateFromFeedForTesting( const std::vector<DocumentFeed*>& feed_list, int64 start_changestamp, int64 root_feed_changestamp) { @@ -2363,7 +2363,7 @@ GDataFileError GDataFileSystem::UpdateFromFeedForTesting( } void GDataFileSystem::OnFilePathUpdated(const FileOperationCallback& callback, - GDataFileError error, + DriveFileError error, const FilePath& /* file_path */) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (!callback.is_null()) @@ -2378,21 +2378,21 @@ void GDataFileSystem::OnCopyDocumentCompleted( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); - GDataFileError error = util::GDataToGDataFileError(status); - if (error != GDATA_FILE_OK) { + DriveFileError error = util::GDataToDriveFileError(status); + if (error != DRIVE_FILE_OK) { callback.Run(error); return; } scoped_ptr<DocumentEntry> doc_entry(DocumentEntry::ExtractAndParse(*data)); if (!doc_entry.get()) { - callback.Run(GDATA_FILE_ERROR_FAILED); + callback.Run(DRIVE_FILE_ERROR_FAILED); return; } DriveEntry* entry = resource_metadata_->FromDocumentEntry(*doc_entry); if (!entry) { - callback.Run(GDATA_FILE_ERROR_FAILED); + callback.Run(DRIVE_FILE_ERROR_FAILED); return; } @@ -2417,8 +2417,8 @@ void GDataFileSystem::OnMoveEntryFromRootDirectoryCompleted( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); - GDataFileError error = util::GDataToGDataFileError(status); - if (error == GDATA_FILE_OK) { + DriveFileError error = util::GDataToDriveFileError(status); + if (error == DRIVE_FILE_OK) { DriveEntry* entry = resource_metadata_->FindEntryByPathSync(file_path); if (entry) { DCHECK_EQ(resource_metadata_->root(), entry->parent()); @@ -2431,7 +2431,7 @@ void GDataFileSystem::OnMoveEntryFromRootDirectoryCompleted( callback)); return; } else { - error = GDATA_FILE_ERROR_NOT_FOUND; + error = DRIVE_FILE_ERROR_NOT_FOUND; } } @@ -2445,9 +2445,9 @@ void GDataFileSystem::OnRemovedDocument( const GURL& document_url) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - GDataFileError error = util::GDataToGDataFileError(status); + DriveFileError error = util::GDataToDriveFileError(status); - if (error == GDATA_FILE_OK) + if (error == DRIVE_FILE_OK) error = RemoveEntryAndCacheLocally(file_path); if (!callback.is_null()) { @@ -2519,12 +2519,12 @@ void GDataFileSystem::OnFileDownloadedAndSpaceChecked( bool* has_enough_space) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - GDataFileError error = util::GDataToGDataFileError(status); + DriveFileError error = util::GDataToDriveFileError(status); // Make sure that downloaded file is properly stored in cache. We don't have // to wait for this operation to finish since the user can already use the // downloaded file. - if (error == GDATA_FILE_OK) { + if (error == DRIVE_FILE_OK) { if (*has_enough_space) { cache_->StoreOnUIThread( params.resource_id, @@ -2542,7 +2542,7 @@ void GDataFileSystem::OnFileDownloadedAndSpaceChecked( base::Bind(base::IgnoreResult(&file_util::Delete), downloaded_file_path, false /* recursive*/)); - error = GDATA_FILE_ERROR_NO_SPACE; + error = DRIVE_FILE_ERROR_NO_SPACE; } } @@ -2554,7 +2554,7 @@ void GDataFileSystem::OnFileDownloadedAndSpaceChecked( } } -void GDataFileSystem::OnDownloadStoredToCache(GDataFileError error, +void GDataFileSystem::OnDownloadStoredToCache(DriveFileError error, const std::string& resource_id, const std::string& md5) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -2569,8 +2569,8 @@ void GDataFileSystem::RenameEntryLocally( const GURL& document_url) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - const GDataFileError error = util::GDataToGDataFileError(status); - if (error != GDATA_FILE_OK) { + const DriveFileError error = util::GDataToDriveFileError(status); + if (error != DRIVE_FILE_OK) { if (!callback.is_null()) callback.Run(error, FilePath()); return; @@ -2579,7 +2579,7 @@ void GDataFileSystem::RenameEntryLocally( DriveEntry* entry = resource_metadata_->FindEntryByPathSync(file_path); if (!entry) { if (!callback.is_null()) - callback.Run(GDATA_FILE_ERROR_NOT_FOUND, FilePath()); + callback.Run(DRIVE_FILE_ERROR_NOT_FOUND, FilePath()); return; } @@ -2609,15 +2609,15 @@ void GDataFileSystem::MoveEntryToRootDirectoryLocally( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); - const GDataFileError error = util::GDataToGDataFileError(status); - if (error != GDATA_FILE_OK) { + const DriveFileError error = util::GDataToDriveFileError(status); + if (error != DRIVE_FILE_OK) { callback.Run(error, FilePath()); return; } DriveEntry* entry = resource_metadata_->FindEntryByPathSync(file_path); if (!entry) { - callback.Run(GDATA_FILE_ERROR_NOT_FOUND, FilePath()); + callback.Run(DRIVE_FILE_ERROR_NOT_FOUND, FilePath()); return; } @@ -2631,11 +2631,11 @@ void GDataFileSystem::MoveEntryToRootDirectoryLocally( void GDataFileSystem::NotifyAndRunFileMoveCallback( const FileMoveCallback& callback, - GDataFileError error, + DriveFileError error, const FilePath& moved_file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (error == GDATA_FILE_OK) + if (error == DRIVE_FILE_OK) OnDirectoryChanged(moved_file_path.DirName()); if (!callback.is_null()) @@ -2644,38 +2644,38 @@ void GDataFileSystem::NotifyAndRunFileMoveCallback( void GDataFileSystem::NotifyAndRunFileOperationCallback( const FileOperationCallback& callback, - GDataFileError error, + DriveFileError error, const FilePath& moved_file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); - if (error == GDATA_FILE_OK) + if (error == DRIVE_FILE_OK) OnDirectoryChanged(moved_file_path.DirName()); callback.Run(error); } void GDataFileSystem::OnDirectoryChangeFileMoveCallback( - GDataFileError error, + DriveFileError error, const FilePath& directory_path) { - if (error == GDATA_FILE_OK) + if (error == DRIVE_FILE_OK) OnDirectoryChanged(directory_path); } -GDataFileError GDataFileSystem::RemoveEntryAndCacheLocally( +DriveFileError GDataFileSystem::RemoveEntryAndCacheLocally( const FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); std::string resource_id; - GDataFileError error = RemoveEntryLocally(file_path, &resource_id); - if (error != GDATA_FILE_OK) + DriveFileError error = RemoveEntryLocally(file_path, &resource_id); + if (error != DRIVE_FILE_OK) return error; // If resource_id is not empty, remove its corresponding file from cache. if (!resource_id.empty()) cache_->RemoveOnUIThread(resource_id, CacheOperationCallback()); - return GDATA_FILE_OK; + return DRIVE_FILE_OK; } void GDataFileSystem::RemoveStaleEntryOnUpload( @@ -2688,7 +2688,7 @@ void GDataFileSystem::RemoveStaleEntryOnUpload( existing_entry->parent() == parent_dir) { resource_metadata_->RemoveEntryFromParent(existing_entry, callback); } else { - callback.Run(GDATA_FILE_ERROR_NOT_FOUND, FilePath()); + callback.Run(DRIVE_FILE_ERROR_NOT_FOUND, FilePath()); LOG(ERROR) << "Entry for the existing file not found: " << resource_id; } } @@ -2713,7 +2713,7 @@ void GDataFileSystem::NotifyFileSystemToBeUnmounted() { void GDataFileSystem::NotifyInitialLoadFinishedAndRun( const FileOperationCallback& callback, - GDataFileError error) { + DriveFileError error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -2724,34 +2724,34 @@ void GDataFileSystem::NotifyInitialLoadFinishedAndRun( callback.Run(error); } -GDataFileError GDataFileSystem::AddNewDirectory( +DriveFileError GDataFileSystem::AddNewDirectory( const FilePath& directory_path, base::Value* entry_value) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (!entry_value) - return GDATA_FILE_ERROR_FAILED; + return DRIVE_FILE_ERROR_FAILED; scoped_ptr<DocumentEntry> doc_entry(DocumentEntry::CreateFrom(*entry_value)); if (!doc_entry.get()) - return GDATA_FILE_ERROR_FAILED; + return DRIVE_FILE_ERROR_FAILED; // Find parent directory element within the cached file system snapshot. DriveEntry* entry = resource_metadata_->FindEntryByPathSync(directory_path); if (!entry) - return GDATA_FILE_ERROR_FAILED; + return DRIVE_FILE_ERROR_FAILED; // Check if parent is a directory since in theory since this is a callback // something could in the meantime have nuked the parent dir and created a // file with the exact same name. DriveDirectory* parent_dir = entry->AsDriveDirectory(); if (!parent_dir) - return GDATA_FILE_ERROR_FAILED; + return DRIVE_FILE_ERROR_FAILED; DriveEntry* new_entry = resource_metadata_->FromDocumentEntry(*doc_entry); if (!new_entry) - return GDATA_FILE_ERROR_FAILED; + return DRIVE_FILE_ERROR_FAILED; resource_metadata_->AddEntryToDirectory( parent_dir, @@ -2759,7 +2759,7 @@ GDataFileError GDataFileSystem::AddNewDirectory( base::Bind(&GDataFileSystem::NotifyAndRunFileMoveCallback, ui_weak_ptr_, FileMoveCallback())); - return GDATA_FILE_OK; + return DRIVE_FILE_OK; } GDataFileSystem::FindMissingDirectoryResult @@ -2795,7 +2795,7 @@ GDataFileSystem::FindFirstMissingParentDirectory( return DIRECTORY_ALREADY_PRESENT; } -GDataFileError GDataFileSystem::RemoveEntryLocally( +DriveFileError GDataFileSystem::RemoveEntryLocally( const FilePath& file_path, std::string* resource_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -2805,11 +2805,11 @@ GDataFileError GDataFileSystem::RemoveEntryLocally( DriveEntry* entry = resource_metadata_->FindEntryByPathSync(file_path); if (!entry) - return GDATA_FILE_ERROR_NOT_FOUND; + return DRIVE_FILE_ERROR_NOT_FOUND; // You can't remove root element. if (!entry->parent()) - return GDATA_FILE_ERROR_ACCESS_DENIED; + return DRIVE_FILE_ERROR_ACCESS_DENIED; // If it's a file (only files have resource id), get its resource id so that // we can remove it after releasing the auto lock. @@ -2820,7 +2820,7 @@ GDataFileError GDataFileSystem::RemoveEntryLocally( entry, base::Bind(&GDataFileSystem::OnDirectoryChangeFileMoveCallback, ui_weak_ptr_)); - return GDATA_FILE_OK; + return DRIVE_FILE_OK; } void GDataFileSystem::AddUploadedFile( @@ -2901,16 +2901,16 @@ void GDataFileSystem::AddUploadedFileOnUIThread( parent_dir, file_move_callback)); } else { - file_move_callback.Run(GDATA_FILE_OK, FilePath()); + file_move_callback.Run(DRIVE_FILE_OK, FilePath()); } } void GDataFileSystem::ContinueAddUploadedFile( AddUploadedFileParams* params, - GDataFileError error, + DriveFileError error, const FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - DCHECK_EQ(GDATA_FILE_OK, error); + DCHECK_EQ(DRIVE_FILE_OK, error); DCHECK(params->new_entry.get()); DriveFile* file = params->new_entry->AsDriveFile(); DCHECK(file); @@ -2929,7 +2929,7 @@ void GDataFileSystem::ContinueAddUploadedFile( void GDataFileSystem::AddUploadedFileToCache( AddUploadedFileParams* params, - GDataFileError error, + DriveFileError error, const FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -3064,7 +3064,7 @@ void GDataFileSystem::OpenFileOnUIThread(const FilePath& file_path, if (open_files_.find(file_path) != open_files_.end()) { MessageLoop::current()->PostTask( FROM_HERE, - base::Bind(callback, GDATA_FILE_ERROR_IN_USE, FilePath())); + base::Bind(callback, DRIVE_FILE_ERROR_IN_USE, FilePath())); return; } open_files_.insert(file_path); @@ -3083,22 +3083,22 @@ void GDataFileSystem::OpenFileOnUIThread(const FilePath& file_path, void GDataFileSystem::OnGetEntryInfoCompleteForOpenFile( const FilePath& file_path, const OpenFileCallback& callback, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (entry_proto.get() && !entry_proto->has_file_specific_info()) - error = GDATA_FILE_ERROR_NOT_FOUND; + error = DRIVE_FILE_ERROR_NOT_FOUND; - if (error == GDATA_FILE_OK) { + if (error == DRIVE_FILE_OK) { if (entry_proto->file_specific_info().file_md5().empty() || entry_proto->file_specific_info().is_hosted_document()) { // No support for opening a directory or hosted document. - error = GDATA_FILE_ERROR_INVALID_OPERATION; + error = DRIVE_FILE_ERROR_INVALID_OPERATION; } } - if (error != GDATA_FILE_OK) { + if (error != DRIVE_FILE_OK) { if (!callback.is_null()) callback.Run(error, FilePath()); return; @@ -3121,13 +3121,13 @@ void GDataFileSystem::OnGetEntryInfoCompleteForOpenFile( void GDataFileSystem::OnGetFileCompleteForOpenFile( const OpenFileCallback& callback, const GetFileCompleteForOpenParams& entry_proto, - GDataFileError error, + DriveFileError error, const FilePath& file_path, const std::string& mime_type, DriveFileType file_type) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (error != GDATA_FILE_OK) { + if (error != DRIVE_FILE_OK) { if (!callback.is_null()) callback.Run(error, FilePath()); return; @@ -3146,7 +3146,7 @@ void GDataFileSystem::OnGetFileCompleteForOpenFile( void GDataFileSystem::OnMarkDirtyInCacheCompleteForOpenFile( const OpenFileCallback& callback, - GDataFileError error, + DriveFileError error, const std::string& resource_id, const std::string& md5, const FilePath& cache_file_path) { @@ -3158,14 +3158,14 @@ void GDataFileSystem::OnMarkDirtyInCacheCompleteForOpenFile( void GDataFileSystem::OnOpenFileFinished(const FilePath& file_path, const OpenFileCallback& callback, - GDataFileError result, + DriveFileError result, const FilePath& cache_file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // All the invocation of |callback| from operations initiated from OpenFile // must go through here. Removes the |file_path| from the remembered set when // the file was not successfully opened. - if (result != GDATA_FILE_OK) + if (result != DRIVE_FILE_OK) open_files_.erase(file_path); if (!callback.is_null()) @@ -3194,7 +3194,7 @@ void GDataFileSystem::CloseFileOnUIThread( // The file is not being opened. MessageLoop::current()->PostTask( FROM_HERE, - base::Bind(callback, GDATA_FILE_ERROR_NOT_FOUND)); + base::Bind(callback, DRIVE_FILE_ERROR_NOT_FOUND)); return; } @@ -3213,15 +3213,15 @@ void GDataFileSystem::CloseFileOnUIThread( void GDataFileSystem::CloseFileOnUIThreadAfterGetEntryInfo( const FilePath& file_path, const FileOperationCallback& callback, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); if (entry_proto.get() && !entry_proto->has_file_specific_info()) - error = GDATA_FILE_ERROR_NOT_FOUND; + error = DRIVE_FILE_ERROR_NOT_FOUND; - if (error != GDATA_FILE_OK) { + if (error != DRIVE_FILE_OK) { callback.Run(error); return; } @@ -3242,7 +3242,7 @@ void GDataFileSystem::CloseFileOnUIThreadAfterGetEntryInfo( void GDataFileSystem::CloseFileOnUIThreadAfterCommitDirtyInCache( const FileOperationCallback& callback, - GDataFileError error, + DriveFileError error, const std::string& /* resource_id */, const std::string& /* md5 */) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -3254,7 +3254,7 @@ void GDataFileSystem::CloseFileOnUIThreadAfterCommitDirtyInCache( void GDataFileSystem::CloseFileOnUIThreadFinalize( const FilePath& file_path, const FileOperationCallback& callback, - GDataFileError result) { + DriveFileError result) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(!callback.is_null()); @@ -3278,7 +3278,7 @@ void GDataFileSystem::CheckLocalModificationAndRun( // For entries that will never be cached, use the original entry info as is. if (!entry_proto->has_file_specific_info() || entry_proto->file_specific_info().is_hosted_document()) { - callback.Run(GDATA_FILE_OK, entry_proto.Pass()); + callback.Run(DRIVE_FILE_OK, entry_proto.Pass()); return; } @@ -3303,7 +3303,7 @@ void GDataFileSystem::CheckLocalModificationAndRunAfterGetCacheEntry( // When no dirty cache is found, use the original entry info as is. if (!success || !cache_entry.is_dirty()) { - callback.Run(GDATA_FILE_OK, entry_proto.Pass()); + callback.Run(DRIVE_FILE_OK, entry_proto.Pass()); return; } @@ -3321,7 +3321,7 @@ void GDataFileSystem::CheckLocalModificationAndRunAfterGetCacheEntry( void GDataFileSystem::CheckLocalModificationAndRunAfterGetCacheFile( scoped_ptr<DriveEntryProto> entry_proto, const GetEntryInfoCallback& callback, - GDataFileError error, + DriveFileError error, const std::string& resource_id, const std::string& md5, const FilePath& local_cache_path) { @@ -3329,8 +3329,8 @@ void GDataFileSystem::CheckLocalModificationAndRunAfterGetCacheFile( DCHECK(!callback.is_null()); // When no dirty cache is found, use the original entry info as is. - if (error != GDATA_FILE_OK) { - callback.Run(GDATA_FILE_OK, entry_proto.Pass()); + if (error != DRIVE_FILE_OK) { + callback.Run(DRIVE_FILE_OK, entry_proto.Pass()); return; } @@ -3361,14 +3361,14 @@ void GDataFileSystem::CheckLocalModificationAndRunAfterGetFileInfo( DCHECK(!callback.is_null()); if (!*get_file_info_result) { - callback.Run(GDATA_FILE_ERROR_NOT_FOUND, scoped_ptr<DriveEntryProto>()); + callback.Run(DRIVE_FILE_ERROR_NOT_FOUND, scoped_ptr<DriveEntryProto>()); return; } PlatformFileInfoProto entry_file_info; DriveEntry::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); *entry_proto->mutable_file_info() = entry_file_info; - callback.Run(GDATA_FILE_OK, entry_proto.Pass()); + callback.Run(DRIVE_FILE_OK, entry_proto.Pass()); } } // namespace gdata diff --git a/chrome/browser/chromeos/gdata/gdata_file_system.h b/chrome/browser/chromeos/gdata/gdata_file_system.h index 590b76f..2e4aeaf 100644 --- a/chrome/browser/chromeos/gdata/gdata_file_system.h +++ b/chrome/browser/chromeos/gdata/gdata_file_system.h @@ -143,7 +143,7 @@ class GDataFileSystem : public GDataFileSystemInterface, // Used in tests to update the file system from |feed_list|. // See also the comment at GDataWapiFeedLoader::UpdateFromFeed(). - GDataFileError UpdateFromFeedForTesting( + DriveFileError UpdateFromFeedForTesting( const std::vector<DocumentFeed*>& feed_list, int64 start_changestamp, int64 root_feed_changestamp); @@ -188,7 +188,7 @@ class GDataFileSystem : public GDataFileSystemInterface, // |error| error code returned by |LoadFeedFromServer|. void OnSearch(const SearchCallback& callback, GetDocumentsParams* params, - GDataFileError error); + DriveFileError error); // Part of TransferFileFromLocalToRemote(). Called after // GetEntryInfoByPath() is complete. @@ -196,7 +196,7 @@ class GDataFileSystem : public GDataFileSystemInterface, const FilePath& local_src_file_path, const FilePath& remote_dest_file_path, const FileOperationCallback& callback, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto); // Initiates transfer of |local_file_path| with |resource_id| to @@ -233,14 +233,14 @@ class GDataFileSystem : public GDataFileSystemInterface, void OnGetEntryInfoForCreateFile(const FilePath& file_path, bool is_exclusive, const FileOperationCallback& callback, - GDataFileError result, + DriveFileError result, scoped_ptr<DriveEntryProto> entry_proto); void DoUploadForCreateBrandNewFile(const FilePath& remote_path, FilePath* local_path, const FileOperationCallback& callback); void DidUploadForCreateBrandNewFile(const FilePath& local_path, const FileOperationCallback& callback, - GDataFileError result); + DriveFileError result); // Invoked upon completion of GetEntryInfoByPath initiated by // GetFileByPath. It then continues to invoke GetResolvedFileByPath. @@ -248,7 +248,7 @@ class GDataFileSystem : public GDataFileSystemInterface, const FilePath& file_path, const GetFileCallback& get_file_callback, const GetContentCallback& get_content_callback, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> file_info); // Invoked upon completion of GetEntryInfoByPath initiated by OpenFile. @@ -257,7 +257,7 @@ class GDataFileSystem : public GDataFileSystemInterface, void OnGetEntryInfoCompleteForOpenFile( const FilePath& file_path, const OpenFileCallback& callback, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> file_info); // Invoked at the last step of OpenFile. It removes |file_path| from the @@ -265,7 +265,7 @@ class GDataFileSystem : public GDataFileSystemInterface, // |callback| function. void OnOpenFileFinished(const FilePath& file_path, const OpenFileCallback& callback, - GDataFileError result, + DriveFileError result, const FilePath& cache_file_path); // Invoked during the process of CloseFile. What is done here is as follows: @@ -277,16 +277,16 @@ class GDataFileSystem : public GDataFileSystemInterface, void CloseFileOnUIThreadAfterGetEntryInfo( const FilePath& file_path, const FileOperationCallback& callback, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto); void CloseFileOnUIThreadAfterCommitDirtyInCache( const FileOperationCallback& callback, - GDataFileError error, + DriveFileError error, const std::string& resource_id, const std::string& md5); void CloseFileOnUIThreadFinalize(const FilePath& file_path, const FileOperationCallback& callback, - GDataFileError result); + DriveFileError result); // Invoked upon completion of GetFileByPath initiated by Copy. If // GetFileByPath reports no error, calls TransferRegularFile to transfer @@ -295,7 +295,7 @@ class GDataFileSystem : public GDataFileSystemInterface, // Can be called from UI thread. |callback| is run on the calling thread. void OnGetFileCompleteForCopy(const FilePath& remote_dest_file_path, const FileOperationCallback& callback, - GDataFileError error, + DriveFileError error, const FilePath& local_file_path, const std::string& unused_mime_type, DriveFileType file_type); @@ -309,7 +309,7 @@ class GDataFileSystem : public GDataFileSystemInterface, // |callback| must not be null. void OnGetFileCompleteForTransferFile(const FilePath& local_dest_file_path, const FileOperationCallback& callback, - GDataFileError error, + DriveFileError error, const FilePath& local_file_path, const std::string& unused_mime_type, DriveFileType file_type); @@ -323,7 +323,7 @@ class GDataFileSystem : public GDataFileSystemInterface, void OnGetFileCompleteForOpenFile( const OpenFileCallback& callback, const GetFileCompleteForOpenParams& file_info, - GDataFileError error, + DriveFileError error, const FilePath& file_path, const std::string& mime_type, DriveFileType file_type); @@ -354,7 +354,7 @@ class GDataFileSystem : public GDataFileSystemInterface, void RenameAfterGetEntryInfo(const FilePath& file_path, const FilePath::StringType& new_name, const FileMoveCallback& callback, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto); // Moves a file or directory at |file_path| in the root directory to @@ -365,7 +365,7 @@ class GDataFileSystem : public GDataFileSystemInterface, // |callback| must not be null. void MoveEntryFromRootDirectory(const FilePath& dir_path, const FileOperationCallback& callback, - GDataFileError error, + DriveFileError error, const FilePath& file_path); // Part of MoveEntryFromRootDirectory(). Called after @@ -387,20 +387,20 @@ class GDataFileSystem : public GDataFileSystemInterface, // Can be called from UI thread. |callback| is run on the calling thread. // |callback| must not be null. void RemoveEntryFromNonRootDirectory(const FileMoveCallback& callback, - GDataFileError error, + DriveFileError error, const FilePath& file_path); // Removes file under |file_path| on the client side. // |resource_id| contains the resource id of the removed file if it was a // file. // Return PLATFORM_FILE_OK if successful. - GDataFileError RemoveEntryLocally(const FilePath& file_path, + DriveFileError RemoveEntryLocally(const FilePath& file_path, std::string* resource_id); // A pass-through callback used for bridging from // FileMoveCallback to FileOperationCallback. void OnFilePathUpdated(const FileOperationCallback& cllback, - GDataFileError error, + DriveFileError error, const FilePath& file_path); // Invoked upon completion of MarkDirtyInCache initiated by OpenFile. Invokes @@ -409,7 +409,7 @@ class GDataFileSystem : public GDataFileSystemInterface, // // Must be called on UI thread. void OnMarkDirtyInCacheCompleteForOpenFile(const OpenFileCallback& callback, - GDataFileError error, + DriveFileError error, const std::string& resource_id, const std::string& md5, const FilePath& cache_file_path); @@ -477,7 +477,7 @@ class GDataFileSystem : public GDataFileSystemInterface, // Callback for handling internal StoreToCache() calls after downloading // file content. - void OnDownloadStoredToCache(GDataFileError error, + void OnDownloadStoredToCache(DriveFileError error, const std::string& resource_id, const std::string& md5); @@ -503,14 +503,14 @@ class GDataFileSystem : public GDataFileSystemInterface, // Removes a file or directory under |file_path| on the client side and the // corresponding file from cache if it exists. Returns PLATFORM_FILE_OK if // successful. - GDataFileError RemoveEntryAndCacheLocally(const FilePath& file_path); + DriveFileError RemoveEntryAndCacheLocally(const FilePath& file_path); // Callback when an entry is moved to another directory on the client side. // Notifies the directory change and runs |callback|. // |callback| may be null. void NotifyAndRunFileMoveCallback( const FileMoveCallback& callback, - GDataFileError error, + DriveFileError error, const FilePath& moved_file_path); // Callback when an entry is moved to another directory on the client side. @@ -518,12 +518,12 @@ class GDataFileSystem : public GDataFileSystemInterface, // |callback| must not be null. void NotifyAndRunFileOperationCallback( const FileOperationCallback& callback, - GDataFileError error, + DriveFileError error, const FilePath& moved_file_path); // FileMoveCallback for directory changes. void OnDirectoryChangeFileMoveCallback( - GDataFileError error, + DriveFileError error, const FilePath& directory_path); // Callback for GetEntryByResourceIdAsync. @@ -535,17 +535,17 @@ class GDataFileSystem : public GDataFileSystemInterface, // Continues to add an uploaded file after existing entry has been deleted. void ContinueAddUploadedFile(AddUploadedFileParams* params, - GDataFileError error, + DriveFileError error, const FilePath& file_path); // Adds the uploaded file to the cache. void AddUploadedFileToCache(AddUploadedFileParams* params, - GDataFileError error, + DriveFileError error, const FilePath& file_path); // Converts |entry_value| into GFileDocument instance and adds it // to virtual file system at |directory_path|. - GDataFileError AddNewDirectory(const FilePath& directory_path, + DriveFileError AddNewDirectory(const FilePath& directory_path, base::Value* entry_value); // Given non-existing |directory_path|, finds the first missing parent @@ -560,22 +560,22 @@ class GDataFileSystem : public GDataFileSystemInterface, // reloaded, and in case of failure, restores the content origin of the root // directory. void OnUpdateChecked(ContentOrigin initial_origin, - GDataFileError error); + DriveFileError error); // Notifies that the initial load is finished and runs |callback|. // |callback| must not be null. void NotifyInitialLoadFinishedAndRun(const FileOperationCallback& callback, - GDataFileError error); + DriveFileError error); // Helper function that completes bookkeeping tasks related to // completed file transfer. void OnTransferCompleted(const FileOperationCallback& callback, - GDataFileError error, + DriveFileError error, scoped_ptr<UploadFileInfo> upload_file_info); // Kicks off file upload once it receives |file_size| and |content_type|. void StartFileUploadOnUIThread(const StartFileUploadParams& params, - GDataFileError* error, + DriveFileError* error, int64* file_size, std::string* content_type); @@ -585,7 +585,7 @@ class GDataFileSystem : public GDataFileSystemInterface, const StartFileUploadParams& params, int64 file_size, std::string content_type, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto); // Cache intermediate callbacks, that run on calling thread, for above cache @@ -595,7 +595,7 @@ class GDataFileSystem : public GDataFileSystemInterface, // GetFileFromCacheByResourceIdAndMd5() calls during processing of // GetFileByPath() request. void OnGetFileFromCache(const GetFileFromCacheParams& params, - GDataFileError error, + DriveFileError error, const std::string& resource_id, const std::string& md5, const FilePath& cache_file_path); @@ -631,10 +631,10 @@ class GDataFileSystem : public GDataFileSystemInterface, void GetEntryInfoByPathOnUIThreadAfterLoad( const FilePath& file_path, const GetEntryInfoCallback& callback, - GDataFileError error); + DriveFileError error); void GetEntryInfoByPathOnUIThreadAfterGetEntry( const GetEntryInfoCallback& callback, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto); // Part of ReadDirectoryByPathOnUIThread() @@ -644,10 +644,10 @@ class GDataFileSystem : public GDataFileSystemInterface, void ReadDirectoryByPathOnUIThreadAfterLoad( const FilePath& file_path, const ReadDirectoryWithSettingCallback& callback, - GDataFileError error); + DriveFileError error); void ReadDirectoryByPathOnUIThreadAfterRead( const ReadDirectoryWithSettingCallback& callback, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProtoVector> entries); // Loads the feed from the cache or the server if not yet loaded. Runs @@ -663,7 +663,7 @@ class GDataFileSystem : public GDataFileSystemInterface, const FilePath& file_path, const GetFileCallback& get_file_callback, const GetContentCallback& get_content_callback, - GDataFileError error, + DriveFileError error, const DriveEntryProto* entry_proto); // Part of UpdateFileByResourceId(). Called when @@ -671,7 +671,7 @@ class GDataFileSystem : public GDataFileSystemInterface, // |callback| must not be null. void UpdateFileByEntryInfo( const FileOperationCallback& callback, - GDataFileError error, + DriveFileError error, const FilePath& /* drive_file_path */, scoped_ptr<DriveEntryProto> entry_proto); @@ -680,7 +680,7 @@ class GDataFileSystem : public GDataFileSystemInterface, // UpdateFileByResourceId(). // |callback| must not be null. void OnGetFileCompleteForUpdateFile(const FileOperationCallback& callback, - GDataFileError error, + DriveFileError error, const std::string& resource_id, const std::string& md5, const FilePath& cache_file_path); @@ -691,7 +691,7 @@ class GDataFileSystem : public GDataFileSystemInterface, void OnGetFileSizeCompleteForUpdateFile(const FileOperationCallback& callback, const std::string& resource_id, const FilePath& cache_file_path, - GDataFileError* error, + DriveFileError* error, int64* file_size); // Part of UpdateFileByResourceId(). @@ -701,7 +701,7 @@ class GDataFileSystem : public GDataFileSystemInterface, const FileOperationCallback& callback, int64 file_size, const FilePath& cache_file_path, - GDataFileError error, + DriveFileError error, const FilePath& drive_file_path, scoped_ptr<DriveEntryProto> entry_proto); @@ -710,7 +710,7 @@ class GDataFileSystem : public GDataFileSystemInterface, // UpdateFileByResourceId(). // |callback| must not be null. void OnUpdatedFileUploaded(const FileOperationCallback& callback, - GDataFileError error, + DriveFileError error, scoped_ptr<UploadFileInfo> upload_file_info); // The following functions are used to forward calls to asynchronous public @@ -766,7 +766,7 @@ class GDataFileSystem : public GDataFileSystemInterface, void RequestDirectoryRefreshOnUIThread(const FilePath& file_path); void OnRequestDirectoryRefresh(const FilePath& directory_path, GetDocumentsParams* params, - GDataFileError error); + DriveFileError error); void GetAvailableSpaceOnUIThread(const GetAvailableSpaceCallback& callback); void AddUploadedFileOnUIThread(UploadMode upload_mode, const FilePath& virtual_dir_path, @@ -800,14 +800,14 @@ class GDataFileSystem : public GDataFileSystemInterface, const FilePath& file_path, bool is_recursive, const FileOperationCallback& callback, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto); // Part of RequestDirectoryRefreshOnUIThread(). Called after // GetEntryInfoByPath() is complete. void RequestDirectoryRefreshOnUIThreadAfterGetEntryInfo( const FilePath& file_path, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto); // Part of GetEntryByResourceId and GetEntryByPath. Checks whether there is a @@ -824,7 +824,7 @@ class GDataFileSystem : public GDataFileSystemInterface, void CheckLocalModificationAndRunAfterGetCacheFile( scoped_ptr<DriveEntryProto> entry_proto, const GetEntryInfoCallback& callback, - GDataFileError error, + DriveFileError error, const std::string& resource_id, const std::string& md5, const FilePath& local_cache_path); diff --git a/chrome/browser/chromeos/gdata/gdata_file_system_interface.h b/chrome/browser/chromeos/gdata/gdata_file_system_interface.h index 190a24d..a2dfa80 100644 --- a/chrome/browser/chromeos/gdata/gdata_file_system_interface.h +++ b/chrome/browser/chromeos/gdata/gdata_file_system_interface.h @@ -35,7 +35,7 @@ struct SearchResultInfo { }; // Used to get files from the file system. -typedef base::Callback<void(GDataFileError error, +typedef base::Callback<void(DriveFileError error, const FilePath& file_path, const std::string& mime_type, DriveFileType file_type)> GetFileCallback; @@ -43,27 +43,27 @@ typedef base::Callback<void(GDataFileError error, // Used to read a directory from the file system. // Similar to ReadDirectoryCallback but this one provides // |hide_hosted_documents| -// If |error| is not GDATA_FILE_OK, |entries| is set to NULL. +// If |error| is not DRIVE_FILE_OK, |entries| is set to NULL. // |entries| are contents, both files and directories, of the directory. -typedef base::Callback<void(GDataFileError error, +typedef base::Callback<void(DriveFileError error, bool hide_hosted_documents, scoped_ptr<DriveEntryProtoVector> entries)> ReadDirectoryWithSettingCallback; // Used to get drive content search results. -// If |error| is not GDATA_FILE_OK, |result_paths| is empty. +// If |error| is not DRIVE_FILE_OK, |result_paths| is empty. typedef base::Callback<void( - GDataFileError error, + DriveFileError error, const GURL& next_feed, scoped_ptr<std::vector<SearchResultInfo> > result_paths)> SearchCallback; // Used to open files from the file system. |file_path| is the path on the local // file system for the opened file. -typedef base::Callback<void(GDataFileError error, +typedef base::Callback<void(DriveFileError error, const FilePath& file_path)> OpenFileCallback; // Used to get available space for the account from GData. -typedef base::Callback<void(GDataFileError error, +typedef base::Callback<void(DriveFileError error, int64 bytes_total, int64 bytes_used)> GetAvailableSpaceCallback; diff --git a/chrome/browser/chromeos/gdata/gdata_file_system_proxy.cc b/chrome/browser/chromeos/gdata/gdata_file_system_proxy.cc index c5e25f6..aa45ad0 100644 --- a/chrome/browser/chromeos/gdata/gdata_file_system_proxy.cc +++ b/chrome/browser/chromeos/gdata/gdata_file_system_proxy.cc @@ -64,12 +64,12 @@ void OnGetFileByPathForOpen( const FileSystemOperationInterface::OpenFileCallback& callback, int file_flags, base::ProcessHandle peer_handle, - GDataFileError gdata_error, + DriveFileError file_error, const FilePath& local_path, const std::string& unused_mime_type, DriveFileType file_type) { base::PlatformFileError error = - util::GDataFileErrorToPlatformError(gdata_error); + util::DriveFileErrorToPlatformError(file_error); if (error != base::PLATFORM_FILE_OK) { callback.Run(error, base::kInvalidPlatformFileValue, peer_handle); return; @@ -97,13 +97,13 @@ void OnGetFileByPathForOpen( void CallSnapshotFileCallback( const FileSystemOperationInterface::SnapshotFileCallback& callback, const base::PlatformFileInfo& file_info, - GDataFileError gdata_error, + DriveFileError file_error, const FilePath& local_path, const std::string& unused_mime_type, DriveFileType file_type) { scoped_refptr<ShareableFileReference> file_ref; base::PlatformFileError error = - util::GDataFileErrorToPlatformError(gdata_error); + util::DriveFileErrorToPlatformError(file_error); // If the file is a hosted document, a temporary JSON file is created to // represent the document. The JSON file is not cached and its lifetime @@ -128,7 +128,7 @@ void CallSnapshotFileCallback( // Emits debug log when GDataFileSystem::CloseFile() is complete. void EmitDebugLogForCloseFile(const FilePath& local_path, - GDataFileError error_code) { + DriveFileError error_code) { DVLOG(1) << "Closed: " << local_path.AsUTF8Unsafe() << ": " << error_code; } @@ -154,10 +154,10 @@ void DoTruncateOnFileThread( void DidCloseFileForTruncate( const FileSystemOperationInterface::StatusCallback& callback, base::PlatformFileError truncate_result, - GDataFileError close_result) { + DriveFileError close_result) { // Reports the first error. callback.Run(truncate_result == base::PLATFORM_FILE_OK ? - util::GDataFileErrorToPlatformError(close_result) : + util::DriveFileErrorToPlatformError(close_result) : truncate_result); } @@ -358,12 +358,12 @@ void GDataFileSystemProxy::OnOpenFileForWriting( int file_flags, base::ProcessHandle peer_handle, const FileSystemOperationInterface::OpenFileCallback& callback, - GDataFileError gdata_error, + DriveFileError file_error, const FilePath& local_cache_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); base::PlatformFileError error = - util::GDataFileErrorToPlatformError(gdata_error); + util::DriveFileErrorToPlatformError(file_error); if (error != base::PLATFORM_FILE_OK) { callback.Run(error, base::kInvalidPlatformFileValue, peer_handle); @@ -395,10 +395,10 @@ void GDataFileSystemProxy::OnCreateFileForOpen( int file_flags, base::ProcessHandle peer_handle, const FileSystemOperationInterface::OpenFileCallback& callback, - GDataFileError gdata_error) { + DriveFileError file_error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); base::PlatformFileError create_result = - util::GDataFileErrorToPlatformError(gdata_error); + util::DriveFileErrorToPlatformError(file_error); if ((create_result == base::PLATFORM_FILE_OK) || ((create_result == base::PLATFORM_FILE_ERROR_EXISTS) && @@ -427,12 +427,12 @@ void GDataFileSystemProxy::OnFileOpenedForTruncate( const FilePath& virtual_path, int64 length, const fileapi::FileSystemOperationInterface::StatusCallback& callback, - GDataFileError open_result, + DriveFileError open_result, const FilePath& local_cache_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - if (open_result != GDATA_FILE_OK) { - callback.Run(util::GDataFileErrorToPlatformError(open_result)); + if (open_result != DRIVE_FILE_OK) { + callback.Run(util::DriveFileErrorToPlatformError(open_result)); return; } @@ -581,11 +581,11 @@ void GDataFileSystemProxy::CreateSnapshotFile( void GDataFileSystemProxy::OnGetEntryInfoByPath( const FilePath& entry_path, const FileSystemOperationInterface::SnapshotFileCallback& callback, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - if (error != GDATA_FILE_OK || !entry_proto.get()) { + if (error != DRIVE_FILE_OK || !entry_proto.get()) { MessageLoopProxy::current()->PostTask(FROM_HERE, base::Bind(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND, @@ -648,19 +648,19 @@ bool GDataFileSystemProxy::ValidateUrl( void GDataFileSystemProxy::OnStatusCallback( const fileapi::FileSystemOperationInterface::StatusCallback& callback, - GDataFileError error) { - callback.Run(util::GDataFileErrorToPlatformError(error)); + DriveFileError error) { + callback.Run(util::DriveFileErrorToPlatformError(error)); } void GDataFileSystemProxy::OnGetMetadata( const FilePath& file_path, const FileSystemOperationInterface::GetMetadataCallback& callback, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - if (error != GDATA_FILE_OK) { - callback.Run(util::GDataFileErrorToPlatformError(error), + if (error != DRIVE_FILE_OK) { + callback.Run(util::DriveFileErrorToPlatformError(error), base::PlatformFileInfo(), FilePath()); return; @@ -678,13 +678,13 @@ void GDataFileSystemProxy::OnGetMetadata( void GDataFileSystemProxy::OnReadDirectory( const FileSystemOperationInterface::ReadDirectoryCallback& callback, - GDataFileError error, + DriveFileError error, bool hide_hosted_documents, scoped_ptr<DriveEntryProtoVector> proto_entries) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - if (error != GDATA_FILE_OK) { - callback.Run(util::GDataFileErrorToPlatformError(error), + if (error != DRIVE_FILE_OK) { + callback.Run(util::DriveFileErrorToPlatformError(error), std::vector<base::FileUtilProxy::Entry>(), false); return; @@ -709,13 +709,13 @@ void GDataFileSystemProxy::OnReadDirectory( void GDataFileSystemProxy::OnCreateWritableSnapshotFile( const FilePath& virtual_path, const fileapi::WritableSnapshotFile& callback, - GDataFileError result, + DriveFileError result, const FilePath& local_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); scoped_refptr<ShareableFileReference> file_ref; - if (result == GDATA_FILE_OK) { + if (result == DRIVE_FILE_OK) { file_ref = ShareableFileReference::GetOrCreate( local_path, ShareableFileReference::DONT_DELETE_ON_FINAL_RELEASE, @@ -727,7 +727,7 @@ void GDataFileSystemProxy::OnCreateWritableSnapshotFile( } callback.Run( - util::GDataFileErrorToPlatformError(result), local_path, file_ref); + util::DriveFileErrorToPlatformError(result), local_path, file_ref); } void GDataFileSystemProxy::CloseWritableSnapshotFile( diff --git a/chrome/browser/chromeos/gdata/gdata_file_system_proxy.h b/chrome/browser/chromeos/gdata/gdata_file_system_proxy.h index 2177214..ef33146 100644 --- a/chrome/browser/chromeos/gdata/gdata_file_system_proxy.h +++ b/chrome/browser/chromeos/gdata/gdata_file_system_proxy.h @@ -93,7 +93,7 @@ class GDataFileSystemProxy : public fileapi::RemoteFileSystemProxyInterface { // calling thread. void OnStatusCallback( const fileapi::FileSystemOperationInterface::StatusCallback& callback, - GDataFileError error); + DriveFileError error); // Helper callback for relaying reply for metadata retrieval request to the // calling thread. @@ -101,7 +101,7 @@ class GDataFileSystemProxy : public fileapi::RemoteFileSystemProxyInterface { const FilePath& file_path, const fileapi::FileSystemOperationInterface::GetMetadataCallback& callback, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto); // Helper callback for relaying reply for GetEntryInfoByPath() to the @@ -110,7 +110,7 @@ class GDataFileSystemProxy : public fileapi::RemoteFileSystemProxyInterface { const FilePath& entry_path, const fileapi::FileSystemOperationInterface::SnapshotFileCallback& callback, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto); // Helper callback for relaying reply for ReadDirectory() to the calling @@ -118,7 +118,7 @@ class GDataFileSystemProxy : public fileapi::RemoteFileSystemProxyInterface { void OnReadDirectory( const fileapi::FileSystemOperationInterface::ReadDirectoryCallback& callback, - GDataFileError error, + DriveFileError error, bool hide_hosted_documents, scoped_ptr<DriveEntryProtoVector> proto_entries); @@ -127,7 +127,7 @@ class GDataFileSystemProxy : public fileapi::RemoteFileSystemProxyInterface { void OnCreateWritableSnapshotFile( const FilePath& virtual_path, const fileapi::WritableSnapshotFile& callback, - GDataFileError result, + DriveFileError result, const FilePath& local_path); // Helper callback for closing the local cache file and committing the dirty @@ -143,7 +143,7 @@ class GDataFileSystemProxy : public fileapi::RemoteFileSystemProxyInterface { const FilePath& virtual_path, int64 length, const fileapi::FileSystemOperationInterface::StatusCallback& callback, - GDataFileError open_result, + DriveFileError open_result, const FilePath& local_cache_path); // Invoked during Truncate() operation. This is called when the truncation of @@ -160,7 +160,7 @@ class GDataFileSystemProxy : public fileapi::RemoteFileSystemProxyInterface { int file_flags, base::ProcessHandle peer_handle, const fileapi::FileSystemOperationInterface::OpenFileCallback& callback, - GDataFileError gdata_error, + DriveFileError file_error, const FilePath& local_cache_path); // Invoked during OpenFile() operation when file create flags are set. @@ -169,7 +169,7 @@ class GDataFileSystemProxy : public fileapi::RemoteFileSystemProxyInterface { int file_flags, base::ProcessHandle peer_handle, const fileapi::FileSystemOperationInterface::OpenFileCallback& callback, - GDataFileError gdata_error); + DriveFileError file_error); // Invoked during OpenFile() operation when base::PLATFORM_FILE_OPEN_TRUNCATED // flag is set. This is called when the truncation of a local cache file is diff --git a/chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc b/chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc index cd1ddf3..dd42b20 100644 --- a/chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc +++ b/chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc @@ -59,7 +59,7 @@ void DriveSearchCallback( MessageLoop* message_loop, const SearchResultPair* expected_results, size_t expected_results_size, - GDataFileError error, + DriveFileError error, const GURL& next_feed, scoped_ptr<std::vector<SearchResultInfo> > results) { ASSERT_TRUE(results.get()); @@ -166,7 +166,7 @@ class MockGDataUploader : public GDataUploaderInterface { const UploadFileInfo::UploadCompletionCallback callback = upload_file_info->completion_callback; if (!callback.is_null()) - callback.Run(GDATA_FILE_OK, upload_file_info.Pass()); + callback.Run(DRIVE_FILE_OK, upload_file_info.Pass()); const int kUploadId = 123; return kUploadId; @@ -212,7 +212,7 @@ class GDataFileSystemTest : public testing::Test { mock_drive_service_(NULL), mock_webapps_registry_(NULL), num_callback_invocations_(0), - expected_error_(GDATA_FILE_OK), + expected_error_(DRIVE_FILE_OK), expected_cache_state_(0), expected_sub_dir_type_(DriveCache::CACHE_TYPE_META), expected_success_(true), @@ -326,7 +326,7 @@ class GDataFileSystemTest : public testing::Test { ASSERT_EQ(file_system_->AddNewDirectory(directory_path.DirName(), entry_value), - GDATA_FILE_OK) + DRIVE_FILE_OK) << "Failed adding " << directory_path.DirName().value(); } @@ -339,12 +339,12 @@ class GDataFileSystemTest : public testing::Test { return file_system_->UpdateFromFeedForTesting( list, largest_changestamp, - root_feed_changestamp_++) == GDATA_FILE_OK; + root_feed_changestamp_++) == DRIVE_FILE_OK; } bool RemoveEntry(const FilePath& file_path) { return file_system_->RemoveEntryAndCacheLocally(file_path) == - GDATA_FILE_OK; + DRIVE_FILE_OK; } FilePath GetCachePathForFile(const std::string& resource_id, @@ -443,7 +443,7 @@ class GDataFileSystemTest : public testing::Test { const std::string& resource_id, const std::string& md5, const FilePath& source_path, - GDataFileError expected_error, + DriveFileError expected_error, int expected_cache_state, DriveCache::CacheSubDirectoryType expected_sub_dir_type) { expected_error_ = expected_error; @@ -462,7 +462,7 @@ class GDataFileSystemTest : public testing::Test { void TestPin( const std::string& resource_id, const std::string& md5, - GDataFileError expected_error, + DriveFileError expected_error, int expected_cache_state, DriveCache::CacheSubDirectoryType expected_sub_dir_type) { expected_error_ = expected_error; @@ -480,7 +480,7 @@ class GDataFileSystemTest : public testing::Test { void TestMarkDirty( const std::string& resource_id, const std::string& md5, - GDataFileError expected_error, + DriveFileError expected_error, int expected_cache_state, DriveCache::CacheSubDirectoryType expected_sub_dir_type) { expected_error_ = expected_error; @@ -496,14 +496,14 @@ class GDataFileSystemTest : public testing::Test { test_util::RunBlockingPoolTask(); } - void VerifyMarkDirty(GDataFileError error, + void VerifyMarkDirty(DriveFileError error, const std::string& resource_id, const std::string& md5, const FilePath& cache_file_path) { VerifyCacheFileState(error, resource_id, md5); // Verify filename of |cache_file_path|. - if (error == GDATA_FILE_OK) { + if (error == DRIVE_FILE_OK) { FilePath base_name = cache_file_path.BaseName(); EXPECT_EQ(util::EscapeCacheFileName(resource_id) + FilePath::kExtensionSeparator + @@ -517,7 +517,7 @@ class GDataFileSystemTest : public testing::Test { void TestCommitDirty( const std::string& resource_id, const std::string& md5, - GDataFileError expected_error, + DriveFileError expected_error, int expected_cache_state, DriveCache::CacheSubDirectoryType expected_sub_dir_type) { expected_error_ = expected_error; @@ -536,11 +536,11 @@ class GDataFileSystemTest : public testing::Test { // Verify the file identified by |resource_id| and |md5| is in the expected // cache state after |OpenFile|, that is, marked dirty and has no outgoing // symlink, etc. - void VerifyCacheStateAfterOpenFile(GDataFileError error, + void VerifyCacheStateAfterOpenFile(DriveFileError error, const std::string& resource_id, const std::string& md5, const FilePath& cache_file_path) { - expected_error_ = GDATA_FILE_OK; + expected_error_ = DRIVE_FILE_OK; expected_cache_state_ = (test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_DIRTY | test_util::TEST_CACHE_STATE_PERSISTENT); @@ -552,10 +552,10 @@ class GDataFileSystemTest : public testing::Test { // Verify the file identified by |resource_id| and |md5| is in the expected // cache state after |CloseFile|, that is, marked dirty and has an outgoing // symlink, etc. - void VerifyCacheStateAfterCloseFile(GDataFileError error, + void VerifyCacheStateAfterCloseFile(DriveFileError error, const std::string& resource_id, const std::string& md5) { - expected_error_ = GDATA_FILE_OK; + expected_error_ = DRIVE_FILE_OK; expected_cache_state_ = (test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_DIRTY | test_util::TEST_CACHE_STATE_PERSISTENT); @@ -564,7 +564,7 @@ class GDataFileSystemTest : public testing::Test { VerifyCacheFileState(error, resource_id, md5); } - void VerifyCacheFileState(GDataFileError error, + void VerifyCacheFileState(DriveFileError error, const std::string& resource_id, const std::string& md5) { ++num_callback_invocations_; @@ -765,12 +765,12 @@ class GDataFileSystemTest : public testing::Test { : public base::RefCountedThreadSafe<CallbackHelper> { public: CallbackHelper() - : last_error_(GDATA_FILE_OK), + : last_error_(DRIVE_FILE_OK), quota_bytes_total_(0), quota_bytes_used_(0), entry_proto_(NULL) {} - virtual void GetFileCallback(GDataFileError error, + virtual void GetFileCallback(DriveFileError error, const FilePath& file_path, const std::string& mime_type, DriveFileType file_type) { @@ -780,13 +780,13 @@ class GDataFileSystemTest : public testing::Test { file_type_ = file_type; } - virtual void FileOperationCallback(GDataFileError error) { + virtual void FileOperationCallback(DriveFileError error) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); last_error_ = error; } - virtual void GetAvailableSpaceCallback(GDataFileError error, + virtual void GetAvailableSpaceCallback(DriveFileError error, int64 bytes_total, int64 bytes_used) { last_error_ = error; @@ -794,34 +794,34 @@ class GDataFileSystemTest : public testing::Test { quota_bytes_used_ = bytes_used; } - virtual void OpenFileCallback(GDataFileError error, + virtual void OpenFileCallback(DriveFileError error, const FilePath& file_path) { last_error_ = error; opened_file_path_ = file_path; MessageLoop::current()->Quit(); } - virtual void CloseFileCallback(GDataFileError error) { + virtual void CloseFileCallback(DriveFileError error) { last_error_ = error; MessageLoop::current()->Quit(); } virtual void GetEntryInfoCallback( - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { last_error_ = error; entry_proto_ = entry_proto.Pass(); } virtual void ReadDirectoryCallback( - GDataFileError error, + DriveFileError error, bool /* hide_hosted_documents */, scoped_ptr<DriveEntryProtoVector> entries) { last_error_ = error; directory_entries_ = entries.Pass(); } - GDataFileError last_error_; + DriveFileError last_error_; FilePath download_path_; FilePath opened_file_path_; std::string mime_type_; @@ -856,7 +856,7 @@ class GDataFileSystemTest : public testing::Test { scoped_ptr<StrictMock<MockDirectoryChangeObserver> > mock_directory_observer_; int num_callback_invocations_; - GDataFileError expected_error_; + DriveFileError expected_error_; int expected_cache_state_; DriveCache::CacheSubDirectoryType expected_sub_dir_type_; bool expected_success_; @@ -873,9 +873,9 @@ void AsyncInitializationCallback( int expected_counter, const FilePath& expected_file_path, MessageLoop* message_loop, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { - ASSERT_EQ(GDATA_FILE_OK, error); + ASSERT_EQ(DRIVE_FILE_OK, error); ASSERT_TRUE(entry_proto.get()); ASSERT_TRUE(entry_proto->file_info().is_directory()); EXPECT_EQ(expected_file_path.value(), entry_proto->base_name()); @@ -1283,7 +1283,7 @@ TEST_F(GDataFileSystemTest, TransferFileFromLocalToRemote_RegularFile) { local_src_file_path, remote_dest_file_path, callback); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_OK, callback_helper_->last_error_); + EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); // Now the remote file should exist. EXPECT_TRUE(EntryExists(remote_dest_file_path)); @@ -1335,7 +1335,7 @@ TEST_F(GDataFileSystemTest, TransferFileFromLocalToRemote_HostedDocument) { local_src_file_path, remote_dest_file_path, callback); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_OK, callback_helper_->last_error_); + EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); // Now the remote file should exist. EXPECT_TRUE(EntryExists(remote_dest_file_path)); @@ -1384,7 +1384,7 @@ TEST_F(GDataFileSystemTest, TransferFileFromRemoteToLocal_RegularFile) { remote_src_file_path, local_dest_file_path, callback); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_OK, callback_helper_->last_error_); + EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); std::string cache_file_data; EXPECT_TRUE(file_util::ReadFileToString(cache_file, &cache_file_data)); @@ -1411,7 +1411,7 @@ TEST_F(GDataFileSystemTest, TransferFileFromRemoteToLocal_HostedDocument) { remote_src_file_path, local_dest_file_path, callback); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_OK, callback_helper_->last_error_); + EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); scoped_ptr<DriveEntryProto> entry_proto = GetEntryInfoByPathSync( remote_src_file_path); @@ -1433,7 +1433,7 @@ TEST_F(GDataFileSystemTest, CopyNotExistingFile) { file_system_->Copy(src_file_path, dest_file_path, callback); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); + EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); EXPECT_FALSE(EntryExists(src_file_path)); EXPECT_FALSE(EntryExists(dest_file_path)); @@ -1462,7 +1462,7 @@ TEST_F(GDataFileSystemTest, CopyFileToNonExistingDirectory) { file_system_->Move(src_file_path, dest_file_path, callback); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); + EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); EXPECT_TRUE(EntryExists(src_file_path)); EXPECT_FALSE(EntryExists(dest_parent_path)); @@ -1498,7 +1498,7 @@ TEST_F(GDataFileSystemTest, CopyFileToInvalidPath) { file_system_->Copy(src_file_path, dest_file_path, callback); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_ERROR_NOT_A_DIRECTORY, + EXPECT_EQ(DRIVE_FILE_ERROR_NOT_A_DIRECTORY, callback_helper_->last_error_); EXPECT_TRUE(EntryExists(src_file_path)); @@ -1537,7 +1537,7 @@ TEST_F(GDataFileSystemTest, RenameFile) { file_system_->Move(src_file_path, dest_file_path, callback); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_OK, callback_helper_->last_error_); + EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); EXPECT_FALSE(EntryExists(src_file_path)); EXPECT_TRUE(EntryExists(dest_file_path)); @@ -1586,7 +1586,7 @@ TEST_F(GDataFileSystemTest, MoveFileFromRootToSubDirectory) { file_system_->Move(src_file_path, dest_file_path, callback); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_OK, callback_helper_->last_error_); + EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); EXPECT_FALSE(EntryExists(src_file_path)); EXPECT_TRUE(EntryExists(dest_file_path)); @@ -1637,7 +1637,7 @@ TEST_F(GDataFileSystemTest, MoveFileFromSubDirectoryToRoot) { file_system_->Move(src_file_path, dest_file_path, callback); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_OK, callback_helper_->last_error_); + EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); EXPECT_FALSE(EntryExists(src_file_path)); ASSERT_TRUE(EntryExists(dest_file_path)); @@ -1712,7 +1712,7 @@ TEST_F(GDataFileSystemTest, MoveFileBetweenSubDirectories) { file_system_->Move(src_file_path, dest_file_path, callback); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_OK, callback_helper_->last_error_); + EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); EXPECT_FALSE(EntryExists(src_file_path)); EXPECT_FALSE(EntryExists(interim_file_path)); @@ -1736,7 +1736,7 @@ TEST_F(GDataFileSystemTest, MoveNotExistingFile) { file_system_->Move(src_file_path, dest_file_path, callback); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); + EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); EXPECT_FALSE(EntryExists(src_file_path)); EXPECT_FALSE(EntryExists(dest_file_path)); @@ -1765,7 +1765,7 @@ TEST_F(GDataFileSystemTest, MoveFileToNonExistingDirectory) { file_system_->Move(src_file_path, dest_file_path, callback); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); + EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); EXPECT_FALSE(EntryExists(dest_parent_path)); @@ -1801,7 +1801,7 @@ TEST_F(GDataFileSystemTest, MoveFileToInvalidPath) { file_system_->Move(src_file_path, dest_file_path, callback); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_ERROR_NOT_A_DIRECTORY, + EXPECT_EQ(DRIVE_FILE_ERROR_NOT_A_DIRECTORY, callback_helper_->last_error_); EXPECT_TRUE(EntryExists(src_file_path)); @@ -1950,7 +1950,7 @@ TEST_F(GDataFileSystemTest, CreateDirectoryWithService) { Eq(FilePath(FILE_PATH_LITERAL("drive"))))).Times(1); // Set last error so it's not a valid error code. - callback_helper_->last_error_ = static_cast<GDataFileError>(1); + callback_helper_->last_error_ = static_cast<DriveFileError>(1); file_system_->CreateDirectory( FilePath(FILE_PATH_LITERAL("drive/Sample Directory Title")), false, // is_exclusive @@ -1960,7 +1960,7 @@ TEST_F(GDataFileSystemTest, CreateDirectoryWithService) { test_util::RunBlockingPoolTask(); // TODO(gspencer): Uncomment this when we get a blob that // works that can be returned from the mock. - // EXPECT_EQ(GDATA_FILE_OK, callback_helper_->last_error_); + // EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); } TEST_F(GDataFileSystemTest, GetFileByPath_FromGData_EnoughSpace) { @@ -1998,7 +1998,7 @@ TEST_F(GDataFileSystemTest, GetFileByPath_FromGData_EnoughSpace) { GetContentCallback()); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_OK, callback_helper_->last_error_); + EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); EXPECT_EQ(REGULAR_FILE, callback_helper_->file_type_); EXPECT_EQ(downloaded_file.value(), callback_helper_->download_path_.value()); @@ -2038,7 +2038,7 @@ TEST_F(GDataFileSystemTest, GetFileByPath_FromGData_NoSpaceAtAll) { GetContentCallback()); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_ERROR_NO_SPACE, + EXPECT_EQ(DRIVE_FILE_ERROR_NO_SPACE, callback_helper_->last_error_); } @@ -2069,7 +2069,7 @@ TEST_F(GDataFileSystemTest, GetFileByPath_FromGData_NoEnoughSpaceButCanFreeUp) { TestStoreToCache("<resource_id>", "<md5>", GetTestFilePath("root_feed.json"), - GDATA_FILE_OK, + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); ASSERT_TRUE(CacheEntryExists("<resource_id>", "<md5>")); @@ -2093,7 +2093,7 @@ TEST_F(GDataFileSystemTest, GetFileByPath_FromGData_NoEnoughSpaceButCanFreeUp) { GetContentCallback()); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_OK, callback_helper_->last_error_); + EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); EXPECT_EQ(REGULAR_FILE, callback_helper_->file_type_); EXPECT_EQ(downloaded_file.value(), callback_helper_->download_path_.value()); @@ -2144,7 +2144,7 @@ TEST_F(GDataFileSystemTest, GetFileByPath_FromGData_EnoughSpaceButBecomeFull) { GetContentCallback()); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_ERROR_NO_SPACE, + EXPECT_EQ(DRIVE_FILE_ERROR_NO_SPACE, callback_helper_->last_error_); } @@ -2168,7 +2168,7 @@ TEST_F(GDataFileSystemTest, GetFileByPath_FromCache) { TestStoreToCache(entry_proto->resource_id(), entry_proto->file_specific_info().file_md5(), GetTestFilePath("root_feed.json"), - GDATA_FILE_OK, + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); @@ -2276,7 +2276,7 @@ TEST_F(GDataFileSystemTest, GetFileByResourceId_FromCache) { TestStoreToCache(entry_proto->resource_id(), entry_proto->file_specific_info().file_md5(), GetTestFilePath("root_feed.json"), - GDATA_FILE_OK, + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT, DriveCache::CACHE_TYPE_TMP); @@ -2310,7 +2310,7 @@ TEST_F(GDataFileSystemTest, UpdateFileByResourceId_PersistentFile) { EXPECT_CALL(*mock_cache_observer_, OnCachePinned(kResourceId, kMd5)).Times(1); TestPin(kResourceId, kMd5, - GDATA_FILE_OK, + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PINNED, DriveCache::CACHE_TYPE_TMP); @@ -2323,7 +2323,7 @@ TEST_F(GDataFileSystemTest, UpdateFileByResourceId_PersistentFile) { TestStoreToCache(kResourceId, kMd5, GetTestFilePath("root_feed.json"), // Anything works. - GDATA_FILE_OK, + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_PINNED | test_util::TEST_CACHE_STATE_PERSISTENT, @@ -2334,7 +2334,7 @@ TEST_F(GDataFileSystemTest, UpdateFileByResourceId_PersistentFile) { // GCache/v1/persistent/<kResourceId>.local TestMarkDirty(kResourceId, kMd5, - GDATA_FILE_OK, + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_PINNED | test_util::TEST_CACHE_STATE_DIRTY | @@ -2359,7 +2359,7 @@ TEST_F(GDataFileSystemTest, UpdateFileByResourceId_PersistentFile) { EXPECT_CALL(*mock_cache_observer_, OnCacheCommitted(kResourceId)).Times(1); TestCommitDirty(kResourceId, kMd5, - GDATA_FILE_OK, + DRIVE_FILE_OK, test_util::TEST_CACHE_STATE_PRESENT | test_util::TEST_CACHE_STATE_PINNED | test_util::TEST_CACHE_STATE_DIRTY | @@ -2404,7 +2404,7 @@ TEST_F(GDataFileSystemTest, UpdateFileByResourceId_PersistentFile) { "audio/mpeg", _)) // callback .WillOnce(MockUploadExistingFile( - GDATA_FILE_OK, + DRIVE_FILE_OK, FilePath::FromUTF8Unsafe("drive/File1"), dirty_cache_file_path, document_entry)); @@ -2429,7 +2429,7 @@ TEST_F(GDataFileSystemTest, UpdateFileByResourceId_PersistentFile) { file_system_->UpdateFileByResourceId(kResourceId, callback); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_OK, callback_helper_->last_error_); + EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); // Make sure that the number of files did not change (i.e. we updated an // existing file, rather than adding a new file. The number of files // increases if we don't handle the file update right). @@ -2455,7 +2455,7 @@ TEST_F(GDataFileSystemTest, UpdateFileByResourceId_NonexistentFile) { file_system_->UpdateFileByResourceId(kResourceId, callback); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GDATA_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); + EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); } TEST_F(GDataFileSystemTest, ContentSearch) { @@ -2606,14 +2606,14 @@ TEST_F(GDataFileSystemTest, OpenAndCloseFile) { const FilePath opened_file_path = callback_helper_->opened_file_path_; // Verify that the file was properly opened. - EXPECT_EQ(GDATA_FILE_OK, callback_helper_->last_error_); + EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); // Try to open the already opened file. file_system_->OpenFile(kFileInRoot, callback); message_loop_.Run(); // It must fail. - EXPECT_EQ(GDATA_FILE_ERROR_IN_USE, callback_helper_->last_error_); + EXPECT_EQ(DRIVE_FILE_ERROR_IN_USE, callback_helper_->last_error_); // Verify that the file contents match the expected contents. std::string cache_file_data; @@ -2621,7 +2621,7 @@ TEST_F(GDataFileSystemTest, OpenAndCloseFile) { EXPECT_EQ(kExpectedFileData, cache_file_data); // Verify that the cache state was changed as expected. - VerifyCacheStateAfterOpenFile(GDATA_FILE_OK, + VerifyCacheStateAfterOpenFile(DRIVE_FILE_OK, file_resource_id, file_md5, opened_file_path); @@ -2631,10 +2631,10 @@ TEST_F(GDataFileSystemTest, OpenAndCloseFile) { message_loop_.Run(); // Verify that the file was properly closed. - EXPECT_EQ(GDATA_FILE_OK, callback_helper_->last_error_); + EXPECT_EQ(DRIVE_FILE_OK, callback_helper_->last_error_); // Verify that the cache state was changed as expected. - VerifyCacheStateAfterCloseFile(GDATA_FILE_OK, + VerifyCacheStateAfterCloseFile(DRIVE_FILE_OK, file_resource_id, file_md5); @@ -2643,7 +2643,7 @@ TEST_F(GDataFileSystemTest, OpenAndCloseFile) { message_loop_.Run(); // It must fail. - EXPECT_EQ(GDATA_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); + EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, callback_helper_->last_error_); } } // namespace gdata diff --git a/chrome/browser/chromeos/gdata/gdata_protocol_handler.cc b/chrome/browser/chromeos/gdata/gdata_protocol_handler.cc index bb554aa..d0607a5 100644 --- a/chrome/browser/chromeos/gdata/gdata_protocol_handler.cc +++ b/chrome/browser/chromeos/gdata/gdata_protocol_handler.cc @@ -163,7 +163,7 @@ class GDataURLRequestJob : public net::URLRequestJob { // Helper callback for handling async responses from // GDataFileSystem::GetFileByResourceId(). - void OnGetFileByResourceId(GDataFileError error, + void OnGetFileByResourceId(DriveFileError error, const FilePath& local_file_path, const std::string& mime_type, DriveFileType file_type); @@ -174,7 +174,7 @@ class GDataURLRequestJob : public net::URLRequestJob { // Helper callback for GetEntryInfoByResourceId invoked by StartAsync. void OnGetEntryInfoByResourceId(const std::string& resource_id, - GDataFileError error, + DriveFileError error, const FilePath& gdata_file_path, scoped_ptr<DriveEntryProto> entry_proto); @@ -508,13 +508,13 @@ void GDataURLRequestJob::StartAsync(GDataFileSystemInterface** file_system) { void GDataURLRequestJob::OnGetEntryInfoByResourceId( const std::string& resource_id, - GDataFileError error, + DriveFileError error, const FilePath& gdata_file_path, scoped_ptr<DriveEntryProto> entry_proto) { if (entry_proto.get() && !entry_proto->has_file_specific_info()) - error = GDATA_FILE_ERROR_NOT_FOUND; + error = DRIVE_FILE_ERROR_NOT_FOUND; - if (error == GDATA_FILE_OK) { + if (error == DRIVE_FILE_OK) { DCHECK(entry_proto.get()); mime_type_ = entry_proto->file_specific_info().content_mime_type(); gdata_file_path_ = gdata_file_path; @@ -654,14 +654,14 @@ bool GDataURLRequestJob::ReadFromDownloadData() { } void GDataURLRequestJob::OnGetFileByResourceId( - GDataFileError error, + DriveFileError error, const FilePath& local_file_path, const std::string& mime_type, DriveFileType file_type) { DVLOG(1) << "Got OnGetFileByResourceId"; DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - if (error != GDATA_FILE_OK || file_type != REGULAR_FILE) { + if (error != DRIVE_FILE_OK || file_type != REGULAR_FILE) { LOG(WARNING) << "Failed to start request: can't get file for resource id"; NotifyStartError(net::URLRequestStatus(net::URLRequestStatus::FAILED, net::ERR_FILE_NOT_FOUND)); diff --git a/chrome/browser/chromeos/gdata/gdata_sync_client.cc b/chrome/browser/chromeos/gdata/gdata_sync_client.cc index 11a336d..0b5bf3d 100644 --- a/chrome/browser/chromeos/gdata/gdata_sync_client.cc +++ b/chrome/browser/chromeos/gdata/gdata_sync_client.cc @@ -321,15 +321,15 @@ void GDataSyncClient::OnGetResourceIdsOfExistingPinnedFiles( void GDataSyncClient::OnGetEntryInfoByResourceId( const std::string& resource_id, - GDataFileError error, + DriveFileError error, const FilePath& /* gdata_file_path */, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (entry_proto.get() && !entry_proto->has_file_specific_info()) - error = GDATA_FILE_ERROR_NOT_FOUND; + error = DRIVE_FILE_ERROR_NOT_FOUND; - if (error != GDATA_FILE_OK) { + if (error != DRIVE_FILE_OK) { LOG(WARNING) << "Entry not found: " << resource_id; return; } @@ -366,12 +366,12 @@ void GDataSyncClient::OnGetCacheEntry( } } -void GDataSyncClient::OnRemove(GDataFileError error, +void GDataSyncClient::OnRemove(DriveFileError error, const std::string& resource_id, const std::string& md5) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (error != GDATA_FILE_OK) { + if (error != DRIVE_FILE_OK) { LOG(WARNING) << "Failed to remove cache entry: " << resource_id; return; } @@ -384,12 +384,12 @@ void GDataSyncClient::OnRemove(GDataFileError error, weak_ptr_factory_.GetWeakPtr())); } -void GDataSyncClient::OnPinned(GDataFileError error, +void GDataSyncClient::OnPinned(DriveFileError error, const std::string& resource_id, const std::string& /* md5 */) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (error != GDATA_FILE_OK) { + if (error != DRIVE_FILE_OK) { LOG(WARNING) << "Failed to pin cache entry: " << resource_id; return; } @@ -400,18 +400,18 @@ void GDataSyncClient::OnPinned(GDataFileError error, } void GDataSyncClient::OnFetchFileComplete(const SyncTask& sync_task, - GDataFileError error, + DriveFileError error, const FilePath& local_path, const std::string& ununsed_mime_type, DriveFileType file_type) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (error == GDATA_FILE_OK) { + if (error == DRIVE_FILE_OK) { DVLOG(1) << "Fetched " << sync_task.resource_id << ": " << local_path.value(); } else { switch (error) { - case GDATA_FILE_ERROR_NO_CONNECTION: + case DRIVE_FILE_ERROR_NO_CONNECTION: // Re-queue the task so that we'll retry once the connection is back. queue_.push_front(sync_task); break; @@ -426,10 +426,10 @@ void GDataSyncClient::OnFetchFileComplete(const SyncTask& sync_task, } void GDataSyncClient::OnUploadFileComplete(const std::string& resource_id, - GDataFileError error) { + DriveFileError error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (error == GDATA_FILE_OK) { + if (error == DRIVE_FILE_OK) { DVLOG(1) << "Uploaded " << resource_id; } else { // TODO(satorux): We should re-queue if the error is recoverable. diff --git a/chrome/browser/chromeos/gdata/gdata_sync_client.h b/chrome/browser/chromeos/gdata/gdata_sync_client.h index 3d540df..64d4e03 100644 --- a/chrome/browser/chromeos/gdata/gdata_sync_client.h +++ b/chrome/browser/chromeos/gdata/gdata_sync_client.h @@ -141,7 +141,7 @@ class GDataSyncClient : public GDataFileSystemInterface::Observer, // Called when a file entry is obtained. void OnGetEntryInfoByResourceId(const std::string& resource_id, - GDataFileError error, + DriveFileError error, const FilePath& file_path, scoped_ptr<DriveEntryProto> entry_proto); @@ -152,19 +152,19 @@ class GDataSyncClient : public GDataFileSystemInterface::Observer, const DriveCacheEntry& cache_entry); // Called when an existing cache entry and the local files are removed. - void OnRemove(GDataFileError error, + void OnRemove(DriveFileError error, const std::string& resource_id, const std::string& md5); // Called when a file is pinned. - void OnPinned(GDataFileError error, + void OnPinned(DriveFileError error, const std::string& resource_id, const std::string& md5); // Called when the file for |resource_id| is fetched. // Calls DoSyncLoop() to go back to the sync loop. void OnFetchFileComplete(const SyncTask& sync_task, - GDataFileError error, + DriveFileError error, const FilePath& local_path, const std::string& ununsed_mime_type, DriveFileType file_type); @@ -172,7 +172,7 @@ class GDataSyncClient : public GDataFileSystemInterface::Observer, // Called when the file for |resource_id| is uploaded. // Calls DoSyncLoop() to go back to the sync loop. void OnUploadFileComplete(const std::string& resource_id, - GDataFileError error); + DriveFileError error); // chromeos::NetworkLibrary::NetworkManagerObserver override. virtual void OnNetworkManagerChanged( diff --git a/chrome/browser/chromeos/gdata/gdata_sync_client_unittest.cc b/chrome/browser/chromeos/gdata/gdata_sync_client_unittest.cc index 4d72339..7fafe99 100644 --- a/chrome/browser/chromeos/gdata/gdata_sync_client_unittest.cc +++ b/chrome/browser/chromeos/gdata/gdata_sync_client_unittest.cc @@ -223,7 +223,7 @@ class GDataSyncClientTest : public testing::Test { EXPECT_CALL(*mock_file_system_, GetFileByResourceId(resource_id, _, _)) .WillOnce(MockGetFileByResourceId( - GDATA_FILE_OK, + DRIVE_FILE_OK, FilePath::FromUTF8Unsafe("local_path_does_not_matter"), std::string("mime_type_does_not_matter"), REGULAR_FILE)); @@ -235,7 +235,7 @@ class GDataSyncClientTest : public testing::Test { const std::string& resource_id) { EXPECT_CALL(*mock_file_system_, UpdateFileByResourceId(resource_id, _)) - .WillOnce(MockUpdateFileByResourceId(GDATA_FILE_OK)); + .WillOnce(MockUpdateFileByResourceId(DRIVE_FILE_OK)); } // Sets the expectation for MockGDataFileSystem::GetFileInfoByResourceId(), @@ -250,7 +250,7 @@ class GDataSyncClientTest : public testing::Test { EXPECT_CALL(*mock_file_system_, GetEntryInfoByResourceId(resource_id, _)) .WillOnce(MockUpdateFileByResourceId( - GDATA_FILE_OK, + DRIVE_FILE_OK, new_md5)); } @@ -368,7 +368,7 @@ TEST_F(GDataSyncClientTest, StartSyncLoop_ResumedConnection) { EXPECT_CALL(*mock_file_system_, GetFileByResourceId(resource_id, _, _)) .WillOnce(DoAll( InvokeWithoutArgs(this, &GDataSyncClientTest::ConnectToNone), - MockGetFileByResourceId(GDATA_FILE_ERROR_NO_CONNECTION, + MockGetFileByResourceId(DRIVE_FILE_ERROR_NO_CONNECTION, file_path, mime_type, REGULAR_FILE))); @@ -378,7 +378,7 @@ TEST_F(GDataSyncClientTest, StartSyncLoop_ResumedConnection) { // Expect fetch retry on network reconnection. EXPECT_CALL(*mock_file_system_, GetFileByResourceId(resource_id, _, _)) .WillOnce(MockGetFileByResourceId( - GDATA_FILE_OK, file_path, mime_type, REGULAR_FILE)); + DRIVE_FILE_OK, file_path, mime_type, REGULAR_FILE)); ConnectToWifi(); } diff --git a/chrome/browser/chromeos/gdata/gdata_system_service.cc b/chrome/browser/chromeos/gdata/gdata_system_service.cc index ac0049b..f08c698 100644 --- a/chrome/browser/chromeos/gdata/gdata_system_service.cc +++ b/chrome/browser/chromeos/gdata/gdata_system_service.cc @@ -122,14 +122,14 @@ void GDataSystemService::ClearCacheAndRemountFileSystem( void GDataSystemService::AddBackDriveMountPoint( const base::Callback<void(bool)>& callback, - GDataFileError error, + DriveFileError error, const FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); AddDriveMountPoint(); if (!callback.is_null()) - callback.Run(error == GDATA_FILE_OK); + callback.Run(error == DRIVE_FILE_OK); } void GDataSystemService::AddDriveMountPoint() { diff --git a/chrome/browser/chromeos/gdata/gdata_system_service.h b/chrome/browser/chromeos/gdata/gdata_system_service.h index c765b08..a2d21b2 100644 --- a/chrome/browser/chromeos/gdata/gdata_system_service.h +++ b/chrome/browser/chromeos/gdata/gdata_system_service.h @@ -69,7 +69,7 @@ class GDataSystemService : public ProfileKeyedService { // Adds back the drive mount point. Used to implement ClearCache(). void AddBackDriveMountPoint(const base::Callback<void(bool)>& callback, - GDataFileError error, + DriveFileError error, const FilePath& file_path); friend class GDataSystemServiceFactory; diff --git a/chrome/browser/chromeos/gdata/gdata_test_util.cc b/chrome/browser/chromeos/gdata/gdata_test_util.cc index 9afab20..4aa8719 100644 --- a/chrome/browser/chromeos/gdata/gdata_test_util.cc +++ b/chrome/browser/chromeos/gdata/gdata_test_util.cc @@ -63,16 +63,16 @@ bool CacheStatesEqual(const DriveCacheEntry& a, const DriveCacheEntry& b) { a.is_persistent() == b.is_persistent()); } -void CopyErrorCodeFromFileOperationCallback(GDataFileError* output, - GDataFileError error) { +void CopyErrorCodeFromFileOperationCallback(DriveFileError* output, + DriveFileError error) { DCHECK(output); *output = error; } void CopyResultsFromFileMoveCallback( - GDataFileError* out_error, + DriveFileError* out_error, FilePath* out_file_path, - GDataFileError error, + DriveFileError error, const FilePath& moved_file_path) { DCHECK(out_error); DCHECK(out_file_path); @@ -82,9 +82,9 @@ void CopyResultsFromFileMoveCallback( } void CopyResultsFromGetEntryInfoCallback( - GDataFileError* out_error, + DriveFileError* out_error, scoped_ptr<DriveEntryProto>* out_entry_proto, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(out_error); DCHECK(out_entry_proto); @@ -94,9 +94,9 @@ void CopyResultsFromGetEntryInfoCallback( } void CopyResultsFromReadDirectoryCallback( - GDataFileError* out_error, + DriveFileError* out_error, scoped_ptr<DriveEntryProtoVector>* out_entries, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProtoVector> entries) { DCHECK(out_error); DCHECK(out_entries); @@ -106,10 +106,10 @@ void CopyResultsFromReadDirectoryCallback( } void CopyResultsFromGetEntryInfoWithFilePathCallback( - GDataFileError* out_error, + DriveFileError* out_error, FilePath* out_drive_file_path, scoped_ptr<DriveEntryProto>* out_entry_proto, - GDataFileError error, + DriveFileError error, const FilePath& drive_file_path, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(out_error); diff --git a/chrome/browser/chromeos/gdata/gdata_test_util.h b/chrome/browser/chromeos/gdata/gdata_test_util.h index 93ce206..01ad8d4 100644 --- a/chrome/browser/chromeos/gdata/gdata_test_util.h +++ b/chrome/browser/chromeos/gdata/gdata_test_util.h @@ -48,32 +48,32 @@ bool CacheStatesEqual(const DriveCacheEntry& a, const DriveCacheEntry& b); // Copies |error| to |output|. Used to run asynchronous functions that take // FileOperationCallback from tests. -void CopyErrorCodeFromFileOperationCallback(GDataFileError* output, - GDataFileError error); +void CopyErrorCodeFromFileOperationCallback(DriveFileError* output, + DriveFileError error); // Copies |error| and |moved_file_path| to |out_error| and |out_file_path|. // Used to run asynchronous functions that take FileMoveCallback from tests. -void CopyResultsFromFileMoveCallback(GDataFileError* out_error, +void CopyResultsFromFileMoveCallback(DriveFileError* out_error, FilePath* out_file_path, - GDataFileError error, + DriveFileError error, const FilePath& moved_file_path); // Copies |error| and |entry_proto| to |out_error| and |out_entry_proto| // respectively. Used to run asynchronous functions that take // GetEntryInfoCallback from tests. void CopyResultsFromGetEntryInfoCallback( - GDataFileError* out_error, + DriveFileError* out_error, scoped_ptr<DriveEntryProto>* out_entry_proto, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto); // Copies |error| and |entries| to |out_error| and |out_entries| // respectively. Used to run asynchronous functions that take // GetEntryInfoCallback from tests. void CopyResultsFromReadDirectoryCallback( - GDataFileError* out_error, + DriveFileError* out_error, scoped_ptr<DriveEntryProtoVector>* out_entries, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProtoVector> entries); // Copies |error|, |drive_file_path|, and |entry_proto| to |out_error|, @@ -81,10 +81,10 @@ void CopyResultsFromReadDirectoryCallback( // asynchronous functions that take GetEntryInfoWithFilePathCallback from // tests. void CopyResultsFromGetEntryInfoWithFilePathCallback( - GDataFileError* out_error, + DriveFileError* out_error, FilePath* out_drive_file_path, scoped_ptr<DriveEntryProto>* out_entry_proto, - GDataFileError error, + DriveFileError error, const FilePath& drive_file_path, scoped_ptr<DriveEntryProto> entry_proto); diff --git a/chrome/browser/chromeos/gdata/gdata_upload_file_info.h b/chrome/browser/chromeos/gdata/gdata_upload_file_info.h index 80ce306..3eb38c0 100644 --- a/chrome/browser/chromeos/gdata/gdata_upload_file_info.h +++ b/chrome/browser/chromeos/gdata/gdata_upload_file_info.h @@ -88,7 +88,7 @@ struct UploadFileInfo { scoped_ptr<DocumentEntry> entry; // Callback to be invoked once the upload has completed. - typedef base::Callback<void(GDataFileError error, + typedef base::Callback<void(DriveFileError error, scoped_ptr<UploadFileInfo> upload_file_info)> UploadCompletionCallback; UploadCompletionCallback completion_callback; }; diff --git a/chrome/browser/chromeos/gdata/gdata_uploader.cc b/chrome/browser/chromeos/gdata/gdata_uploader.cc index 1f03fba..32212d0 100644 --- a/chrome/browser/chromeos/gdata/gdata_uploader.cc +++ b/chrome/browser/chromeos/gdata/gdata_uploader.cc @@ -249,7 +249,7 @@ void GDataUploader::OpenCompletionCallback(int upload_id, int result) { } if (!upload_file_info->should_retry_file_open) { UploadFailed(scoped_ptr<UploadFileInfo>(upload_file_info), - GDATA_FILE_ERROR_NOT_FOUND); + DRIVE_FILE_ERROR_NOT_FOUND); } return; } @@ -258,7 +258,7 @@ void GDataUploader::OpenCompletionCallback(int upload_id, int result) { upload_file_info->should_retry_file_open = false; if (upload_file_info->initial_upload_location.is_empty()) { UploadFailed(scoped_ptr<UploadFileInfo>(upload_file_info), - GDATA_FILE_ERROR_ABORT); + DRIVE_FILE_ERROR_ABORT); return; } drive_service_->InitiateUpload( @@ -289,7 +289,7 @@ void GDataUploader::OnUploadLocationReceived( if (code != HTTP_SUCCESS) { // TODO(achuith): Handle error codes from Google Docs server. UploadFailed(scoped_ptr<UploadFileInfo>(upload_file_info), - GDATA_FILE_ERROR_ABORT); + DRIVE_FILE_ERROR_ABORT); return; } @@ -425,7 +425,7 @@ void GDataUploader::OnResumeUploadResponseReceived( upload_file_info->entry = entry.Pass(); if (!upload_file_info->completion_callback.is_null()) { upload_file_info->completion_callback.Run( - GDATA_FILE_OK, + DRIVE_FILE_OK, scoped_ptr<UploadFileInfo>(upload_file_info)); } return; @@ -447,8 +447,8 @@ void GDataUploader::OnResumeUploadResponseReceived( UploadFailed( scoped_ptr<UploadFileInfo>(upload_file_info), response.code == HTTP_FORBIDDEN ? - GDATA_FILE_ERROR_NO_SPACE : - GDATA_FILE_ERROR_ABORT); + DRIVE_FILE_ERROR_NO_SPACE : + DRIVE_FILE_ERROR_ABORT); return; } @@ -461,7 +461,7 @@ void GDataUploader::OnResumeUploadResponseReceived( } void GDataUploader::UploadFailed(scoped_ptr<UploadFileInfo> upload_file_info, - GDataFileError error) { + DriveFileError error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); RemoveUpload(upload_file_info->upload_id); diff --git a/chrome/browser/chromeos/gdata/gdata_uploader.h b/chrome/browser/chromeos/gdata/gdata_uploader.h index 8f15b3a..f7e1d10 100644 --- a/chrome/browser/chromeos/gdata/gdata_uploader.h +++ b/chrome/browser/chromeos/gdata/gdata_uploader.h @@ -121,7 +121,7 @@ class GDataUploader : public GDataUploaderInterface { // Handle failed uploads. void UploadFailed(scoped_ptr<UploadFileInfo> upload_file_info, - GDataFileError error); + DriveFileError error); // Removes |upload_id| from UploadFileInfoMap |pending_uploads_|. // Note that this does not delete the UploadFileInfo object itself, diff --git a/chrome/browser/chromeos/gdata/gdata_util.cc b/chrome/browser/chromeos/gdata/gdata_util.cc index f1b1233..74c8954 100644 --- a/chrome/browser/chromeos/gdata/gdata_util.cc +++ b/chrome/browser/chromeos/gdata/gdata_util.cc @@ -113,13 +113,13 @@ void OpenEditURLUIThread(Profile* profile, const GURL* edit_url) { // Invoked upon completion of GetEntryInfoByResourceId initiated by // ModifyGDataFileResourceUrl. void OnGetEntryInfoByResourceId(Profile* profile, - const std::string& resource_id, - GDataFileError error, - const FilePath& /* gdata_file_path */, - scoped_ptr<DriveEntryProto> entry_proto) { + const std::string& resource_id, + DriveFileError error, + const FilePath& /* gdata_file_path */, + scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (error != GDATA_FILE_OK) + if (error != DRIVE_FILE_OK) return; DCHECK(entry_proto.get()); @@ -135,17 +135,17 @@ void OnGetEntryInfoForInsertDriveCachePathsPermissions( Profile* profile, std::vector<std::pair<FilePath, int> >* cache_paths, const base::Closure& callback, - GDataFileError error, + DriveFileError error, scoped_ptr<DriveEntryProto> entry_proto) { DCHECK(profile); DCHECK(cache_paths); DCHECK(!callback.is_null()); if (entry_proto.get() && !entry_proto->has_file_specific_info()) - error = GDATA_FILE_ERROR_NOT_FOUND; + error = DRIVE_FILE_ERROR_NOT_FOUND; DriveCache* cache = GetDriveCache(profile); - if (!cache || error != GDATA_FILE_OK) { + if (!cache || error != DRIVE_FILE_OK) { callback.Run(); return; } @@ -418,58 +418,58 @@ bool IsDriveV2ApiEnabled() { return enabled; } -base::PlatformFileError GDataFileErrorToPlatformError( - gdata::GDataFileError error) { +base::PlatformFileError DriveFileErrorToPlatformError( + gdata::DriveFileError error) { switch (error) { - case gdata::GDATA_FILE_OK: + case gdata::DRIVE_FILE_OK: return base::PLATFORM_FILE_OK; - case gdata::GDATA_FILE_ERROR_FAILED: + case gdata::DRIVE_FILE_ERROR_FAILED: return base::PLATFORM_FILE_ERROR_FAILED; - case gdata::GDATA_FILE_ERROR_IN_USE: + case gdata::DRIVE_FILE_ERROR_IN_USE: return base::PLATFORM_FILE_ERROR_IN_USE; - case gdata::GDATA_FILE_ERROR_EXISTS: + case gdata::DRIVE_FILE_ERROR_EXISTS: return base::PLATFORM_FILE_ERROR_EXISTS; - case gdata::GDATA_FILE_ERROR_NOT_FOUND: + case gdata::DRIVE_FILE_ERROR_NOT_FOUND: return base::PLATFORM_FILE_ERROR_NOT_FOUND; - case gdata::GDATA_FILE_ERROR_ACCESS_DENIED: + case gdata::DRIVE_FILE_ERROR_ACCESS_DENIED: return base::PLATFORM_FILE_ERROR_ACCESS_DENIED; - case gdata::GDATA_FILE_ERROR_TOO_MANY_OPENED: + case gdata::DRIVE_FILE_ERROR_TOO_MANY_OPENED: return base::PLATFORM_FILE_ERROR_TOO_MANY_OPENED; - case gdata::GDATA_FILE_ERROR_NO_MEMORY: + case gdata::DRIVE_FILE_ERROR_NO_MEMORY: return base::PLATFORM_FILE_ERROR_NO_MEMORY; - case gdata::GDATA_FILE_ERROR_NO_SPACE: + case gdata::DRIVE_FILE_ERROR_NO_SPACE: return base::PLATFORM_FILE_ERROR_NO_SPACE; - case gdata::GDATA_FILE_ERROR_NOT_A_DIRECTORY: + case gdata::DRIVE_FILE_ERROR_NOT_A_DIRECTORY: return base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY; - case gdata::GDATA_FILE_ERROR_INVALID_OPERATION: + case gdata::DRIVE_FILE_ERROR_INVALID_OPERATION: return base::PLATFORM_FILE_ERROR_INVALID_OPERATION; - case gdata::GDATA_FILE_ERROR_SECURITY: + case gdata::DRIVE_FILE_ERROR_SECURITY: return base::PLATFORM_FILE_ERROR_SECURITY; - case gdata::GDATA_FILE_ERROR_ABORT: + case gdata::DRIVE_FILE_ERROR_ABORT: return base::PLATFORM_FILE_ERROR_ABORT; - case gdata::GDATA_FILE_ERROR_NOT_A_FILE: + case gdata::DRIVE_FILE_ERROR_NOT_A_FILE: return base::PLATFORM_FILE_ERROR_NOT_A_FILE; - case gdata::GDATA_FILE_ERROR_NOT_EMPTY: + case gdata::DRIVE_FILE_ERROR_NOT_EMPTY: return base::PLATFORM_FILE_ERROR_NOT_EMPTY; - case gdata::GDATA_FILE_ERROR_INVALID_URL: + case gdata::DRIVE_FILE_ERROR_INVALID_URL: return base::PLATFORM_FILE_ERROR_INVALID_URL; - case gdata::GDATA_FILE_ERROR_NO_CONNECTION: + case gdata::DRIVE_FILE_ERROR_NO_CONNECTION: return base::PLATFORM_FILE_ERROR_FAILED; } @@ -610,28 +610,28 @@ void PrepareWritableFileAndRun(Profile* profile, } else { if (!callback.is_null()) { content::BrowserThread::GetBlockingPool()->PostTask( - FROM_HERE, base::Bind(callback, GDATA_FILE_OK, path)); + FROM_HERE, base::Bind(callback, DRIVE_FILE_OK, path)); } } } -GDataFileError GDataToGDataFileError(GDataErrorCode status) { +DriveFileError GDataToDriveFileError(GDataErrorCode status) { switch (status) { case HTTP_SUCCESS: case HTTP_CREATED: - return GDATA_FILE_OK; + return DRIVE_FILE_OK; case HTTP_UNAUTHORIZED: case HTTP_FORBIDDEN: - return GDATA_FILE_ERROR_ACCESS_DENIED; + return DRIVE_FILE_ERROR_ACCESS_DENIED; case HTTP_NOT_FOUND: - return GDATA_FILE_ERROR_NOT_FOUND; + return DRIVE_FILE_ERROR_NOT_FOUND; case GDATA_PARSE_ERROR: case GDATA_FILE_ERROR: - return GDATA_FILE_ERROR_ABORT; + return DRIVE_FILE_ERROR_ABORT; case GDATA_NO_CONNECTION: - return GDATA_FILE_ERROR_NO_CONNECTION; + return DRIVE_FILE_ERROR_NO_CONNECTION; default: - return GDATA_FILE_ERROR_FAILED; + return DRIVE_FILE_ERROR_FAILED; } } diff --git a/chrome/browser/chromeos/gdata/gdata_util.h b/chrome/browser/chromeos/gdata/gdata_util.h index 43cd146..95687da 100644 --- a/chrome/browser/chromeos/gdata/gdata_util.h +++ b/chrome/browser/chromeos/gdata/gdata_util.h @@ -108,8 +108,8 @@ void ParseCacheFilePath(const FilePath& path, // Returns true if Drive v2 API is enabled via commandline switch. bool IsDriveV2ApiEnabled(); -// Returns a PlatformFileError that corresponds to the GDataFileError provided. -base::PlatformFileError GDataFileErrorToPlatformError(GDataFileError error); +// Returns a PlatformFileError that corresponds to the DriveFileError provided. +base::PlatformFileError DriveFileErrorToPlatformError(DriveFileError error); // Parses an RFC 3339 date/time into a base::Time, returning true on success. // The time string must be in the format "yyyy-mm-ddThh:mm:ss.dddTZ" (TZ is @@ -122,7 +122,7 @@ std::string FormatTimeAsString(const base::Time& time); std::string FormatTimeAsStringLocaltime(const base::Time& time); // Callback type for PrepareWritableFilePathAndRun. -typedef base::Callback<void (GDataFileError, const FilePath& path)> +typedef base::Callback<void (DriveFileError, const FilePath& path)> OpenFileCallback; // Invokes |callback| on blocking thread pool, after converting virtual |path| @@ -137,8 +137,8 @@ void PrepareWritableFileAndRun(Profile* profile, const FilePath& path, const OpenFileCallback& callback); -// Converts gdata error code into file platform error code. -GDataFileError GDataToGDataFileError(GDataErrorCode status); +// Converts GData error code into file platform error code. +DriveFileError GDataToDriveFileError(GDataErrorCode status); // Wrapper around BrowserThread::PostTask to post a task to the blocking // pool with the given sequence token. diff --git a/chrome/browser/chromeos/gdata/gdata_wapi_feed_loader.cc b/chrome/browser/chromeos/gdata/gdata_wapi_feed_loader.cc index b6f51af..bce9bff 100644 --- a/chrome/browser/chromeos/gdata/gdata_wapi_feed_loader.cc +++ b/chrome/browser/chromeos/gdata/gdata_wapi_feed_loader.cc @@ -67,16 +67,16 @@ void LoadProtoOnBlockingPool(const FilePath& path, LoadRootFeedParams* params) { base::PlatformFileInfo info; if (!file_util::GetFileInfo(path, &info)) { - params->load_error = GDATA_FILE_ERROR_NOT_FOUND; + params->load_error = DRIVE_FILE_ERROR_NOT_FOUND; return; } params->last_modified = info.last_modified; if (!file_util::ReadFileToString(path, ¶ms->proto)) { LOG(WARNING) << "Proto file not found at " << path.value(); - params->load_error = GDATA_FILE_ERROR_NOT_FOUND; + params->load_error = DRIVE_FILE_ERROR_NOT_FOUND; return; } - params->load_error = GDATA_FILE_OK; + params->load_error = DRIVE_FILE_OK; } // Saves json file content content in |feed| to |file_pathname| on blocking @@ -165,7 +165,7 @@ LoadRootFeedParams::LoadRootFeedParams( bool should_load_from_server, const FileOperationCallback& callback) : should_load_from_server(should_load_from_server), - load_error(GDATA_FILE_OK), + load_error(DRIVE_FILE_OK), load_start_time(base::Time::Now()), callback(callback) { } @@ -312,8 +312,8 @@ void GDataWapiFeedLoader::OnGetAccountMetadata( params.start_changestamp = local_changestamp + 1; params.load_finished_callback = callback; - GDataFileError error = util::GDataToGDataFileError(status); - if (error != GDATA_FILE_OK) { + DriveFileError error = util::GDataToDriveFileError(status); + if (error != DRIVE_FILE_OK) { // Get changes starting from the next changestamp from what we have locally. LoadFromServer(params); return; @@ -360,7 +360,7 @@ void GDataWapiFeedLoader::OnGetAccountMetadata( // No changes detected, tell the client that the loading was successful. if (!changes_detected) { if (!callback.is_null()) - callback.Run(GDATA_FILE_OK); + callback.Run(DRIVE_FILE_OK); return; } @@ -383,8 +383,8 @@ void GDataWapiFeedLoader::OnGetAboutResource( weak_ptr_factory_.GetWeakPtr())); params.load_finished_callback = callback; - GDataFileError error = util::GDataToGDataFileError(status); - if (error != GDATA_FILE_OK) { + DriveFileError error = util::GDataToDriveFileError(status); + if (error != DRIVE_FILE_OK) { // Get changes starting from the next changestamp from what we have locally. LoadFromServer(params); return; @@ -420,7 +420,7 @@ void GDataWapiFeedLoader::OnGetAboutResource( // No changes detected, tell the client that the loading was successful. if (!changes_detected) { if (!callback.is_null()) - callback.Run(GDATA_FILE_OK); + callback.Run(DRIVE_FILE_OK); return; } @@ -435,8 +435,8 @@ void GDataWapiFeedLoader::OnGetApplicationList( scoped_ptr<base::Value> json) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - GDataFileError error = util::GDataToGDataFileError(status); - if (error != GDATA_FILE_OK) + DriveFileError error = util::GDataToDriveFileError(status); + if (error != DRIVE_FILE_OK) return; if (json.get()) { @@ -520,10 +520,10 @@ void GDataWapiFeedLoader::SearchFromServer( } void GDataWapiFeedLoader::OnFeedFromServerLoaded(GetDocumentsParams* params, - GDataFileError error) { + DriveFileError error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (error != GDATA_FILE_OK) { + if (error != DRIVE_FILE_OK) { if (!params->callback.is_null()) params->callback.Run(error); return; @@ -533,7 +533,7 @@ void GDataWapiFeedLoader::OnFeedFromServerLoaded(GetDocumentsParams* params, params->start_changestamp, params->root_feed_changestamp); - if (error != GDATA_FILE_OK) { + if (error != DRIVE_FILE_OK) { if (!params->callback.is_null()) params->callback.Run(error); @@ -545,7 +545,7 @@ void GDataWapiFeedLoader::OnFeedFromServerLoaded(GetDocumentsParams* params, // Tell the client that the loading was successful. if (!params->callback.is_null()) { - params->callback.Run(GDATA_FILE_OK); + params->callback.Run(DRIVE_FILE_OK); } FOR_EACH_OBSERVER(Observer, observers_, OnFeedFromServerLoaded()); @@ -566,13 +566,13 @@ void GDataWapiFeedLoader::OnGetDocuments( base::TimeTicks::Now() - start_time); } - GDataFileError error = util::GDataToGDataFileError(status); - if (error == GDATA_FILE_OK && + DriveFileError error = util::GDataToDriveFileError(status); + if (error == DRIVE_FILE_OK && (!data.get() || data->GetType() != Value::TYPE_DICTIONARY)) { - error = GDATA_FILE_ERROR_FAILED; + error = DRIVE_FILE_ERROR_FAILED; } - if (error != GDATA_FILE_OK) { + if (error != DRIVE_FILE_OK) { resource_metadata_->set_origin(initial_origin); callback.Run(params, error); return; @@ -581,7 +581,7 @@ void GDataWapiFeedLoader::OnGetDocuments( GURL next_feed_url; scoped_ptr<DocumentFeed> current_feed(DocumentFeed::ExtractAndParse(*data)); if (!current_feed.get()) { - callback.Run(params, GDATA_FILE_ERROR_FAILED); + callback.Run(params, DRIVE_FILE_ERROR_FAILED); return; } const bool has_next_feed_url = current_feed->GetNextFeedURL(&next_feed_url); @@ -679,13 +679,13 @@ void GDataWapiFeedLoader::OnGetChangelist( base::TimeTicks::Now() - start_time); } - GDataFileError error = util::GDataToGDataFileError(status); - if (error == GDATA_FILE_OK && + DriveFileError error = util::GDataToDriveFileError(status); + if (error == DRIVE_FILE_OK && (!data.get() || data->GetType() != Value::TYPE_DICTIONARY)) { - error = GDATA_FILE_ERROR_FAILED; + error = DRIVE_FILE_ERROR_FAILED; } - if (error != GDATA_FILE_OK) { + if (error != DRIVE_FILE_OK) { resource_metadata_->set_origin(initial_origin); callback.Run(params, error); return; @@ -694,7 +694,7 @@ void GDataWapiFeedLoader::OnGetChangelist( GURL next_feed_url; scoped_ptr<ChangeList> current_feed(ChangeList::CreateFrom(*data)); if (!current_feed.get()) { - callback.Run(params, GDATA_FILE_ERROR_FAILED); + callback.Run(params, DRIVE_FILE_ERROR_FAILED); return; } const bool has_next_feed = !current_feed->next_page_token().empty(); @@ -850,13 +850,13 @@ void GDataWapiFeedLoader::OnProtoLoaded(LoadRootFeedParams* params) { // Update directory structure only if everything is OK and we haven't yet // received the feed from the server yet. - if (params->load_error == GDATA_FILE_OK) { + if (params->load_error == DRIVE_FILE_OK) { DVLOG(1) << "ParseFromString"; if (resource_metadata_->ParseFromString(params->proto)) { resource_metadata_->set_last_serialized(params->last_modified); resource_metadata_->set_serialized_size(params->proto.size()); } else { - params->load_error = GDATA_FILE_ERROR_FAILED; + params->load_error = DRIVE_FILE_ERROR_FAILED; LOG(WARNING) << "Parse of cached proto file failed"; } } @@ -866,7 +866,7 @@ void GDataWapiFeedLoader::OnProtoLoaded(LoadRootFeedParams* params) { void GDataWapiFeedLoader::ContinueWithInitializedDirectoryService( LoadRootFeedParams* params, - GDataFileError error) { + DriveFileError error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DVLOG(1) << "Time elapsed to load directory service from disk=" @@ -877,8 +877,8 @@ void GDataWapiFeedLoader::ContinueWithInitializedDirectoryService( FileOperationCallback callback = params->callback; // If we got feed content from cache, tell the client that the loading was // successful. - if (error == GDATA_FILE_OK && !callback.is_null()) { - callback.Run(GDATA_FILE_OK); + if (error == DRIVE_FILE_OK && !callback.is_null()) { + callback.Run(DRIVE_FILE_OK); // Reset the callback so we don't run the same callback once // ReloadFeedFromServerIfNeeded() is complete. callback.Reset(); @@ -934,7 +934,7 @@ void GDataWapiFeedLoader::SaveFileSystem() { } } -GDataFileError GDataWapiFeedLoader::UpdateFromFeed( +DriveFileError GDataWapiFeedLoader::UpdateFromFeed( const std::vector<DocumentFeed*>& feed_list, int64 start_changestamp, int64 root_feed_changestamp) { @@ -944,7 +944,7 @@ GDataFileError GDataWapiFeedLoader::UpdateFromFeed( std::set<FilePath> changed_dirs; GDataWapiFeedProcessor feed_processor(resource_metadata_); - const GDataFileError error = feed_processor.ApplyFeeds( + const DriveFileError error = feed_processor.ApplyFeeds( feed_list, start_changestamp, root_feed_changestamp, diff --git a/chrome/browser/chromeos/gdata/gdata_wapi_feed_loader.h b/chrome/browser/chromeos/gdata/gdata_wapi_feed_loader.h index 3ae0ae2..e3ebb15 100644 --- a/chrome/browser/chromeos/gdata/gdata_wapi_feed_loader.h +++ b/chrome/browser/chromeos/gdata/gdata_wapi_feed_loader.h @@ -60,7 +60,7 @@ struct LoadRootFeedParams { bool should_load_from_server; std::string proto; - GDataFileError load_error; + DriveFileError load_error; base::Time last_modified; // Time when filesystem began to be loaded from disk. base::Time load_start_time; @@ -69,7 +69,7 @@ struct LoadRootFeedParams { // Callback run as a response to LoadFromServer. typedef base::Callback<void(GetDocumentsParams* params, - GDataFileError error)> + DriveFileError error)> LoadDocumentFeedCallback; // GDataWapiFeedLoader is used to load feeds from WAPI (codename for @@ -152,7 +152,7 @@ class GDataWapiFeedLoader { // // See comments at GDataWapiFeedProcessor::ApplyFeeds() for // |start_changestamp| and |root_feed_changestamp|. - GDataFileError UpdateFromFeed( + DriveFileError UpdateFromFeed( const std::vector<DocumentFeed*>& feed_list, int64 start_changestamp, int64 root_feed_changestamp); @@ -169,7 +169,7 @@ class GDataWapiFeedLoader { // Continues handling root directory refresh after the directory service // is fully loaded. void ContinueWithInitializedDirectoryService(LoadRootFeedParams* params, - GDataFileError error); + DriveFileError error); // Helper callback for handling results of metadata retrieval initiated from // ReloadFeedFromServerIfNeeded(). This method makes a decision about fetching @@ -204,7 +204,7 @@ class GDataWapiFeedLoader { // the content of the refreshed directory object and continue initially // started FindEntryByPath() request. void OnFeedFromServerLoaded(GetDocumentsParams* params, - GDataFileError error); + DriveFileError error); // Callback for handling response from |GDataWapiService::GetDocuments|. // Invokes |callback| when done. diff --git a/chrome/browser/chromeos/gdata/gdata_wapi_feed_processor.cc b/chrome/browser/chromeos/gdata/gdata_wapi_feed_processor.cc index 4d8ba8e..12a6b58 100644 --- a/chrome/browser/chromeos/gdata/gdata_wapi_feed_processor.cc +++ b/chrome/browser/chromeos/gdata/gdata_wapi_feed_processor.cc @@ -30,7 +30,7 @@ GDataWapiFeedProcessor::GDataWapiFeedProcessor( GDataWapiFeedProcessor::~GDataWapiFeedProcessor() { } -GDataFileError GDataWapiFeedProcessor::ApplyFeeds( +DriveFileError GDataWapiFeedProcessor::ApplyFeeds( const std::vector<DocumentFeed*>& feed_list, int64 start_changestamp, int64 root_feed_changestamp, @@ -42,11 +42,11 @@ GDataFileError GDataWapiFeedProcessor::ApplyFeeds( int64 delta_feed_changestamp = 0; FeedToFileResourceMapUmaStats uma_stats; FileResourceIdMap file_map; - GDataFileError error = FeedToFileResourceMap(feed_list, + DriveFileError error = FeedToFileResourceMap(feed_list, &file_map, &delta_feed_changestamp, &uma_stats); - if (error != GDATA_FILE_OK) + if (error != DRIVE_FILE_OK) return error; ApplyFeedFromFileUrlMap( @@ -59,7 +59,7 @@ GDataFileError GDataWapiFeedProcessor::ApplyFeeds( if (!is_delta_feed) UpdateFileCountUmaHistograms(uma_stats); - return GDATA_FILE_OK; + return DRIVE_FILE_OK; } void GDataWapiFeedProcessor::UpdateFileCountUmaHistograms( @@ -239,7 +239,7 @@ DriveDirectory* GDataWapiFeedProcessor::FindDirectoryForNewEntry( return dir; } -GDataFileError GDataWapiFeedProcessor::FeedToFileResourceMap( +DriveFileError GDataWapiFeedProcessor::FeedToFileResourceMap( const std::vector<DocumentFeed*>& feed_list, FileResourceIdMap* file_map, int64* feed_changestamp, @@ -247,7 +247,7 @@ GDataFileError GDataWapiFeedProcessor::FeedToFileResourceMap( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(uma_stats); - GDataFileError error = GDATA_FILE_OK; + DriveFileError error = DRIVE_FILE_OK; uma_stats->num_regular_files = 0; uma_stats->num_hosted_documents = 0; uma_stats->num_files_with_entry_kind.clear(); @@ -302,7 +302,7 @@ GDataFileError GDataWapiFeedProcessor::FeedToFileResourceMap( } } - if (error != GDATA_FILE_OK) { + if (error != DRIVE_FILE_OK) { // If the code above fails to parse a feed, any DriveEntry instance // added to |file_by_url| is not managed by a DriveDirectory instance, // so we need to explicitly release them here. diff --git a/chrome/browser/chromeos/gdata/gdata_wapi_feed_processor.h b/chrome/browser/chromeos/gdata/gdata_wapi_feed_processor.h index 3f9cf34..eed77a3 100644 --- a/chrome/browser/chromeos/gdata/gdata_wapi_feed_processor.h +++ b/chrome/browser/chromeos/gdata/gdata_wapi_feed_processor.h @@ -49,14 +49,14 @@ class GDataWapiFeedProcessor { // In the case of processing the root feeds |root_feed_changestamp| is used // as its initial changestamp value. The value comes from // AccountMetadataFeed. - GDataFileError ApplyFeeds(const std::vector<DocumentFeed*>& feed_list, + DriveFileError ApplyFeeds(const std::vector<DocumentFeed*>& feed_list, int64 start_changestamp, int64 root_feed_changestamp, std::set<FilePath>* changed_dirs); // Converts list of document feeds from collected feeds into // FileResourceIdMap. - GDataFileError FeedToFileResourceMap( + DriveFileError FeedToFileResourceMap( const std::vector<DocumentFeed*>& feed_list, FileResourceIdMap* file_map, int64* feed_changestamp, diff --git a/chrome/browser/chromeos/gdata/gdata_wapi_service.h b/chrome/browser/chromeos/gdata/gdata_wapi_service.h index 506a93b..585353c 100644 --- a/chrome/browser/chromeos/gdata/gdata_wapi_service.h +++ b/chrome/browser/chromeos/gdata/gdata_wapi_service.h @@ -12,7 +12,6 @@ #include "chrome/browser/chromeos/gdata/auth_service.h" #include "chrome/browser/chromeos/gdata/drive_service_interface.h" #include "chrome/browser/chromeos/gdata/gdata_operations.h" -#include "chrome/browser/chromeos/gdata/gdata_errorcode.h" class FilePath; class GURL; |