#ifndef SYNC_ENGINE_CONFLICT_RESOLVER_H_
#define SYNC_ENGINE_CONFLICT_RESOLVER_H_
#include <map>
#include <set>
#include <string>
#include "base/basictypes.h"
#include "base/gtest_prod_util.h"
#include "sync/engine/syncer_types.h"
namespace syncer {
namespace syncable {
class BaseTransaction;
class Id;
class MutableEntry;
class WriteTransaction;
}
class Cryptographer;
namespace sessions {
class ConflictProgress;
class StatusController;
}
class ConflictResolver {
friend class SyncerTest;
FRIEND_TEST_ALL_PREFIXES(SyncerTest,
ConflictResolverMergeOverwritesLocalEntry);
public:
enum SimpleConflictResolutions {
OVERWRITE_LOCAL,
OVERWRITE_SERVER,
UNDELETE,
IGNORE_ENCRYPTION,
NIGORI_MERGE,
CHANGES_MATCH,
CONFLICT_RESOLUTION_SIZE,
};
ConflictResolver();
~ConflictResolver();
bool ResolveConflicts(syncable::WriteTransaction* trans,
const Cryptographer* cryptographer,
const sessions::ConflictProgress& progress,
sessions::StatusController* status);
private:
enum ProcessSimpleConflictResult {
NO_SYNC_PROGRESS,
SYNC_PROGRESS,
};
ProcessSimpleConflictResult ProcessSimpleConflict(
syncable::WriteTransaction* trans,
const syncable::Id& id,
const Cryptographer* cryptographer,
sessions::StatusController* status);
bool ResolveSimpleConflicts(syncable::WriteTransaction* trans,
const Cryptographer* cryptographer,
const sessions::ConflictProgress& progress,
sessions::StatusController* status);
DISALLOW_COPY_AND_ASSIGN(ConflictResolver);
};
}
#endif