Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Side by Side Diff: components/reading_list/ios/reading_list_model_storage.h

Issue 2763233003: Move ReadingList model to components/reading_list/core (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_READING_LIST_IOS_READING_LIST_MODEL_STORAGE_H_
6 #define COMPONENTS_READING_LIST_IOS_READING_LIST_MODEL_STORAGE_H_
7
8 #include <vector>
9
10 #include "base/macros.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"
14
15 class ReadingListModel;
16 class ReadingListStoreDelegate;
17
18 namespace base {
19 class Clock;
20 }
21
22 namespace syncer {
23 class ModelTypeSyncBridge;
24 }
25
26 // Interface for a persistence layer for reading list.
27 // All interface methods have to be called on main thread.
28 class ReadingListModelStorage : public syncer::ModelTypeSyncBridge {
29 public:
30 class ScopedBatchUpdate;
31
32 ReadingListModelStorage(
33 const ChangeProcessorFactory& change_processor_factory,
34 syncer::ModelType type);
35 ~ReadingListModelStorage() override;
36
37 // Sets the model the Storage is backing.
38 // This will trigger store initalization and load persistent entries.
39 // Pass the |clock| from the |model| to ensure synchroization when loading
40 // entries.
41 virtual void SetReadingListModel(ReadingListModel* model,
42 ReadingListStoreDelegate* delegate,
43 base::Clock* clock) = 0;
44
45 // Starts a transaction. All Save/Remove entry will be delayed until the
46 // transaction is commited.
47 // Multiple transaction can be started at the same time. Commit will happen
48 // when the last transaction is commited.
49 // Returns a scoped batch update object that should be retained while the
50 // batch update is performed. Deallocating this object will inform model that
51 // the batch update has completed.
52 virtual std::unique_ptr<ScopedBatchUpdate> EnsureBatchCreated() = 0;
53
54 // Saves or updates an entry. If the entry is not yet in the database, it is
55 // created.
56 virtual void SaveEntry(const ReadingListEntry& entry) = 0;
57
58 // Removed an entry from the storage.
59 virtual void RemoveEntry(const ReadingListEntry& entry) = 0;
60
61 class ScopedBatchUpdate {
62 public:
63 ScopedBatchUpdate() {}
64 virtual ~ScopedBatchUpdate() {}
65
66 private:
67 DISALLOW_COPY_AND_ASSIGN(ScopedBatchUpdate);
68 };
69
70 private:
71 DISALLOW_COPY_AND_ASSIGN(ReadingListModelStorage);
72 };
73
74 #endif // COMPONENTS_READING_LIST_IOS_READING_LIST_MODEL_STORAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698