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

Unified Diff: chrome/browser/sync_file_system/remote_sync_operation_resolver.h

Issue 13986011: SyncFS: Introduce RemoteSyncOperationResolver for directory operation support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review 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
Index: chrome/browser/sync_file_system/remote_sync_operation_resolver.h
diff --git a/chrome/browser/sync_file_system/remote_sync_operation_resolver.h b/chrome/browser/sync_file_system/remote_sync_operation_resolver.h
new file mode 100644
index 0000000000000000000000000000000000000000..a1bd4e53081f966ff00a8a984858a21defb05ca3
--- /dev/null
+++ b/chrome/browser/sync_file_system/remote_sync_operation_resolver.h
@@ -0,0 +1,82 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_REMOTE_SYNC_OPERATION_RESOLVER_H_
+#define CHROME_BROWSER_SYNC_FILE_SYSTEM_REMOTE_SYNC_OPERATION_RESOLVER_H_
+
+#include "base/gtest_prod_util.h"
+#include "webkit/fileapi/syncable/file_change.h"
+#include "webkit/fileapi/syncable/sync_file_type.h"
+
+namespace sync_file_system {
+
+enum RemoteSyncOperationType {
+ REMOTE_SYNC_OPERATION_ADD_FILE,
+ REMOTE_SYNC_OPERATION_ADD_DIRECTORY,
+ REMOTE_SYNC_OPERATION_UPDATE_FILE,
+ REMOTE_SYNC_OPERATION_DELETE_FILE,
+ REMOTE_SYNC_OPERATION_DELETE_DIRECTORY,
+ REMOTE_SYNC_OPERATION_NONE,
+ REMOTE_SYNC_OPERATION_CONFLICT,
+ REMOTE_SYNC_OPERATION_RESOLVE_TO_LOCAL,
+ REMOTE_SYNC_OPERATION_RESOLVE_TO_REMOTE,
+ REMOTE_SYNC_OPERATION_DELETE_METADATA,
+ REMOTE_SYNC_OPERATION_FAIL,
+};
+
+class RemoteSyncOperationResolver {
+ public:
+ static RemoteSyncOperationType Resolve(
+ const FileChange& remote_file_change,
+ const FileChangeList& local_changes,
+ SyncFileType local_file_type,
+ bool is_conflicting);
+
+ private:
+ static RemoteSyncOperationType ResolveForAddOrUpdateFile(
+ const FileChangeList& local_changes,
+ SyncFileType local_file_type);
+ static RemoteSyncOperationType ResolveForAddOrUpdateFileInConflict(
+ const FileChangeList& local_changes,
+ SyncFileType local_file_type);
+ static RemoteSyncOperationType ResolveForAddDirectory(
+ const FileChangeList& local_changes,
+ SyncFileType local_file_type);
+ static RemoteSyncOperationType ResolveForAddDirectoryInConflict(
+ const FileChangeList& local_changes,
+ SyncFileType local_file_type);
+ static RemoteSyncOperationType ResolveForDeleteFile(
+ const FileChangeList& local_changes,
+ SyncFileType local_file_type);
+ static RemoteSyncOperationType ResolveForDeleteFileInConflict(
+ const FileChangeList& local_changes,
+ SyncFileType local_file_type);
+ static RemoteSyncOperationType ResolveForDeleteDirectory(
+ const FileChangeList& local_changes,
+ SyncFileType local_file_type);
+ static RemoteSyncOperationType ResolveForDeleteDirectoryInConflict(
+ const FileChangeList& local_changes,
+ SyncFileType local_file_type);
+
+ FRIEND_TEST_ALL_PREFIXES(RemoteSyncOperationResolverTest,
+ ResolveForAddOrUpdateFile);
+ FRIEND_TEST_ALL_PREFIXES(RemoteSyncOperationResolverTest,
+ ResolveForAddOrUpdateFileInConflict);
+ FRIEND_TEST_ALL_PREFIXES(RemoteSyncOperationResolverTest,
+ ResolveForAddDirectory);
+ FRIEND_TEST_ALL_PREFIXES(RemoteSyncOperationResolverTest,
+ ResolveForAddDirectoryInConflict);
+ FRIEND_TEST_ALL_PREFIXES(RemoteSyncOperationResolverTest,
+ ResolveForDeleteFile);
+ FRIEND_TEST_ALL_PREFIXES(RemoteSyncOperationResolverTest,
+ ResolveForDeleteFileInConflict);
+ FRIEND_TEST_ALL_PREFIXES(RemoteSyncOperationResolverTest,
+ ResolveForDeleteDirectory);
+ FRIEND_TEST_ALL_PREFIXES(RemoteSyncOperationResolverTest,
+ ResolveForDeleteDirectoryInConflict);
+};
+
+} // namespace sync_file_system
+
+#endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_REMOTE_SYNC_OPERATION_RESOLVER_H_

Powered by Google App Engine
This is Rietveld 408576698