Revert "Fix broken channel icon in chrome://help on CrOS" and try again
[chromium-blink-merge.git] / sync / engine / commit_processor.h
blob70e0e99c524571deafa53b3d0d01197bb0b73bc4
1 // Copyright 2014 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.
5 #ifndef SYNC_ENGINE_COMMIT_PROCESSOR_H_
6 #define SYNC_ENGINE_COMMIT_PROCESSOR_H_
8 #include <map>
9 #include <vector>
11 #include "base/basictypes.h"
12 #include "sync/base/sync_export.h"
13 #include "sync/engine/commit.h"
14 #include "sync/internal_api/public/base/model_type.h"
15 #include "sync/internal_api/public/engine/model_safe_worker.h"
16 #include "sync/sessions/model_type_registry.h"
18 namespace syncer {
20 namespace syncable {
21 class Directory;
22 } // namespace syncable
24 class CommitContributor;
25 class CommitContribution;
27 // This class manages the set of per-type committer objects.
29 // It owns these types and hides the details of iterating over all of them.
30 // Many methods allow the caller to specify a subset of types on which the
31 // operation is to be applied. It is a logic error if the supplied set of types
32 // contains a type which was not previously registered.
33 class SYNC_EXPORT_PRIVATE CommitProcessor {
34 public:
35 // Contructs a CommitProcessor from a map of CommitContributors.
36 // The CommitProcessor does not own this map.
37 explicit CommitProcessor(CommitContributorMap* commit_contributor_map);
38 ~CommitProcessor();
40 // Gathers a set of contributions to be used to populate a commit message.
42 // For each of the |commit_types| in this CommitProcessor's CommitContributor
43 // map, gather any entries queued for commit into CommitContributions. The
44 // total number of entries in all the returned CommitContributions shall not
45 // exceed |max_entries|.
46 void GatherCommitContributions(ModelTypeSet commit_types,
47 size_t max_entries,
48 Commit::ContributionMap* contributions);
50 private:
51 // A map of 'commit contributors', one for each enabled type.
52 CommitContributorMap* commit_contributor_map_;
54 DISALLOW_COPY_AND_ASSIGN(CommitProcessor);
57 } // namespace syncer
59 #endif // SYNC_ENGINE_COMMIT_PROCESSOR_H_