| Index: components/reading_list/ios/reading_list_model.h
|
| diff --git a/components/reading_list/ios/reading_list_model.h b/components/reading_list/ios/reading_list_model.h
|
| index b3969fa6a6276c1dc59b0b40165266cb783765b3..cae02262ee03c6c35bf24e609ae63d5300c39ae0 100644
|
| --- a/components/reading_list/ios/reading_list_model.h
|
| +++ b/components/reading_list/ios/reading_list_model.h
|
| @@ -16,7 +16,6 @@
|
| #include "components/reading_list/ios/reading_list_model_observer.h"
|
|
|
| class GURL;
|
| -class ReadingListEntry;
|
| class ReadingListModel;
|
| class ScopedReadingListBatchUpdate;
|
|
|
| @@ -53,9 +52,15 @@ class ReadingListModel : public base::NonThreadSafe {
|
| // Creates a batch token that will freeze the model while in scope.
|
| virtual std::unique_ptr<ScopedReadingListBatchUpdate> CreateBatchToken();
|
|
|
| - // Returns the size of read and unread entries.
|
| + // Returns a vector of URLs in the model. The order of the URL is not
|
| + // specified and can vary on successive calls.
|
| + virtual const std::vector<GURL> Keys() const = 0;
|
| +
|
| + // Returns the total number of entries in the model.
|
| + virtual size_t size() const = 0;
|
| +
|
| + // Returns the total number of unread entries in the model.
|
| virtual size_t unread_size() const = 0;
|
| - virtual size_t read_size() const = 0;
|
|
|
| // Returns true if there are entries in the model that were not seen by the
|
| // user yet. Reset to true when new unread entries are added. Reset to false
|
| @@ -63,23 +68,8 @@ class ReadingListModel : public base::NonThreadSafe {
|
| virtual bool HasUnseenEntries() const = 0;
|
| virtual void ResetUnseenEntries() = 0;
|
|
|
| - // TODO(659099): Remove methods.
|
| - // Returns a specific entry.
|
| - virtual const ReadingListEntry& GetUnreadEntryAtIndex(size_t index) const = 0;
|
| - virtual const ReadingListEntry& GetReadEntryAtIndex(size_t index) const = 0;
|
| -
|
| // Returns a specific entry. Returns null if the entry does not exist.
|
| - // If |read| is not null and the entry is found, |*read| is the read status
|
| - // of the entry.
|
| - virtual const ReadingListEntry* GetEntryFromURL(const GURL& gurl,
|
| - bool* read) const = 0;
|
| -
|
| - // Synchronously calls the |callback| with entry associated with this |url|.
|
| - // Does nothing if there is no entry associated.
|
| - // Returns whether the callback has been called.
|
| - virtual bool CallbackEntryURL(
|
| - const GURL& url,
|
| - base::Callback<void(const ReadingListEntry&)> callback) const = 0;
|
| + virtual const ReadingListEntry* GetEntryByURL(const GURL& gurl) const = 0;
|
|
|
| // Adds |url| at the top of the unread entries, and removes entries with the
|
| // same |url| from everywhere else if they exist. The entry title will be a
|
| @@ -93,14 +83,10 @@ class ReadingListModel : public base::NonThreadSafe {
|
| // immediately.
|
| virtual void RemoveEntryByURL(const GURL& url) = 0;
|
|
|
| - // If the |url| is in the reading list and unread, mark it read. If it is in
|
| - // the reading list and read, move it to the top of unread if it is not here
|
| - // already. This may trigger deletion of old read entries.
|
| - virtual void MarkReadByURL(const GURL& url) = 0;
|
| - // If the |url| is in the reading list and read, mark it unread. If it is in
|
| - // the reading list and unread, move it to the top of read if it is not here
|
| - // already.
|
| - virtual void MarkUnreadByURL(const GURL& url) = 0;
|
| + // If the |url| is in the reading list and entry(|url|).read != |read|, sets
|
| + // the read state of the URL to read. This will also update the update time of
|
| + // the entry.
|
| + virtual void SetReadStatus(const GURL& url, bool read) = 0;
|
|
|
| // Methods to mutate an entry. Will locate the relevant entry by URL. Does
|
| // nothing if the entry is not found.
|
| @@ -130,6 +116,17 @@ class ReadingListModel : public base::NonThreadSafe {
|
| DISALLOW_COPY_AND_ASSIGN(ScopedReadingListBatchUpdate);
|
| };
|
|
|
| + // TODO(crbug.com/664924): Remove temporary methods for transition.
|
| +
|
| + // Allows iterating through read entries in the model. Must be called on a
|
| + // singlerunloop to ensure no entry is returned twice and all entries are
|
| + // returned
|
| + virtual const ReadingListEntry& GetReadEntryAtIndex(size_t index) const = 0;
|
| + virtual const ReadingListEntry& GetUnreadEntryAtIndex(size_t index) const = 0;
|
| + virtual void MarkReadByURL(const GURL& url) = 0;
|
| + virtual void MarkUnreadByURL(const GURL& url) = 0;
|
| + virtual size_t read_size() const = 0;
|
| +
|
| protected:
|
| ReadingListModel();
|
| virtual ~ReadingListModel();
|
|
|