Index: ios/chrome/browser/reading_list/reading_list_model.h |
diff --git a/ios/chrome/browser/reading_list/reading_list_model.h b/ios/chrome/browser/reading_list/reading_list_model.h |
index 625b19f5f2b503e458bb5f8b9603978f31ea8c02..5c9fda0a8d410e85cbd17723b7bd7361bb2eac7c 100644 |
--- a/ios/chrome/browser/reading_list/reading_list_model.h |
+++ b/ios/chrome/browser/reading_list/reading_list_model.h |
@@ -16,11 +16,16 @@ |
class GURL; |
class ReadingListModel; |
+class ReadingListStore; |
namespace ios { |
class ChromeBrowserState; |
} |
+namespace syncer { |
+class ModelTypeService; |
+} |
+ |
// The reading list model contains two list of entries: one of unread urls, the |
// other of read ones. This object should only be accessed from one thread |
// (Usually the main thread). The observers callbacks are also sent on the main |
@@ -35,6 +40,8 @@ class ReadingListModel { |
// Returns true if the model is performing batch updates right now. |
bool IsPerformingBatchUpdates() const; |
+ virtual syncer::ModelTypeService* GetModelTypeService() = 0; |
+ |
// Tells model to prepare for batch updates. |
// This method is reentrant, i.e. several batch updates may take place at the |
// same time. |
@@ -61,6 +68,10 @@ class ReadingListModel { |
// Returns a specific entry. Returns null if the entry does not exist. |
virtual const ReadingListEntry* GetEntryFromURL(const GURL& gurl) const = 0; |
+ virtual void SyncAddEntry(std::unique_ptr<ReadingListEntry> entry, |
+ bool read) = 0; |
+ virtual void SyncRemoveEntry(const GURL& gurl) = 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. |
@@ -68,6 +79,15 @@ class ReadingListModel { |
const GURL& url, |
base::Callback<void(const ReadingListEntry&)> callback) const = 0; |
+ // Synchronously calls the |callback| with entry associated with this |url| |
+ // and its |read| status. |
+ // Does nothing if there is no entry associated. |
+ // Returns whether the callback has been called. |
+ virtual bool CallbackEntryReadStatusURL( |
+ const GURL& url, |
+ base::Callback<void(const ReadingListEntry&, bool read)> callback) |
+ 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 addition may be |
// asynchronous, and the data will be available only once the observers are |
@@ -127,6 +147,12 @@ class ReadingListModel { |
// ReadingListBatchUpdateToken dtor. |
virtual void EndBatchUpdates(); |
+ // Called when model is entering batch update mode. |
+ virtual void EnteringBatchUpdates(); |
+ |
+ // Called when model is leaving batch update mode. |
+ virtual void LeavingBatchUpdates(); |
+ |
private: |
unsigned int current_batch_updates_count_; |