1 // Copyright 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.
5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_REMOTE_SYNC_OPERATION_RESOLVER_H_
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_REMOTE_SYNC_OPERATION_RESOLVER_H_
8 #include "base/gtest_prod_util.h"
9 #include "chrome/browser/sync_file_system/sync_operation_type.h"
10 #include "webkit/browser/fileapi/syncable/file_change.h"
11 #include "webkit/browser/fileapi/syncable/sync_file_type.h"
13 namespace sync_file_system
{
15 class RemoteSyncOperationResolver
{
17 static SyncOperationType
Resolve(
18 const FileChange
& remote_file_change
,
19 const FileChangeList
& local_changes
,
20 SyncFileType local_file_type
,
24 static SyncOperationType
ResolveForAddOrUpdateFile(
25 const FileChangeList
& local_changes
,
26 SyncFileType local_file_type
);
27 static SyncOperationType
ResolveForAddOrUpdateFileInConflict(
28 const FileChangeList
& local_changes
,
29 SyncFileType local_file_type
);
30 static SyncOperationType
ResolveForAddDirectory(
31 const FileChangeList
& local_changes
,
32 SyncFileType local_file_type
);
33 static SyncOperationType
ResolveForAddDirectoryInConflict(
34 const FileChangeList
& local_changes
,
35 SyncFileType local_file_type
);
36 static SyncOperationType
ResolveForDeleteFile(
37 const FileChangeList
& local_changes
,
38 SyncFileType local_file_type
);
39 static SyncOperationType
ResolveForDeleteFileInConflict(
40 const FileChangeList
& local_changes
,
41 SyncFileType local_file_type
);
42 static SyncOperationType
ResolveForDeleteDirectory(
43 const FileChangeList
& local_changes
,
44 SyncFileType local_file_type
);
45 static SyncOperationType
ResolveForDeleteDirectoryInConflict(
46 const FileChangeList
& local_changes
,
47 SyncFileType local_file_type
);
49 FRIEND_TEST_ALL_PREFIXES(RemoteSyncOperationResolverTest
,
50 ResolveForAddOrUpdateFile
);
51 FRIEND_TEST_ALL_PREFIXES(RemoteSyncOperationResolverTest
,
52 ResolveForAddOrUpdateFileInConflict
);
53 FRIEND_TEST_ALL_PREFIXES(RemoteSyncOperationResolverTest
,
54 ResolveForAddDirectory
);
55 FRIEND_TEST_ALL_PREFIXES(RemoteSyncOperationResolverTest
,
56 ResolveForAddDirectoryInConflict
);
57 FRIEND_TEST_ALL_PREFIXES(RemoteSyncOperationResolverTest
,
58 ResolveForDeleteFile
);
59 FRIEND_TEST_ALL_PREFIXES(RemoteSyncOperationResolverTest
,
60 ResolveForDeleteFileInConflict
);
61 FRIEND_TEST_ALL_PREFIXES(RemoteSyncOperationResolverTest
,
62 ResolveForDeleteDirectory
);
63 FRIEND_TEST_ALL_PREFIXES(RemoteSyncOperationResolverTest
,
64 ResolveForDeleteDirectoryInConflict
);
67 } // namespace sync_file_system
69 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_REMOTE_SYNC_OPERATION_RESOLVER_H_