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. 4 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_CONFLICT_RESOLUTION_RESOLVER_H_ 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_CONFLICT_RESOLUTION_RESOLVER_H_ 7 8 #include "chrome/browser/sync_file_system/conflict_resolution_policy.h" 9 #include "chrome/browser/sync_file_system/sync_file_type.h" 10 11 namespace base { 12 class Time; 13 } 14 15 namespace sync_file_system { 16 17 enum ConflictResolution { 18 CONFLICT_RESOLUTION_UNKNOWN, 19 CONFLICT_RESOLUTION_MARK_CONFLICT, 20 CONFLICT_RESOLUTION_LOCAL_WIN, 21 CONFLICT_RESOLUTION_REMOTE_WIN, 22 }; 23 24 class ConflictResolutionResolver { 25 public: 26 explicit ConflictResolutionResolver(ConflictResolutionPolicy policy); 27 ~ConflictResolutionResolver(); 28 29 // Determine the ConflictResolution. 30 // This may return CONFLICT_RESOLUTION_UNKNOWN if NULL |remote_update_time| 31 // is given. 32 // It is invalid to give NULL |local_update_time|. 33 ConflictResolution Resolve( 34 SyncFileType local_file_type, 35 const base::Time& local_update_time, 36 SyncFileType remote_file_type, 37 const base::Time& remote_update_time); 38 39 ConflictResolutionPolicy policy() const { return policy_; } 40 void set_policy(ConflictResolutionPolicy policy) { policy_ = policy; } 41 42 private: 43 ConflictResolutionPolicy policy_; 44 }; 45 46 } // namespace sync_file_system 47 48 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_CONFLICT_RESOLUTION_RESOLVER_H_ 49