| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SYNC_DIRECTORY_COMMIT_CONTRIBUTOR_H_ | 5 #ifndef SYNC_ENGINE_DIRECTORY_COMMIT_CONTRIBUTOR_H_ |
| 6 #define SYNC_ENGINE_SYNC_DIRECTORY_COMMIT_CONTRIBUTOR_H_ | 6 #define SYNC_ENGINE_DIRECTORY_COMMIT_CONTRIBUTOR_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "sync/engine/commit_contributor.h" |
| 12 #include "sync/engine/directory_commit_contribution.h" |
| 10 #include "sync/internal_api/public/base/model_type.h" | 13 #include "sync/internal_api/public/base/model_type.h" |
| 11 | 14 |
| 12 namespace syncer { | 15 namespace syncer { |
| 13 | 16 |
| 14 class SyncDirectoryCommitContribution; | |
| 15 | |
| 16 namespace syncable { | 17 namespace syncable { |
| 17 class Directory; | 18 class Directory; |
| 18 } | 19 } |
| 19 | 20 |
| 20 // This class represents the syncable::Directory as a source of items to commit | 21 // This class represents the syncable::Directory as a source of items to commit |
| 21 // to the sync server. | 22 // to the sync server. |
| 22 // | 23 // |
| 23 // Each instance of this class represents a particular type within the | 24 // Each instance of this class represents a particular type within the |
| 24 // syncable::Directory. When asked, it will iterate through the directory, grab | 25 // syncable::Directory. When asked, it will iterate through the directory, grab |
| 25 // any items of its type that are ready for commit, and return them in the form | 26 // any items of its type that are ready for commit, and return them in the form |
| 26 // of a SyncDirectoryCommitContribution. | 27 // of a DirectoryCommitContribution. |
| 27 class SyncDirectoryCommitContributor { | 28 class DirectoryCommitContributor : public CommitContributor { |
| 28 public: | 29 public: |
| 29 SyncDirectoryCommitContributor(syncable::Directory* dir, ModelType type); | 30 DirectoryCommitContributor(syncable::Directory* dir, ModelType type); |
| 30 ~SyncDirectoryCommitContributor(); | 31 virtual ~DirectoryCommitContributor(); |
| 31 | 32 |
| 32 SyncDirectoryCommitContribution* GetContribution(size_t max_entries); | 33 virtual scoped_ptr<CommitContribution> GetContribution( |
| 34 size_t max_entries) OVERRIDE; |
| 33 | 35 |
| 34 private: | 36 private: |
| 35 syncable::Directory* dir_; | 37 syncable::Directory* dir_; |
| 36 ModelType type_; | 38 ModelType type_; |
| 39 |
| 40 DISALLOW_COPY_AND_ASSIGN(DirectoryCommitContributor); |
| 37 }; | 41 }; |
| 38 | 42 |
| 39 } // namespace | 43 } // namespace |
| 40 | 44 |
| 41 #endif // SYNC_ENGINE_SYNC_DIRECTORY_COMMIT_CONTRIBUTOR_H_ | 45 #endif // SYNC_ENGINE_DIRECTORY_COMMIT_CONTRIBUTOR_H_ |
| OLD | NEW |