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

Side by Side Diff: components/reading_list/reading_list_model_observer.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_OBSERVER_H_
6 #define COMPONENTS_READING_LIST_READING_LIST_MODEL_OBSERVER_H_
7
8 #import <set>
9 #import <vector>
10
11 class ReadingListModel;
12 class ReadingListEntry;
13
14 // Observer for the Reading List model. In the observer methods care should be
15 // taken to not modify the model.
16 class ReadingListModelObserver {
17 public:
18 // Invoked when the model has finished loading. Until this method is called it
19 // is unsafe to use the model.
20 virtual void ReadingListModelLoaded(const ReadingListModel* model) = 0;
21
22 // Invoked when the batch updates are about to start. It will only be called
23 // once before ReadingListModelCompletedBatchUpdates, even if several updates
24 // are taking place at the same time.
25 virtual void ReadingListModelBeganBatchUpdates(
26 const ReadingListModel* model) {}
27
28 // Invoked when the batch updates have completed. This is called once all
29 // batch updates are completed.
30 virtual void ReadingListModelCompletedBatchUpdates(
31 const ReadingListModel* model) {}
32
33 // Invoked from the destructor of the model. The model is no longer valid
34 // after this call. There is no need to call RemoveObserver on the model from
35 // here, as the observers are automatically deleted.
36 virtual void ReadingListModelBeingDeleted(const ReadingListModel* model) {}
37
38 // Invoked when elements are about to be removed from the read or unread list.
39 virtual void ReadingListWillRemoveUnreadEntry(const ReadingListModel* model,
40 size_t index) {}
41 virtual void ReadingListWillRemoveReadEntry(const ReadingListModel* model,
42 size_t index) {}
43 // Invoked when elements are moved from unread to read or from read to unread.
44 // |index| is the original position and |read| the origin status. The element
45 // will change list and/or index but will not be deleted.
46 virtual void ReadingListWillMoveEntry(const ReadingListModel* model,
47 size_t index,
48 bool read) {}
49
50 // Invoked when elements are added to the read or the unread list. The new
51 // entries are always added at the beginning. these methods may be called
52 // multiple time (to process changes coming from a synchronization for
53 // example) and they will be executed in call order, the last call will end up
54 // in first position.
55 virtual void ReadingListWillAddUnreadEntry(const ReadingListModel* model,
56 const ReadingListEntry& entry) {}
57
58 virtual void ReadingListWillAddReadEntry(const ReadingListModel* model,
59 const ReadingListEntry& entry) {}
60
61 // Invoked when an entry is about to change.
62 virtual void ReadingListWillUpdateUnreadEntry(const ReadingListModel* model,
63 size_t index) {}
64 virtual void ReadingListWillUpdateReadEntry(const ReadingListModel* model,
65 size_t index) {}
66
67 // Called after all the changes signaled by calls to the "Will" methods are
68 // done. All the "Will" methods are called as necessary, then the changes
69 // are applied and then this method is called.
70 virtual void ReadingListDidApplyChanges(ReadingListModel* model) {}
71
72 protected:
73 ReadingListModelObserver() {}
74 virtual ~ReadingListModelObserver() {}
75
76 DISALLOW_COPY_AND_ASSIGN(ReadingListModelObserver);
77 };
78
79 #endif // COMPONENTS_READING_LIST_READING_LIST_MODEL_OBSERVER_H_
OLDNEW
« no previous file with comments | « components/reading_list/reading_list_model_impl.cc ('k') | components/reading_list/reading_list_model_storage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698