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

Unified Diff: ios/chrome/browser/reading_list/reading_list_model_impl.cc

Issue 2362063004: Find reading list entry state in model from url (Closed)
Patch Set: update comment Created 4 years, 3 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/reading_list/reading_list_model_impl.cc
diff --git a/ios/chrome/browser/reading_list/reading_list_model_impl.cc b/ios/chrome/browser/reading_list/reading_list_model_impl.cc
index c3e068d65f0249a30a6ce1c36dbd381cdf56d260..a40f45e59334ef562e26e57ac7a9ece519137221 100644
--- a/ios/chrome/browser/reading_list/reading_list_model_impl.cc
+++ b/ios/chrome/browser/reading_list/reading_list_model_impl.cc
@@ -158,6 +158,20 @@ void ReadingListModelImpl::MarkReadByURL(const GURL& url) {
ReadingListDidApplyChanges(this));
}
+ReadingListModel::EntryState ReadingListModelImpl::EntryPositionByURL(
+ const GURL& url) {
+ ReadingListEntry entry(url, std::string());
+ auto result = std::find(unread_.begin(), unread_.end(), entry);
+ if (result != unread_.end())
+ return UNREAD;
+
+ result = std::find(read_.begin(), read_.end(), entry);
+ if (result != read_.end())
+ return READ;
+
+ return NOTPRESENT;
+}
+
void ReadingListModelImpl::SetEntryTitle(const GURL& url,
const std::string& title) {
DCHECK(loaded());

Powered by Google App Engine
This is Rietveld 408576698