blob: 457e4b72c164b61ca18573d0679c15be57c72ba8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
// Copyright (c) 2012 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.
#include "sync/engine/resolve_conflicts_command.h"
#include "sync/engine/conflict_resolver.h"
#include "sync/sessions/session_state.h"
#include "sync/sessions/sync_session.h"
#include "sync/syncable/syncable.h"
namespace browser_sync {
ResolveConflictsCommand::ResolveConflictsCommand() {}
ResolveConflictsCommand::~ResolveConflictsCommand() {}
std::set<ModelSafeGroup> ResolveConflictsCommand::GetGroupsToChange(
const sessions::SyncSession& session) const {
return session.GetEnabledGroupsWithConflicts();
}
SyncerError ResolveConflictsCommand::ModelChangingExecuteImpl(
sessions::SyncSession* session) {
ConflictResolver* resolver = session->context()->resolver();
DCHECK(resolver);
syncable::Directory* dir = session->context()->directory();
sessions::StatusController* status = session->mutable_status_controller();
const sessions::ConflictProgress* progress = status->conflict_progress();
if (!progress)
return SYNCER_OK; // Nothing to do.
syncable::WriteTransaction trans(FROM_HERE, syncable::SYNCER, dir);
const Cryptographer* cryptographer = dir->GetCryptographer(&trans);
status->update_conflicts_resolved(
resolver->ResolveConflicts(&trans, cryptographer, *progress, status));
return SYNCER_OK;
}
} // namespace browser_sync
|