Index: ios/chrome/browser/reading_list/reading_list_model_impl.h |
diff --git a/ios/chrome/browser/reading_list/reading_list_model_impl.h b/ios/chrome/browser/reading_list/reading_list_model_impl.h |
index d185c5193618190144f0d2e3de6541d1e11aaa52..e722d69aa0a65cb7dab0fe85f5148233fdbf6c23 100644 |
--- a/ios/chrome/browser/reading_list/reading_list_model_impl.h |
+++ b/ios/chrome/browser/reading_list/reading_list_model_impl.h |
@@ -12,13 +12,17 @@ |
#include "ios/chrome/browser/reading_list/reading_list_model.h" |
class ReadingListModelStorage; |
+class PrefService; |
+ |
+using ReadingListEntries = std::vector<ReadingListEntry>; |
// Concrete implementation of a reading list model using in memory lists. |
class ReadingListModelImpl : public ReadingListModel, public KeyedService { |
public: |
// Initialize a ReadingListModelImpl to load and save data in |
// |persistence_layer|. |
- ReadingListModelImpl(std::unique_ptr<ReadingListModelStorage> storage_layer); |
+ ReadingListModelImpl(std::unique_ptr<ReadingListModelStorage> storage_layer, |
+ PrefService* pref_service); |
// Initialize a ReadingListModelImpl without persistence. Data will not be |
// persistent across sessions. |
@@ -57,18 +61,24 @@ class ReadingListModelImpl : public ReadingListModel, public KeyedService { |
const GURL& url, |
ReadingListEntry::DistillationState state) override; |
+ virtual void ModelLoaded(std::unique_ptr<ReadingListEntries> unread, |
+ std::unique_ptr<ReadingListEntries> read); |
+ |
protected: |
- void EndBatchUpdates() override; |
+ void EnteringBatchUpdates() override; |
+ void LeavingBatchUpdates() override; |
private: |
- typedef std::vector<ReadingListEntry> ReadingListEntries; |
- |
- ReadingListEntries unread_; |
- ReadingListEntries read_; |
- std::unique_ptr<ReadingListModelStorage> storageLayer_; |
- bool hasUnseen_; |
+ void SavePersistentHasUnseen(bool has_unseen); |
+ bool LoadPersistentHasUnseen(); |
+ |
+ std::unique_ptr<ReadingListEntries> unread_; |
+ std::unique_ptr<ReadingListEntries> read_; |
+ std::unique_ptr<ReadingListModelStorage> storage_layer_; |
+ PrefService* pref_service_; |
+ bool has_unseen_; |
bool loaded_; |
- |
+ base::WeakPtrFactory<ReadingListModelImpl> weak_ptr_factory_; |
DISALLOW_COPY_AND_ASSIGN(ReadingListModelImpl); |
}; |