| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_REMOTE_SYNC_OPERATION_RESOLVER_H_ |
| 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_REMOTE_SYNC_OPERATION_RESOLVER_H_ |
| 7 |
| 8 #include "base/gtest_prod_util.h" |
| 9 #include "webkit/fileapi/syncable/file_change.h" |
| 10 #include "webkit/fileapi/syncable/sync_file_type.h" |
| 11 |
| 12 namespace sync_file_system { |
| 13 |
| 14 enum RemoteSyncOperationType { |
| 15 REMOTE_SYNC_OPERATION_ADD_FILE, |
| 16 REMOTE_SYNC_OPERATION_ADD_DIRECTORY, |
| 17 REMOTE_SYNC_OPERATION_UPDATE_FILE, |
| 18 REMOTE_SYNC_OPERATION_DELETE_FILE, |
| 19 REMOTE_SYNC_OPERATION_DELETE_DIRECTORY, |
| 20 REMOTE_SYNC_OPERATION_NONE, |
| 21 REMOTE_SYNC_OPERATION_CONFLICT, |
| 22 REMOTE_SYNC_OPERATION_RESOLVE_TO_LOCAL, |
| 23 REMOTE_SYNC_OPERATION_RESOLVE_TO_REMOTE, |
| 24 REMOTE_SYNC_OPERATION_DELETE_METADATA, |
| 25 REMOTE_SYNC_OPERATION_FAIL, |
| 26 }; |
| 27 |
| 28 class RemoteSyncOperationResolver { |
| 29 public: |
| 30 static RemoteSyncOperationType Resolve( |
| 31 const FileChange& remote_file_change, |
| 32 const FileChangeList& local_changes, |
| 33 SyncFileType local_file_type, |
| 34 bool is_conflicting); |
| 35 |
| 36 private: |
| 37 static RemoteSyncOperationType ResolveForAddOrUpdateFile( |
| 38 const FileChangeList& local_changes, |
| 39 SyncFileType local_file_type); |
| 40 static RemoteSyncOperationType ResolveForAddOrUpdateFileInConflict( |
| 41 const FileChangeList& local_changes, |
| 42 SyncFileType local_file_type); |
| 43 static RemoteSyncOperationType ResolveForAddDirectory( |
| 44 const FileChangeList& local_changes, |
| 45 SyncFileType local_file_type); |
| 46 static RemoteSyncOperationType ResolveForAddDirectoryInConflict( |
| 47 const FileChangeList& local_changes, |
| 48 SyncFileType local_file_type); |
| 49 static RemoteSyncOperationType ResolveForDeleteFile( |
| 50 const FileChangeList& local_changes, |
| 51 SyncFileType local_file_type); |
| 52 static RemoteSyncOperationType ResolveForDeleteFileInConflict( |
| 53 const FileChangeList& local_changes, |
| 54 SyncFileType local_file_type); |
| 55 static RemoteSyncOperationType ResolveForDeleteDirectory( |
| 56 const FileChangeList& local_changes, |
| 57 SyncFileType local_file_type); |
| 58 static RemoteSyncOperationType ResolveForDeleteDirectoryInConflict( |
| 59 const FileChangeList& local_changes, |
| 60 SyncFileType local_file_type); |
| 61 |
| 62 FRIEND_TEST_ALL_PREFIXES(RemoteSyncOperationResolverTest, |
| 63 ResolveForAddOrUpdateFile); |
| 64 FRIEND_TEST_ALL_PREFIXES(RemoteSyncOperationResolverTest, |
| 65 ResolveForAddOrUpdateFileInConflict); |
| 66 FRIEND_TEST_ALL_PREFIXES(RemoteSyncOperationResolverTest, |
| 67 ResolveForAddDirectory); |
| 68 FRIEND_TEST_ALL_PREFIXES(RemoteSyncOperationResolverTest, |
| 69 ResolveForAddDirectoryInConflict); |
| 70 FRIEND_TEST_ALL_PREFIXES(RemoteSyncOperationResolverTest, |
| 71 ResolveForDeleteFile); |
| 72 FRIEND_TEST_ALL_PREFIXES(RemoteSyncOperationResolverTest, |
| 73 ResolveForDeleteFileInConflict); |
| 74 FRIEND_TEST_ALL_PREFIXES(RemoteSyncOperationResolverTest, |
| 75 ResolveForDeleteDirectory); |
| 76 FRIEND_TEST_ALL_PREFIXES(RemoteSyncOperationResolverTest, |
| 77 ResolveForDeleteDirectoryInConflict); |
| 78 }; |
| 79 |
| 80 } // namespace sync_file_system |
| 81 |
| 82 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_REMOTE_SYNC_OPERATION_RESOLVER_H_ |
| OLD | NEW |