process_updates_command.h revision 3345a6884c488ff3a535c2c9acdd33d74b37e311
1// Copyright (c) 2006-2009 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 CHROME_BROWSER_SYNC_ENGINE_PROCESS_UPDATES_COMMAND_H_
6#define CHROME_BROWSER_SYNC_ENGINE_PROCESS_UPDATES_COMMAND_H_
7#pragma once
8
9#include "chrome/browser/sync/engine/model_changing_syncer_command.h"
10#include "chrome/browser/sync/engine/syncer_types.h"
11
12namespace syncable {
13class ScopedDirLookup;
14}
15
16namespace sync_pb {
17class SyncEntity;
18}
19
20namespace browser_sync {
21
22// A syncer command for processing updates.
23//
24// Preconditions - updates in the SyncerSesssion have been downloaded
25//                 and verified.
26//
27// Postconditions - All of the verified SyncEntity data will be copied to
28//                  the server fields of the corresponding syncable entries.
29// TODO(tim): This should not be ModelChanging (bug 36592).
30class ProcessUpdatesCommand : public ModelChangingSyncerCommand {
31 public:
32  ProcessUpdatesCommand();
33  virtual ~ProcessUpdatesCommand();
34
35  // ModelChangingSyncerCommand implementation.
36  virtual bool ModelNeutralExecuteImpl(sessions::SyncSession* session);
37  virtual void ModelChangingExecuteImpl(sessions::SyncSession* session);
38
39 private:
40  ServerUpdateProcessingResult ProcessUpdate(
41      const syncable::ScopedDirLookup& dir,
42      const sync_pb::SyncEntity& proto_update);
43  DISALLOW_COPY_AND_ASSIGN(ProcessUpdatesCommand);
44};
45
46}  // namespace browser_sync
47
48#endif  // CHROME_BROWSER_SYNC_ENGINE_PROCESS_UPDATES_COMMAND_H_
49