| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "sync/engine/resolve_conflicts_command.h" | 5 #include "sync/engine/resolve_conflicts_command.h" |
| 6 | 6 |
| 7 #include "sync/engine/conflict_resolver.h" | 7 #include "sync/engine/conflict_resolver.h" |
| 8 #include "sync/sessions/session_state.h" | 8 #include "sync/sessions/session_state.h" |
| 9 #include "sync/sessions/sync_session.h" | 9 #include "sync/sessions/sync_session.h" |
| 10 #include "sync/syncable/directory.h" | 10 #include "sync/syncable/directory.h" |
| 11 #include "sync/syncable/write_transaction.h" | 11 #include "sync/syncable/write_transaction.h" |
| 12 | 12 |
| 13 namespace csync { | 13 namespace syncer { |
| 14 | 14 |
| 15 ResolveConflictsCommand::ResolveConflictsCommand() {} | 15 ResolveConflictsCommand::ResolveConflictsCommand() {} |
| 16 ResolveConflictsCommand::~ResolveConflictsCommand() {} | 16 ResolveConflictsCommand::~ResolveConflictsCommand() {} |
| 17 | 17 |
| 18 std::set<ModelSafeGroup> ResolveConflictsCommand::GetGroupsToChange( | 18 std::set<ModelSafeGroup> ResolveConflictsCommand::GetGroupsToChange( |
| 19 const sessions::SyncSession& session) const { | 19 const sessions::SyncSession& session) const { |
| 20 return session.GetEnabledGroupsWithConflicts(); | 20 return session.GetEnabledGroupsWithConflicts(); |
| 21 } | 21 } |
| 22 | 22 |
| 23 SyncerError ResolveConflictsCommand::ModelChangingExecuteImpl( | 23 SyncerError ResolveConflictsCommand::ModelChangingExecuteImpl( |
| 24 sessions::SyncSession* session) { | 24 sessions::SyncSession* session) { |
| 25 ConflictResolver* resolver = session->context()->resolver(); | 25 ConflictResolver* resolver = session->context()->resolver(); |
| 26 DCHECK(resolver); | 26 DCHECK(resolver); |
| 27 | 27 |
| 28 syncable::Directory* dir = session->context()->directory(); | 28 syncable::Directory* dir = session->context()->directory(); |
| 29 sessions::StatusController* status = session->mutable_status_controller(); | 29 sessions::StatusController* status = session->mutable_status_controller(); |
| 30 const sessions::ConflictProgress* progress = status->conflict_progress(); | 30 const sessions::ConflictProgress* progress = status->conflict_progress(); |
| 31 if (!progress) | 31 if (!progress) |
| 32 return SYNCER_OK; // Nothing to do. | 32 return SYNCER_OK; // Nothing to do. |
| 33 syncable::WriteTransaction trans(FROM_HERE, syncable::SYNCER, dir); | 33 syncable::WriteTransaction trans(FROM_HERE, syncable::SYNCER, dir); |
| 34 const Cryptographer* cryptographer = dir->GetCryptographer(&trans); | 34 const Cryptographer* cryptographer = dir->GetCryptographer(&trans); |
| 35 status->update_conflicts_resolved( | 35 status->update_conflicts_resolved( |
| 36 resolver->ResolveConflicts(&trans, cryptographer, *progress, status)); | 36 resolver->ResolveConflicts(&trans, cryptographer, *progress, status)); |
| 37 | 37 |
| 38 return SYNCER_OK; | 38 return SYNCER_OK; |
| 39 } | 39 } |
| 40 | 40 |
| 41 } // namespace csync | 41 } // namespace syncer |
| OLD | NEW |