kiosk: Fix keyboard flow on network config UI.
[chromium-blink-merge.git] / sync / engine / update_applicator.h
blobff8fa15716385bfc2c6d308c6c9455bb21af25f6
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 // An UpdateApplicator is used to iterate over a number of unapplied updates,
6 // applying them to the client using the given syncer session.
7 //
8 // UpdateApplicator might resemble an iterator, but it actually keeps retrying
9 // failed updates until no remaining updates can be successfully applied.
11 #ifndef SYNC_ENGINE_UPDATE_APPLICATOR_H_
12 #define SYNC_ENGINE_UPDATE_APPLICATOR_H_
14 #include <vector>
16 #include "base/basictypes.h"
17 #include "base/port.h"
18 #include "sync/internal_api/public/engine/model_safe_worker.h"
19 #include "sync/syncable/syncable_id.h"
20 #include "sync/sessions/status_controller.h"
22 namespace syncer {
24 namespace sessions {
25 class StatusController;
28 namespace syncable {
29 class WriteTransaction;
30 class Entry;
33 class ConflictResolver;
34 class Cryptographer;
36 class UpdateApplicator {
37 public:
38 UpdateApplicator(Cryptographer* cryptographer);
39 ~UpdateApplicator();
41 // Attempt to apply the specified updates.
42 void AttemptApplications(syncable::WriteTransaction* trans,
43 const std::vector<int64>& handles);
45 int updates_applied() {
46 return updates_applied_;
49 int encryption_conflicts() {
50 return encryption_conflicts_;
53 int hierarchy_conflicts() {
54 return hierarchy_conflicts_;
57 const std::set<syncable::Id>& simple_conflict_ids() {
58 return simple_conflict_ids_;
61 private:
62 // If true, AttemptOneApplication will skip over |entry| and return true.
63 bool SkipUpdate(const syncable::Entry& entry);
65 // Used to decrypt sensitive sync nodes.
66 Cryptographer* cryptographer_;
68 DISALLOW_COPY_AND_ASSIGN(UpdateApplicator);
70 int updates_applied_;
71 int encryption_conflicts_;
72 int hierarchy_conflicts_;
73 std::set<syncable::Id> simple_conflict_ids_;
76 } // namespace syncer
78 #endif // SYNC_ENGINE_UPDATE_APPLICATOR_H_