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

Unified Diff: chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.cc

Issue 77913002: [SyncFS] Implement non-conflict local folder addition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment fix Created 7 years, 1 month 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 | « no previous file | chrome/browser/sync_file_system/drive_backend/metadata_database.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.cc
diff --git a/chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.cc b/chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.cc
index 5cb56105a5bfdc34da6428f1379180c40d9c49b0..302bb42da7877812e674a6623f2d8e9d4200c898 100644
--- a/chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.cc
+++ b/chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.cc
@@ -167,13 +167,40 @@ void LocalToRemoteSyncer::HandleExistingRemoteFile(
DCHECK(local_change_.IsAddOrUpdate());
DCHECK(local_change_.file_type() == SYNC_FILE_TYPE_FILE ||
local_change_.file_type() == SYNC_FILE_TYPE_DIRECTORY);
+
+ const FileDetails& synced_details = remote_file_tracker_->synced_details();
+ DCHECK(synced_details.file_kind() == FILE_KIND_FILE ||
+ synced_details.file_kind() == FILE_KIND_FOLDER);
if (local_change_.file_type() == SYNC_FILE_TYPE_FILE) {
- UploadExistingFile(callback);
+ if (synced_details.file_kind() == FILE_KIND_FILE) {
+ // Non-conflicting local file update to existing remote regular file.
+ UploadExistingFile(callback);
+ return;
+ }
+
+ DCHECK_EQ(FILE_KIND_FOLDER, synced_details.file_kind());
+ // Non-conflicting local file update to existing remote *folder*.
+ // Our policy prioritize the folder on this case.
+ // Do nothing to remote folder and mark the tracker dirty to defer it to
+ // next remote-to-local sync phase.
+ metadata_database()->MarkTrackerDirty(remote_file_tracker_->tracker_id(),
+ callback);
return;
}
- NOTIMPLEMENTED();
- callback.Run(SYNC_STATUS_FAILED);
+ DCHECK_EQ(SYNC_FILE_TYPE_DIRECTORY, local_change_.file_type());
+ if (synced_details.file_kind() == FILE_KIND_FILE) {
+ // Non-conflicting local folder creation to existing remote *file*.
+ // Our policy prioritize the folder on this case.
+ // TODO(tzik): Delete remote file and create a folder at the path.
+ NOTIMPLEMENTED();
+ callback.Run(SYNC_STATUS_FAILED);
+ return;
+ }
+
+ // Non-conflicting local folder creation to existing remote folder.
+ DCHECK_EQ(FILE_KIND_FOLDER, synced_details.file_kind());
+ callback.Run(SYNC_STATUS_OK);
}
void LocalToRemoteSyncer::DidDeleteRemoteFile(
« no previous file with comments | « no previous file | chrome/browser/sync_file_system/drive_backend/metadata_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698