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

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

Issue 2511723002: Enable RL sync by default on iOS (Closed)
Patch Set: rebase Created 4 years 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_READING_LIST_MODEL_STORAGE_H_
6 #define COMPONENTS_READING_LIST_READING_LIST_MODEL_STORAGE_H_
7
8 #include <vector>
9
10 #include "components/reading_list/reading_list_entry.h"
11
12 class ReadingListModel;
13 class ReadingListStoreDelegate;
14
15 namespace syncer {
16 class ModelTypeSyncBridge;
17 }
18
19 // Interface for a persistence layer for reading list.
20 // All interface methods have to be called on main thread.
21 class ReadingListModelStorage {
22 public:
23 class ScopedBatchUpdate;
24
25 // Sets the model the Storage is backing.
26 // This will trigger store initalization and load persistent entries.
27 virtual void SetReadingListModel(ReadingListModel* model,
28 ReadingListStoreDelegate* delegate) = 0;
29
30 // Returns the class responsible for handling sync messages.
31 virtual syncer::ModelTypeSyncBridge* GetModelTypeSyncBridge() = 0;
32
33 // Starts a transaction. All Save/Remove entry will be delayed until the
34 // transaction is commited.
35 // Multiple transaction can be started at the same time. Commit will happen
36 // when the last transaction is commited.
37 // Returns a scoped batch update object that should be retained while the
38 // batch update is performed. Deallocating this object will inform model that
39 // the batch update has completed.
40 virtual std::unique_ptr<ScopedBatchUpdate> EnsureBatchCreated() = 0;
41
42 // Saves or updates an entry. If the entry is not yet in the database, it is
43 // created.
44 virtual void SaveEntry(const ReadingListEntry& entry, bool read) = 0;
45
46 // Removed an entry from the storage.
47 virtual void RemoveEntry(const ReadingListEntry& entry) = 0;
48
49 class ScopedBatchUpdate {
50 public:
51 virtual ~ScopedBatchUpdate() {}
52 };
53 };
54
55 #endif // COMPONENTS_READING_LIST_READING_LIST_MODEL_STORAGE_H_
OLDNEW
« no previous file with comments | « components/reading_list/reading_list_model_observer.h ('k') | components/reading_list/reading_list_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698