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

Side by Side Diff: components/reading_list/ios/reading_list_model_impl.h

Issue 2541683003: Clean ReadingListModel. (Closed)
Patch Set: Created 4 years 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
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 COMPONENTS_READING_LIST_IOS_READING_LIST_MODEL_IMPL_H_ 5 #ifndef COMPONENTS_READING_LIST_IOS_READING_LIST_MODEL_IMPL_H_
6 #define COMPONENTS_READING_LIST_IOS_READING_LIST_MODEL_IMPL_H_ 6 #define COMPONENTS_READING_LIST_IOS_READING_LIST_MODEL_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 10
(...skipping 28 matching lines...) Expand all
39 void StoreLoaded(std::unique_ptr<ReadingListEntries> entries) override; 39 void StoreLoaded(std::unique_ptr<ReadingListEntries> entries) override;
40 40
41 // KeyedService implementation. 41 // KeyedService implementation.
42 void Shutdown() override; 42 void Shutdown() override;
43 43
44 // ReadingListModel implementation. 44 // ReadingListModel implementation.
45 bool loaded() const override; 45 bool loaded() const override;
46 46
47 size_t size() const override; 47 size_t size() const override;
48 size_t unread_size() const override; 48 size_t unread_size() const override;
49 size_t read_size() const override;
50 49
51 bool HasUnseenEntries() const override; 50 bool HasUnseenEntries() const override;
52 void ResetUnseenEntries() override; 51 void ResetUnseenEntries() override;
53 52
54 const std::vector<GURL> Keys() const override; 53 const std::vector<GURL> Keys() const override;
55 54
56 const ReadingListEntry* GetEntryByURL(const GURL& gurl) const override; 55 const ReadingListEntry* GetEntryByURL(const GURL& gurl) const override;
57 const ReadingListEntry& GetUnreadEntryAtIndex(size_t index) const override;
58 const ReadingListEntry& GetReadEntryAtIndex(size_t index) const override;
59 void MarkReadByURL(const GURL& url) override;
60 void MarkUnreadByURL(const GURL& url) override;
61 56
62 void RemoveEntryByURL(const GURL& url) override; 57 void RemoveEntryByURL(const GURL& url) override;
63 58
64 const ReadingListEntry& AddEntry(const GURL& url, 59 const ReadingListEntry& AddEntry(const GURL& url,
65 const std::string& title) override; 60 const std::string& title) override;
66 61
67 void SetReadStatus(const GURL& url, bool read) override; 62 void SetReadStatus(const GURL& url, bool read) override;
68 63
69 void SetEntryTitle(const GURL& url, const std::string& title) override; 64 void SetEntryTitle(const GURL& url, const std::string& title) override;
70 void SetEntryDistilledPath(const GURL& url, 65 void SetEntryDistilledPath(const GURL& url,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 109
115 // Remove entry |url| and propagate to store if |from_sync| is false. 110 // Remove entry |url| and propagate to store if |from_sync| is false.
116 void RemoveEntryByURLImpl(const GURL& url, bool from_sync); 111 void RemoveEntryByURLImpl(const GURL& url, bool from_sync);
117 112
118 void RebuildIndex() const; 113 void RebuildIndex() const;
119 114
120 std::unique_ptr<ReadingListEntries> entries_; 115 std::unique_ptr<ReadingListEntries> entries_;
121 size_t unread_entry_count_; 116 size_t unread_entry_count_;
122 size_t read_entry_count_; 117 size_t read_entry_count_;
123 118
124 // TODO(crbug.com/664924): Remove temporary cache and move it to
125 // ReadingListViewController.
126 struct Cache {
127 Cache();
128 ~Cache();
129 std::vector<GURL> read_entries;
130 std::vector<GURL> unread_entries;
131 bool dirty;
132 };
133 std::unique_ptr<struct Cache> cache_;
134
135 std::unique_ptr<ReadingListModelStorage> storage_layer_; 119 std::unique_ptr<ReadingListModelStorage> storage_layer_;
136 PrefService* pref_service_; 120 PrefService* pref_service_;
137 bool has_unseen_; 121 bool has_unseen_;
138 bool loaded_; 122 bool loaded_;
139 base::WeakPtrFactory<ReadingListModelImpl> weak_ptr_factory_; 123 base::WeakPtrFactory<ReadingListModelImpl> weak_ptr_factory_;
140 DISALLOW_COPY_AND_ASSIGN(ReadingListModelImpl); 124 DISALLOW_COPY_AND_ASSIGN(ReadingListModelImpl);
141 }; 125 };
142 126
143 #endif // COMPONENTS_READING_LIST_IOS_READING_LIST_MODEL_IMPL_H_ 127 #endif // COMPONENTS_READING_LIST_IOS_READING_LIST_MODEL_IMPL_H_
OLDNEW
« no previous file with comments | « components/reading_list/ios/reading_list_model.h ('k') | components/reading_list/ios/reading_list_model_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698