Chromium Code Reviews| 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> |
| 11 | 11 |
| 12 #include "base/callback.h" | |
| 12 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 13 #include "ios/chrome/browser/reading_list/reading_list_entry.h" | 14 #include "ios/chrome/browser/reading_list/reading_list_entry.h" |
| 14 #include "ios/chrome/browser/reading_list/reading_list_model_observer.h" | 15 #include "ios/chrome/browser/reading_list/reading_list_model_observer.h" |
| 15 | 16 |
| 16 class GURL; | 17 class GURL; |
| 17 class ReadingListModel; | 18 class ReadingListModel; |
| 18 | 19 |
| 19 namespace ios { | 20 namespace ios { |
| 20 class ChromeBrowserState; | 21 class ChromeBrowserState; |
| 21 } | 22 } |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 49 // 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 |
| 50 // 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 |
| 51 // when ResetUnseenEntries is called. | 52 // when ResetUnseenEntries is called. |
| 52 virtual bool HasUnseenEntries() const = 0; | 53 virtual bool HasUnseenEntries() const = 0; |
| 53 virtual void ResetUnseenEntries() = 0; | 54 virtual void ResetUnseenEntries() = 0; |
| 54 | 55 |
| 55 // Returns a specific entry. | 56 // Returns a specific entry. |
| 56 virtual const ReadingListEntry& GetUnreadEntryAtIndex(size_t index) const = 0; | 57 virtual const ReadingListEntry& GetUnreadEntryAtIndex(size_t index) const = 0; |
| 57 virtual const ReadingListEntry& GetReadEntryAtIndex(size_t index) const = 0; | 58 virtual const ReadingListEntry& GetReadEntryAtIndex(size_t index) const = 0; |
| 58 | 59 |
| 60 // Calls the |callback| with entry associated with this |url|. Does nothing if | |
| 61 // there is no entry associated. | |
| 62 // Returns whether the callback has been called. | |
| 63 virtual bool CallbackEntryURL( | |
| 64 const GURL& url, | |
| 65 base::Callback<void(const ReadingListEntry&)> callback) const = 0; | |
|
Olivier
2016/09/20 11:13:44
we could add a bool read parameter.
wdyt?
In comm
gambard
2016/09/20 11:27:33
I don't see the use case, can you clarify?
The beh
Olivier
2016/09/20 11:29:50
The bool parameter is in the callback parameter, n
gambard
2016/09/20 12:07:10
For now I don't see where this could be used in ou
| |
| 66 | |
| 59 // Adds |url| at the top of the unread entries, and removes entries with the | 67 // Adds |url| at the top of the unread entries, and removes entries with the |
| 60 // same |url| from everywhere else if they exist. The addition may be | 68 // same |url| from everywhere else if they exist. The addition may be |
| 61 // asynchronous, and the data will be available only once the observers are | 69 // asynchronous, and the data will be available only once the observers are |
| 62 // notified. | 70 // notified. |
| 63 virtual const ReadingListEntry& AddEntry(const GURL& url, | 71 virtual const ReadingListEntry& AddEntry(const GURL& url, |
| 64 const std::string& title) = 0; | 72 const std::string& title) = 0; |
| 65 | 73 |
| 66 // Removes an entry. The removal may be asynchronous, and not happen | 74 // Removes an entry. The removal may be asynchronous, and not happen |
| 67 // immediately. | 75 // immediately. |
| 68 virtual void RemoveEntryByUrl(const GURL& url) = 0; | 76 virtual void RemoveEntryByUrl(const GURL& url) = 0; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 // ReadingListBatchUpdateToken dtor. | 118 // ReadingListBatchUpdateToken dtor. |
| 111 virtual void EndBatchUpdates(); | 119 virtual void EndBatchUpdates(); |
| 112 | 120 |
| 113 private: | 121 private: |
| 114 unsigned int current_batch_updates_count_; | 122 unsigned int current_batch_updates_count_; |
| 115 | 123 |
| 116 DISALLOW_COPY_AND_ASSIGN(ReadingListModel); | 124 DISALLOW_COPY_AND_ASSIGN(ReadingListModel); |
| 117 }; | 125 }; |
| 118 | 126 |
| 119 #endif // IOS_CHROME_BROWSER_READING_LIST_READING_LIST_MODEL_H_ | 127 #endif // IOS_CHROME_BROWSER_READING_LIST_READING_LIST_MODEL_H_ |
| OLD | NEW |