| 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 COMPONENTS_READING_LIST_IOS_READING_LIST_MODEL_H_ | 5 #ifndef COMPONENTS_READING_LIST_IOS_READING_LIST_MODEL_H_ |
| 6 #define COMPONENTS_READING_LIST_IOS_READING_LIST_MODEL_H_ | 6 #define COMPONENTS_READING_LIST_IOS_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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 : model_(model) {} | 109 : model_(model) {} |
| 110 | 110 |
| 111 virtual ~ScopedReadingListBatchUpdate(); | 111 virtual ~ScopedReadingListBatchUpdate(); |
| 112 | 112 |
| 113 private: | 113 private: |
| 114 ReadingListModel* model_; | 114 ReadingListModel* model_; |
| 115 | 115 |
| 116 DISALLOW_COPY_AND_ASSIGN(ScopedReadingListBatchUpdate); | 116 DISALLOW_COPY_AND_ASSIGN(ScopedReadingListBatchUpdate); |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 // TODO(crbug.com/664924): Remove temporary methods for transition. | |
| 120 | |
| 121 // Allows iterating through read entries in the model. Must be called on a | |
| 122 // singlerunloop to ensure no entry is returned twice and all entries are | |
| 123 // returned | |
| 124 virtual const ReadingListEntry& GetReadEntryAtIndex(size_t index) const = 0; | |
| 125 virtual const ReadingListEntry& GetUnreadEntryAtIndex(size_t index) const = 0; | |
| 126 virtual void MarkReadByURL(const GURL& url) = 0; | |
| 127 virtual void MarkUnreadByURL(const GURL& url) = 0; | |
| 128 virtual size_t read_size() const = 0; | |
| 129 | |
| 130 protected: | 119 protected: |
| 131 ReadingListModel(); | 120 ReadingListModel(); |
| 132 virtual ~ReadingListModel(); | 121 virtual ~ReadingListModel(); |
| 133 | 122 |
| 134 // The observers. | 123 // The observers. |
| 135 base::ObserverList<ReadingListModelObserver> observers_; | 124 base::ObserverList<ReadingListModelObserver> observers_; |
| 136 | 125 |
| 137 // Tells model that batch updates have completed. Called from | 126 // Tells model that batch updates have completed. Called from |
| 138 // ReadingListBatchUpdateToken dtor. | 127 // ReadingListBatchUpdateToken dtor. |
| 139 virtual void EndBatchUpdates(); | 128 virtual void EndBatchUpdates(); |
| 140 | 129 |
| 141 // Called when model is entering batch update mode. | 130 // Called when model is entering batch update mode. |
| 142 virtual void EnteringBatchUpdates(); | 131 virtual void EnteringBatchUpdates(); |
| 143 | 132 |
| 144 // Called when model is leaving batch update mode. | 133 // Called when model is leaving batch update mode. |
| 145 virtual void LeavingBatchUpdates(); | 134 virtual void LeavingBatchUpdates(); |
| 146 | 135 |
| 147 private: | 136 private: |
| 148 unsigned int current_batch_updates_count_; | 137 unsigned int current_batch_updates_count_; |
| 149 | 138 |
| 150 DISALLOW_COPY_AND_ASSIGN(ReadingListModel); | 139 DISALLOW_COPY_AND_ASSIGN(ReadingListModel); |
| 151 }; | 140 }; |
| 152 | 141 |
| 153 #endif // COMPONENTS_READING_LIST_IOS_READING_LIST_MODEL_H_ | 142 #endif // COMPONENTS_READING_LIST_IOS_READING_LIST_MODEL_H_ |
| OLD | NEW |