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

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

Issue 2565753002: Only distill unread items (Closed)
Patch Set: past tense in comments Created 4 years 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_download_service.cc
diff --git a/ios/chrome/browser/reading_list/reading_list_download_service.cc b/ios/chrome/browser/reading_list/reading_list_download_service.cc
index dd0d1521a48a2dc49f2580b4e4883ae6ea08a8bb..24cdc66d2bb97293ef7fd6e45e998e02fc5accf3 100644
--- a/ios/chrome/browser/reading_list/reading_list_download_service.cc
+++ b/ios/chrome/browser/reading_list/reading_list_download_service.cc
@@ -84,7 +84,23 @@ void ReadingListDownloadService::ReadingListDidAddEntry(
const ReadingListModel* model,
const GURL& url) {
DCHECK_EQ(reading_list_model_, model);
- ScheduleDownloadEntry(url);
+ ProcessNewEntry(url);
+}
+
+void ReadingListDownloadService::ReadingListDidMoveEntry(
+ const ReadingListModel* model,
+ const GURL& url) {
+ DCHECK_EQ(reading_list_model_, model);
+ ProcessNewEntry(url);
+}
+
+void ReadingListDownloadService::ProcessNewEntry(const GURL& url) {
+ const ReadingListEntry* entry = reading_list_model_->GetEntryByURL(url);
+ if (!entry || entry->IsRead()) {
+ url_downloader_->CancelDownloadOfflineURL(url);
+ } else {
+ ScheduleDownloadEntry(url);
+ }
}
void ReadingListDownloadService::DownloadAllEntries() {
@@ -98,7 +114,7 @@ void ReadingListDownloadService::ScheduleDownloadEntry(const GURL& url) {
DCHECK(reading_list_model_->loaded());
const ReadingListEntry* entry = reading_list_model_->GetEntryByURL(url);
if (!entry || entry->DistilledState() == ReadingListEntry::ERROR ||
- entry->DistilledState() == ReadingListEntry::PROCESSED)
+ entry->DistilledState() == ReadingListEntry::PROCESSED || entry->IsRead())
return;
GURL local_url(url);
web::WebThread::PostDelayedTask(
@@ -112,7 +128,7 @@ void ReadingListDownloadService::DownloadEntry(const GURL& url) {
DCHECK(reading_list_model_->loaded());
const ReadingListEntry* entry = reading_list_model_->GetEntryByURL(url);
if (!entry || entry->DistilledState() == ReadingListEntry::ERROR ||
- entry->DistilledState() == ReadingListEntry::PROCESSED)
+ entry->DistilledState() == ReadingListEntry::PROCESSED || entry->IsRead())
return;
if (net::NetworkChangeNotifier::IsOffline()) {
« no previous file with comments | « ios/chrome/browser/reading_list/reading_list_download_service.h ('k') | ios/chrome/browser/reading_list/url_downloader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698