OLD | NEW |
---|---|
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 IOS_CHROME_BROWSER_READING_LIST_READING_LIST_MODEL_H_ | 5 #ifndef IOS_CHROME_BROWSER_READING_LIST_READING_LIST_MODEL_H_ |
6 #define IOS_CHROME_BROWSER_READING_LIST_READING_LIST_MODEL_H_ | 6 #define IOS_CHROME_BROWSER_READING_LIST_READING_LIST_MODEL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 // Returns the size of read and unread entries. | 46 // Returns the size of read and unread entries. |
47 virtual size_t unread_size() const = 0; | 47 virtual size_t unread_size() const = 0; |
48 virtual size_t read_size() const = 0; | 48 virtual size_t read_size() const = 0; |
49 | 49 |
50 // Returns true if there are entries in the model that were not seen by the | 50 // Returns true if there are entries in the model that were not seen by the |
51 // user yet. Reset to true when new unread entries are added. Reset to false | 51 // user yet. Reset to true when new unread entries are added. Reset to false |
52 // when ResetUnseenEntries is called. | 52 // when ResetUnseenEntries is called. |
53 virtual bool HasUnseenEntries() const = 0; | 53 virtual bool HasUnseenEntries() const = 0; |
54 virtual void ResetUnseenEntries() = 0; | 54 virtual void ResetUnseenEntries() = 0; |
55 | 55 |
56 // Returns a specific entry. | 56 // Returns a specific entry. Returns nullptr if the entry does not exist. |
sdefresne
2016/10/04 13:26:46
s/nullptr/null/ in comments
| |
57 virtual const ReadingListEntry& GetUnreadEntryAtIndex(size_t index) const = 0; | 57 virtual const ReadingListEntry* GetUnreadEntryAtIndex(size_t index) const = 0; |
58 virtual const ReadingListEntry& GetReadEntryAtIndex(size_t index) const = 0; | 58 virtual const ReadingListEntry* GetReadEntryAtIndex(size_t index) const = 0; |
59 virtual const ReadingListEntry* GetEntryFromURL(const GURL& gurl) const = 0; | |
59 | 60 |
60 // Synchronously calls the |callback| with entry associated with this |url|. | 61 // Synchronously calls the |callback| with entry associated with this |url|. |
61 // Does nothing if there is no entry associated. | 62 // Does nothing if there is no entry associated. |
62 // Returns whether the callback has been called. | 63 // Returns whether the callback has been called. |
63 virtual bool CallbackEntryURL( | 64 virtual bool CallbackEntryURL( |
64 const GURL& url, | 65 const GURL& url, |
65 base::Callback<void(const ReadingListEntry&)> callback) const = 0; | 66 base::Callback<void(const ReadingListEntry&)> callback) const = 0; |
66 | 67 |
67 // Adds |url| at the top of the unread entries, and removes entries with the | 68 // Adds |url| at the top of the unread entries, and removes entries with the |
68 // same |url| from everywhere else if they exist. The addition may be | 69 // same |url| from everywhere else if they exist. The addition may be |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 // ReadingListBatchUpdateToken dtor. | 119 // ReadingListBatchUpdateToken dtor. |
119 virtual void EndBatchUpdates(); | 120 virtual void EndBatchUpdates(); |
120 | 121 |
121 private: | 122 private: |
122 unsigned int current_batch_updates_count_; | 123 unsigned int current_batch_updates_count_; |
123 | 124 |
124 DISALLOW_COPY_AND_ASSIGN(ReadingListModel); | 125 DISALLOW_COPY_AND_ASSIGN(ReadingListModel); |
125 }; | 126 }; |
126 | 127 |
127 #endif // IOS_CHROME_BROWSER_READING_LIST_READING_LIST_MODEL_H_ | 128 #endif // IOS_CHROME_BROWSER_READING_LIST_READING_LIST_MODEL_H_ |
OLD | NEW |