OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 COMPONENTS_SYNC_MODEL_IMPL_PASSTHROUGH_METADATA_CHANGE_LIST_H_ | 5 #ifndef COMPONENTS_SYNC_MODEL_IMPL_PASSTHROUGH_METADATA_CHANGE_LIST_H_ |
6 #define COMPONENTS_SYNC_MODEL_IMPL_PASSTHROUGH_METADATA_CHANGE_LIST_H_ | 6 #define COMPONENTS_SYNC_MODEL_IMPL_PASSTHROUGH_METADATA_CHANGE_LIST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "components/sync/model/metadata_change_list.h" | 10 #include "components/sync/model/metadata_change_list.h" |
11 #include "components/sync/model/model_type_store.h" | 11 #include "components/sync/model/model_type_store.h" |
12 | 12 |
13 namespace syncer { | 13 namespace syncer { |
14 | 14 |
15 // A thin wrapper around ModelTypeStore and WriteBatch to implement the | 15 // A thin wrapper around ModelTypeStore and WriteBatch to implement the |
16 // MetadataChangeList interface. This class should never outlive any of the | 16 // MetadataChangeList interface. This class should never outlive any of the |
17 // delegate objects it calls. | 17 // delegate objects it calls. |
18 class PassthroughMetadataChangeList : public MetadataChangeList { | 18 class PassthroughMetadataChangeList : public MetadataChangeList { |
19 public: | 19 public: |
20 PassthroughMetadataChangeList(ModelTypeStore* store, | 20 PassthroughMetadataChangeList(ModelTypeStore* store, |
21 ModelTypeStore::WriteBatch* batch); | 21 ModelTypeStore::WriteBatch* batch); |
22 | 22 |
23 // DataBatch MetadataChangeList. | 23 // DataBatch MetadataChangeList. |
24 void UpdateModelTypeState( | 24 void UpdateModelTypeState( |
25 const sync_pb::ModelTypeState& model_type_state) override; | 25 const sync_pb::ModelTypeState& model_type_state) override; |
26 void ClearModelTypeState() override; | 26 void ClearModelTypeState() override; |
27 void UpdateMetadata(const std::string& storage_key, | 27 void UpdateMetadata(const std::string& storage_key, |
28 const sync_pb::EntityMetadata& metadata) override; | 28 const sync_pb::EntityMetadata& metadata) override; |
29 void ClearMetadata(const std::string& storage_key) override; | 29 void ClearMetadata(const std::string& storage_key) override; |
| 30 base::Optional<syncer::ModelError> TakeError() override; |
30 | 31 |
31 private: | 32 private: |
32 // Non owning references. | 33 // Non owning references. |
33 ModelTypeStore* store_; | 34 ModelTypeStore* store_; |
34 ModelTypeStore::WriteBatch* batch_; | 35 ModelTypeStore::WriteBatch* batch_; |
35 }; | 36 }; |
36 | 37 |
37 } // namespace syncer | 38 } // namespace syncer |
38 | 39 |
39 #endif // COMPONENTS_SYNC_MODEL_IMPL_PASSTHROUGH_METADATA_CHANGE_LIST_H_ | 40 #endif // COMPONENTS_SYNC_MODEL_IMPL_PASSTHROUGH_METADATA_CHANGE_LIST_H_ |
OLD | NEW |