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

Unified Diff: ios/chrome/browser/ui/reading_list/reading_list_data_source.h

Issue 2879183002: Move the ReadingListModel in a Mediator (Closed)
Patch Set: Address comment Created 3 years, 7 months 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/reading_list/reading_list_data_source.h
diff --git a/ios/chrome/browser/ui/reading_list/reading_list_data_source.h b/ios/chrome/browser/ui/reading_list/reading_list_data_source.h
new file mode 100644
index 0000000000000000000000000000000000000000..0d052e7dadf56b220cb9f820b0232d980a38ffbc
--- /dev/null
+++ b/ios/chrome/browser/ui/reading_list/reading_list_data_source.h
@@ -0,0 +1,50 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_CHROME_BROWSER_UI_READING_LIST_READING_LIST_DATA_SOURCE_H_
+#define IOS_CHROME_BROWSER_UI_READING_LIST_READING_LIST_DATA_SOURCE_H_
+
+#include <memory>
+
+// TODO(crbug.com/721758): Batch updates should be done in the mediator.
+#include "components/reading_list/core/reading_list_model.h"
+
+class GURL;
+class ReadingListEntry;
+@protocol ReadingListDataSink;
+
+// Data Source for the Reading List UI, providing the data sink with the data to
+// be displayed. Handle the interactions with the model.
+@protocol ReadingListDataSource
+
+// The data sink associated with this data source.
+@property(nonatomic, weak, nullable) id<ReadingListDataSink> dataSink;
+// Whether the data source is ready to be used.
+- (BOOL)ready;
+// Whether the data source has some elements.
+- (BOOL)hasElements;
+// Whether the data source has some read elements.
+- (BOOL)hasRead;
+
+// Mark all entries as seen and stop sending updates to the data sink.
+- (void)dataSinkWillBeDismissed;
+
+// Set the read status of the entry identified with |URL|.
+- (void)setReadStatus:(BOOL)read forURL:(const GURL&)URL;
+
+// Removes the entry associated with |URL|.
+- (void)removeEntryWithURL:(const GURL&)URL;
+
+// TODO(crbug.com/721758): Return ReadingListItem directly.
+- (const std::vector<GURL>)keys;
+- (const ReadingListEntry* _Nullable)entryWithURL:(const GURL&)URL;
+
+// TODO(crbug.com/721758): Batch updates should be done in the mediator.
+- (std::unique_ptr<ReadingListModel::ScopedReadingListBatchUpdate>)
+ beginBatchUpdates;
+- (BOOL)isPerformingBatchUpdates;
+
+@end
+
+#endif // IOS_CHROME_BROWSER_UI_READING_LIST_READING_LIST_DATA_SOURCE_H_

Powered by Google App Engine
This is Rietveld 408576698