| 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/callback.h" |
| 13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 14 #include "ios/chrome/browser/reading_list/reading_list_entry.h" | 14 #include "ios/chrome/browser/reading_list/reading_list_entry.h" |
| 15 #include "ios/chrome/browser/reading_list/reading_list_model_observer.h" | 15 #include "ios/chrome/browser/reading_list/reading_list_model_observer.h" |
| 16 | 16 |
| 17 class GURL; | 17 class GURL; |
| 18 class ReadingListModel; | 18 class ReadingListModel; |
| 19 class ReadingListStore; |
| 19 | 20 |
| 20 namespace ios { | 21 namespace ios { |
| 21 class ChromeBrowserState; | 22 class ChromeBrowserState; |
| 22 } | 23 } |
| 23 | 24 |
| 25 namespace syncer { |
| 26 class SyncableService; |
| 27 } |
| 28 |
| 24 // The reading list model contains two list of entries: one of unread urls, the | 29 // The reading list model contains two list of entries: one of unread urls, the |
| 25 // other of read ones. This object should only be accessed from one thread | 30 // other of read ones. This object should only be accessed from one thread |
| 26 // (Usually the main thread). The observers callbacks are also sent on the main | 31 // (Usually the main thread). The observers callbacks are also sent on the main |
| 27 // thread. | 32 // thread. |
| 28 class ReadingListModel { | 33 class ReadingListModel { |
| 29 public: | 34 public: |
| 30 class ScopedReadingListBatchUpdate; | 35 class ScopedReadingListBatchUpdate; |
| 31 // Returns true if the model finished loading. Until this returns true the | 36 // Returns true if the model finished loading. Until this returns true the |
| 32 // reading list is not ready for use. | 37 // reading list is not ready for use. |
| 33 virtual bool loaded() const = 0; | 38 virtual bool loaded() const = 0; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 ReadingListModel(); | 116 ReadingListModel(); |
| 112 virtual ~ReadingListModel(); | 117 virtual ~ReadingListModel(); |
| 113 | 118 |
| 114 // The observers. | 119 // The observers. |
| 115 base::ObserverList<ReadingListModelObserver> observers_; | 120 base::ObserverList<ReadingListModelObserver> observers_; |
| 116 | 121 |
| 117 // Tells model that batch updates have completed. Called from | 122 // Tells model that batch updates have completed. Called from |
| 118 // ReadingListBatchUpdateToken dtor. | 123 // ReadingListBatchUpdateToken dtor. |
| 119 virtual void EndBatchUpdates(); | 124 virtual void EndBatchUpdates(); |
| 120 | 125 |
| 126 // Called when model is entering batch update mode. |
| 127 virtual void EnteringBatchUpdates(); |
| 128 |
| 129 // Called when model is leaving batch update mode. |
| 130 virtual void LeavingBatchUpdates(); |
| 131 |
| 121 private: | 132 private: |
| 122 unsigned int current_batch_updates_count_; | 133 unsigned int current_batch_updates_count_; |
| 123 | 134 |
| 124 DISALLOW_COPY_AND_ASSIGN(ReadingListModel); | 135 DISALLOW_COPY_AND_ASSIGN(ReadingListModel); |
| 125 }; | 136 }; |
| 126 | 137 |
| 127 #endif // IOS_CHROME_BROWSER_READING_LIST_READING_LIST_MODEL_H_ | 138 #endif // IOS_CHROME_BROWSER_READING_LIST_READING_LIST_MODEL_H_ |
| OLD | NEW |