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

Side by Side Diff: ios/chrome/browser/reading_list/reading_list_model.h

Issue 2362063004: Find reading list entry state in model from url (Closed)
Patch Set: update comment Created 4 years, 3 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
« no previous file with comments | « no previous file | ios/chrome/browser/reading_list/reading_list_model_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 IOS_CHROME_BROWSER_READING_LIST_READING_LIST_MODEL_H_ 5 #ifndef IOS_CHROME_BROWSER_READING_LIST_READING_LIST_MODEL_H_
6 #define IOS_CHROME_BROWSER_READING_LIST_READING_LIST_MODEL_H_ 6 #define IOS_CHROME_BROWSER_READING_LIST_READING_LIST_MODEL_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 10 matching lines...) Expand all
21 class ChromeBrowserState; 21 class ChromeBrowserState;
22 } 22 }
23 23
24 // The reading list model contains two list of entries: one of unread urls, the 24 // The reading list model contains two list of entries: one of unread urls, the
25 // other of read ones. This object should only be accessed from one thread 25 // other of read ones. This object should only be accessed from one thread
26 // (Usually the main thread). The observers callbacks are also sent on the main 26 // (Usually the main thread). The observers callbacks are also sent on the main
27 // thread. 27 // thread.
28 class ReadingListModel { 28 class ReadingListModel {
29 public: 29 public:
30 class ScopedReadingListBatchUpdate; 30 class ScopedReadingListBatchUpdate;
31
32 // The entry is either NOTPRESENT in the model, in the READ part or in the
33 // UNREAD part of the model.
34 enum EntryState { NOTPRESENT, READ, UNREAD };
Olivier 2016/09/23 14:54:54 NOT_PRESENT?
gambard 2016/09/26 14:02:30 Done.
35
31 // Returns true if the model finished loading. Until this returns true the 36 // Returns true if the model finished loading. Until this returns true the
32 // reading list is not ready for use. 37 // reading list is not ready for use.
33 virtual bool loaded() const = 0; 38 virtual bool loaded() const = 0;
34 39
35 // Returns true if the model is performing batch updates right now. 40 // Returns true if the model is performing batch updates right now.
36 bool IsPerformingBatchUpdates() const; 41 bool IsPerformingBatchUpdates() const;
37 42
38 // Tells model to prepare for batch updates. 43 // Tells model to prepare for batch updates.
39 // This method is reentrant, i.e. several batch updates may take place at the 44 // This method is reentrant, i.e. several batch updates may take place at the
40 // same time. 45 // same time.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 78
74 // Removes an entry. The removal may be asynchronous, and not happen 79 // Removes an entry. The removal may be asynchronous, and not happen
75 // immediately. 80 // immediately.
76 virtual void RemoveEntryByUrl(const GURL& url) = 0; 81 virtual void RemoveEntryByUrl(const GURL& url) = 0;
77 82
78 // If the |url| is in the reading list and unread, mark it read. If it is in 83 // If the |url| is in the reading list and unread, mark it read. If it is in
79 // the reading list and read, move it to the top of unread if it is not here 84 // the reading list and read, move it to the top of unread if it is not here
80 // already. This may trigger deletion of old read entries. 85 // already. This may trigger deletion of old read entries.
81 virtual void MarkReadByURL(const GURL& url) = 0; 86 virtual void MarkReadByURL(const GURL& url) = 0;
82 87
88 // Return the state of the entry in the model (not present, read or unread).
89 virtual EntryState EntryPositionByURL(const GURL& url) = 0;
Olivier 2016/09/23 14:54:54 position is more an index IMO.
gambard 2016/09/26 14:02:30 Done.
90
83 // Methods to mutate an entry. Will locate the relevant entry by URL. Does 91 // Methods to mutate an entry. Will locate the relevant entry by URL. Does
84 // nothing if the entry is not found. 92 // nothing if the entry is not found.
85 virtual void SetEntryTitle(const GURL& url, const std::string& title) = 0; 93 virtual void SetEntryTitle(const GURL& url, const std::string& title) = 0;
86 virtual void SetEntryDistilledURL(const GURL& url, 94 virtual void SetEntryDistilledURL(const GURL& url,
87 const GURL& distilled_url) = 0; 95 const GURL& distilled_url) = 0;
88 virtual void SetEntryDistilledState( 96 virtual void SetEntryDistilledState(
89 const GURL& url, 97 const GURL& url,
90 ReadingListEntry::DistillationState state) = 0; 98 ReadingListEntry::DistillationState state) = 0;
91 99
92 // Observer registration methods. 100 // Observer registration methods.
(...skipping 25 matching lines...) Expand all
118 // ReadingListBatchUpdateToken dtor. 126 // ReadingListBatchUpdateToken dtor.
119 virtual void EndBatchUpdates(); 127 virtual void EndBatchUpdates();
120 128
121 private: 129 private:
122 unsigned int current_batch_updates_count_; 130 unsigned int current_batch_updates_count_;
123 131
124 DISALLOW_COPY_AND_ASSIGN(ReadingListModel); 132 DISALLOW_COPY_AND_ASSIGN(ReadingListModel);
125 }; 133 };
126 134
127 #endif // IOS_CHROME_BROWSER_READING_LIST_READING_LIST_MODEL_H_ 135 #endif // IOS_CHROME_BROWSER_READING_LIST_READING_LIST_MODEL_H_
OLDNEW
« no previous file with comments | « no previous file | ios/chrome/browser/reading_list/reading_list_model_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698