Roll src/third_party/WebKit f36d5e0:68b67cd (svn 193299:193303)
[chromium-blink-merge.git] / sync / engine / directory_commit_contributor.h
blob62251f7c570357b27e306fb76b4946a0d87fe892
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_DIRECTORY_COMMIT_CONTRIBUTOR_H_
6 #define SYNC_ENGINE_DIRECTORY_COMMIT_CONTRIBUTOR_H_
8 #include <map>
10 #include "base/memory/scoped_ptr.h"
11 #include "sync/engine/commit_contributor.h"
12 #include "sync/engine/directory_commit_contribution.h"
13 #include "sync/internal_api/public/base/model_type.h"
15 namespace syncer {
17 namespace syncable {
18 class Directory;
21 class DirectoryTypeDebugInfoEmitter;
23 // This class represents the syncable::Directory as a source of items to commit
24 // to the sync server.
26 // Each instance of this class represents a particular type within the
27 // syncable::Directory. When asked, it will iterate through the directory, grab
28 // any items of its type that are ready for commit, and return them in the form
29 // of a DirectoryCommitContribution.
30 class DirectoryCommitContributor : public CommitContributor {
31 public:
32 DirectoryCommitContributor(syncable::Directory* dir,
33 ModelType type,
34 DirectoryTypeDebugInfoEmitter* debug_info_emitter);
35 ~DirectoryCommitContributor() override;
37 scoped_ptr<CommitContribution> GetContribution(size_t max_entries) override;
39 private:
40 syncable::Directory* dir_;
41 ModelType type_;
43 DirectoryTypeDebugInfoEmitter* debug_info_emitter_;
45 DISALLOW_COPY_AND_ASSIGN(DirectoryCommitContributor);
48 } // namespace
50 #endif // SYNC_ENGINE_DIRECTORY_COMMIT_CONTRIBUTOR_H_