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

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: Addressing comments + tests 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..61abcbce50f9bcdcefa805f0a3f3bfd374cfaac4 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::EntryStateByURL(
+ 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 NOT_PRESENT;
+}
+
void ReadingListModelImpl::SetEntryTitle(const GURL& url,
const std::string& title) {
DCHECK(loaded());

Powered by Google App Engine
This is Rietveld 408576698