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

Unified Diff: ios/chrome/browser/reading_list/reading_list_model_impl.h

Issue 2369303002: Reading List create protobuf store (Closed)
Patch Set: feedback Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
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,
sdefresne 2016/10/07 09:44:30 Why use std::unique_ptr<std::vector<ReadingListEnt
jif-google 2016/10/07 09:51:34 1/ The fact that ReadingListEntries is movable is
+ 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);
};

Powered by Google App Engine
This is Rietveld 408576698