Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3609)

Unified Diff: chrome/browser/sync_file_system/drive_file_sync_service.cc

Issue 14701004: [Sync FileSystem] Implement directory supported RESOLVE_TO_LOCAL to LocalSync. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: naming fix Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sync_file_system/drive_file_sync_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync_file_system/drive_file_sync_service.cc
diff --git a/chrome/browser/sync_file_system/drive_file_sync_service.cc b/chrome/browser/sync_file_system/drive_file_sync_service.cc
index 9c3720ad870b4fd1ee965727f076b4e69c84f488..346aeb034ff9b945747e6ed9e8e0c7c5378ffb9f 100644
--- a/chrome/browser/sync_file_system/drive_file_sync_service.cc
+++ b/chrome/browser/sync_file_system/drive_file_sync_service.cc
@@ -1103,11 +1103,14 @@ void DriveFileSyncService::ApplyLocalChangeInternal(
HandleConflictForLocalSync(param.Pass());
return;
case LOCAL_SYNC_OPERATION_RESOLVE_TO_LOCAL:
- // TODO(nhiroki): support directory operations (http://crbug.com/161442).
- NOTREACHED();
- FinalizeLocalSync(param->token.Pass(),
- param->callback,
- SYNC_STATUS_FAILED);
+ sync_client_->DeleteFile(
+ drive_metadata.resource_id(),
+ drive_metadata.md5_checksum(),
+ base::Bind(
+ &DriveFileSyncService::DidDeleteForResolveToLocalForLocalSync,
+ AsWeakPtr(),
+ origin_resource_id, local_file_path, url,
+ base::Passed(&param)));
return;
case LOCAL_SYNC_OPERATION_RESOLVE_TO_REMOTE:
ResolveConflictToRemoteForLocalSync(param.Pass());
@@ -1128,6 +1131,32 @@ void DriveFileSyncService::ApplyLocalChangeInternal(
FinalizeLocalSync(param->token.Pass(), callback, SYNC_STATUS_FAILED);
}
+void DriveFileSyncService::DidDeleteForResolveToLocalForLocalSync(
+ const std::string& origin_resource_id,
+ const base::FilePath& local_file_path,
+ const fileapi::FileSystemURL& url,
+ scoped_ptr<ApplyLocalChangeParam> param,
+ google_apis::GDataErrorCode error) {
+ DCHECK_NE(SYNC_FILE_TYPE_UNKNOWN, param->local_metadata.file_type);
nhiroki 2013/05/02 03:32:01 What happen if delete operation failed?
tzik 2013/05/02 03:52:56 Done. Hmm, I thought it's ignorable since any sti
+ if (param->local_metadata.file_type == SYNC_FILE_TYPE_FILE) {
+ sync_client_->UploadNewFile(
+ origin_resource_id,
+ local_file_path,
+ PathToTitle(url.path()),
+ base::Bind(&DriveFileSyncService::DidUploadNewFileForLocalSync,
+ AsWeakPtr(), base::Passed(&param)));
+ return;
+ }
+
+ DCHECK(IsSyncDirectoryOperationEnabled());
+ DCHECK_EQ(SYNC_FILE_TYPE_FILE, param->local_metadata.file_type);
nhiroki 2013/05/02 03:32:01 Probably you'd meant to put SYNC_FILE_TYPE_DIRECTO
tzik 2013/05/02 03:52:56 Yes, I meant. Thanks! Done.
+ sync_client_->CreateDirectory(
+ origin_resource_id,
+ PathToTitle(url.path()),
+ base::Bind(&DriveFileSyncService::DidCreateDirectoryForLocalSync,
+ AsWeakPtr(), base::Passed(&param)));
+}
+
void DriveFileSyncService::DidApplyLocalChange(
scoped_ptr<ApplyLocalChangeParam> param,
const google_apis::GDataErrorCode error,
« no previous file with comments | « chrome/browser/sync_file_system/drive_file_sync_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698