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