1// Copyright 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#ifndef SYNC_ENGINE_PROCESS_UPDATES_COMMAND_H_ 6#define SYNC_ENGINE_PROCESS_UPDATES_COMMAND_H_ 7 8#include "base/compiler_specific.h" 9#include "sync/base/sync_export.h" 10#include "sync/engine/model_changing_syncer_command.h" 11#include "sync/engine/syncer_types.h" 12 13namespace sync_pb { 14class SyncEntity; 15} 16 17namespace syncer { 18 19namespace syncable { 20class WriteTransaction; 21} 22 23class Cryptographer; 24 25// A syncer command for verifying and processing updates. 26// 27// Preconditions - Updates in the SyncerSesssion have been downloaded. 28// 29// Postconditions - All of the verified SyncEntity data will be copied to 30// the server fields of the corresponding syncable entries. 31class SYNC_EXPORT_PRIVATE ProcessUpdatesCommand 32 : public ModelChangingSyncerCommand { 33 public: 34 ProcessUpdatesCommand(); 35 virtual ~ProcessUpdatesCommand(); 36 37 protected: 38 // ModelChangingSyncerCommand implementation. 39 virtual std::set<ModelSafeGroup> GetGroupsToChange( 40 const sessions::SyncSession& session) const OVERRIDE; 41 virtual SyncerError ModelChangingExecuteImpl( 42 sessions::SyncSession* session) OVERRIDE; 43 44 private: 45 VerifyResult VerifyUpdate( 46 syncable::WriteTransaction* trans, 47 const sync_pb::SyncEntity& entry, 48 ModelTypeSet requested_types, 49 const ModelSafeRoutingInfo& routes); 50 ServerUpdateProcessingResult ProcessUpdate( 51 const sync_pb::SyncEntity& proto_update, 52 const Cryptographer* cryptographer, 53 syncable::WriteTransaction* const trans); 54 DISALLOW_COPY_AND_ASSIGN(ProcessUpdatesCommand); 55}; 56 57} // namespace syncer 58 59#endif // SYNC_ENGINE_PROCESS_UPDATES_COMMAND_H_ 60