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