OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef SYNC_ENGINE_DIRECTORY_COMMIT_CONTRIBUTOR_H_ | |
6 #define SYNC_ENGINE_DIRECTORY_COMMIT_CONTRIBUTOR_H_ | |
7 | |
8 #include <stddef.h> | |
9 | |
10 #include <map> | |
11 #include <memory> | |
12 | |
13 #include "base/macros.h" | |
14 #include "sync/engine/commit_contributor.h" | |
15 #include "sync/engine/directory_commit_contribution.h" | |
16 #include "sync/internal_api/public/base/model_type.h" | |
17 | |
18 namespace syncer { | |
19 | |
20 namespace syncable { | |
21 class Directory; | |
22 } | |
23 | |
24 class DirectoryTypeDebugInfoEmitter; | |
25 | |
26 // This class represents the syncable::Directory as a source of items to commit | |
27 // to the sync server. | |
28 // | |
29 // Each instance of this class represents a particular type within the | |
30 // syncable::Directory. When asked, it will iterate through the directory, grab | |
31 // any items of its type that are ready for commit, and return them in the form | |
32 // of a DirectoryCommitContribution. | |
33 class DirectoryCommitContributor : public CommitContributor { | |
34 public: | |
35 DirectoryCommitContributor(syncable::Directory* dir, | |
36 ModelType type, | |
37 DirectoryTypeDebugInfoEmitter* debug_info_emitter); | |
38 ~DirectoryCommitContributor() override; | |
39 | |
40 std::unique_ptr<CommitContribution> GetContribution( | |
41 size_t max_entries) override; | |
42 | |
43 private: | |
44 syncable::Directory* dir_; | |
45 ModelType type_; | |
46 | |
47 DirectoryTypeDebugInfoEmitter* debug_info_emitter_; | |
48 | |
49 DISALLOW_COPY_AND_ASSIGN(DirectoryCommitContributor); | |
50 }; | |
51 | |
52 } // namespace syncer | |
53 | |
54 #endif // SYNC_ENGINE_DIRECTORY_COMMIT_CONTRIBUTOR_H_ | |
OLD | NEW |