Chromium Code Reviews| 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_READING_LIST_IOS_READING_LIST_MODEL_STORAGE_H_ | 5 #ifndef COMPONENTS_READING_LIST_IOS_READING_LIST_MODEL_STORAGE_H_ |
| 6 #define COMPONENTS_READING_LIST_IOS_READING_LIST_MODEL_STORAGE_H_ | 6 #define COMPONENTS_READING_LIST_IOS_READING_LIST_MODEL_STORAGE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "components/reading_list/ios/reading_list_entry.h" | 11 #include "components/reading_list/ios/reading_list_entry.h" |
| 12 #include "components/sync/base/model_type.h" | |
| 13 #include "components/sync/model/model_type_sync_bridge.h" | |
| 12 | 14 |
| 13 class ReadingListModel; | 15 class ReadingListModel; |
| 14 class ReadingListStoreDelegate; | 16 class ReadingListStoreDelegate; |
| 15 | 17 |
| 16 namespace syncer { | 18 namespace syncer { |
| 17 class ModelTypeSyncBridge; | 19 class ModelTypeSyncBridge; |
| 18 } | 20 } |
| 19 | 21 |
| 20 // Interface for a persistence layer for reading list. | 22 // Interface for a persistence layer for reading list. |
| 21 // All interface methods have to be called on main thread. | 23 // All interface methods have to be called on main thread. |
| 22 class ReadingListModelStorage { | 24 class ReadingListModelStorage : public syncer::ModelTypeSyncBridge { |
| 23 public: | 25 public: |
| 24 class ScopedBatchUpdate; | 26 class ScopedBatchUpdate; |
| 25 | 27 |
| 26 ReadingListModelStorage() {} | 28 ReadingListModelStorage( |
| 27 virtual ~ReadingListModelStorage() {} | 29 const ChangeProcessorFactory& change_processor_factory, |
| 30 syncer::ModelType type); | |
| 31 ~ReadingListModelStorage() override{}; | |
|
sdefresne
2016/12/12 09:33:24
required: no semi-colon after method implementatio
Olivier
2016/12/12 10:20:17
Done.
| |
| 28 | 32 |
| 29 // Sets the model the Storage is backing. | 33 // Sets the model the Storage is backing. |
| 30 // This will trigger store initalization and load persistent entries. | 34 // This will trigger store initalization and load persistent entries. |
| 31 virtual void SetReadingListModel(ReadingListModel* model, | 35 virtual void SetReadingListModel(ReadingListModel* model, |
| 32 ReadingListStoreDelegate* delegate) = 0; | 36 ReadingListStoreDelegate* delegate) = 0; |
| 33 | 37 |
| 34 // Returns the class responsible for handling sync messages. | |
| 35 virtual syncer::ModelTypeSyncBridge* GetModelTypeSyncBridge() = 0; | |
| 36 | |
| 37 // Starts a transaction. All Save/Remove entry will be delayed until the | 38 // Starts a transaction. All Save/Remove entry will be delayed until the |
| 38 // transaction is commited. | 39 // transaction is commited. |
| 39 // Multiple transaction can be started at the same time. Commit will happen | 40 // Multiple transaction can be started at the same time. Commit will happen |
| 40 // when the last transaction is commited. | 41 // when the last transaction is commited. |
| 41 // Returns a scoped batch update object that should be retained while the | 42 // Returns a scoped batch update object that should be retained while the |
| 42 // batch update is performed. Deallocating this object will inform model that | 43 // batch update is performed. Deallocating this object will inform model that |
| 43 // the batch update has completed. | 44 // the batch update has completed. |
| 44 virtual std::unique_ptr<ScopedBatchUpdate> EnsureBatchCreated() = 0; | 45 virtual std::unique_ptr<ScopedBatchUpdate> EnsureBatchCreated() = 0; |
| 45 | 46 |
| 46 // Saves or updates an entry. If the entry is not yet in the database, it is | 47 // Saves or updates an entry. If the entry is not yet in the database, it is |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 57 | 58 |
| 58 private: | 59 private: |
| 59 DISALLOW_COPY_AND_ASSIGN(ScopedBatchUpdate); | 60 DISALLOW_COPY_AND_ASSIGN(ScopedBatchUpdate); |
| 60 }; | 61 }; |
| 61 | 62 |
| 62 private: | 63 private: |
| 63 DISALLOW_COPY_AND_ASSIGN(ReadingListModelStorage); | 64 DISALLOW_COPY_AND_ASSIGN(ReadingListModelStorage); |
| 64 }; | 65 }; |
| 65 | 66 |
| 66 #endif // COMPONENTS_READING_LIST_IOS_READING_LIST_MODEL_STORAGE_H_ | 67 #endif // COMPONENTS_READING_LIST_IOS_READING_LIST_MODEL_STORAGE_H_ |
| OLD | NEW |