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

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

Issue 2525663002: Refactor Reading List Model to use URL as key. (Closed)
Patch Set: format Created 4 years, 1 month 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 fcd385128e65480e6f957abe59b51327a6e11042..e7e0ce69c65bc3dd4262f95c32519a8b86608aef 100644
--- a/ios/chrome/browser/reading_list/reading_list_download_service.cc
+++ b/ios/chrome/browser/reading_list/reading_list_download_service.cc
@@ -58,28 +58,16 @@ void ReadingListDownloadService::ReadingListModelLoaded(
DownloadAllEntries();
}
-void ReadingListDownloadService::ReadingListWillRemoveReadEntry(
+void ReadingListDownloadService::ReadingListWillRemoveEntry(
const ReadingListModel* model,
- size_t index) {
+ const GURL& url) {
DCHECK_EQ(reading_list_model_, model);
- RemoveDownloadedEntry(model->GetReadEntryAtIndex(index));
+ const ReadingListEntry* entry = model->GetEntryFromURL(url);
+ DCHECK(entry);
+ RemoveDownloadedEntry(*entry);
}
-void ReadingListDownloadService::ReadingListWillRemoveUnreadEntry(
- const ReadingListModel* model,
- size_t index) {
- DCHECK_EQ(reading_list_model_, model);
- RemoveDownloadedEntry(model->GetUnreadEntryAtIndex(index));
-}
-
-void ReadingListDownloadService::ReadingListWillAddUnreadEntry(
- const ReadingListModel* model,
- const ReadingListEntry& entry) {
- DCHECK_EQ(reading_list_model_, model);
- ScheduleDownloadEntry(entry);
-}
-
-void ReadingListDownloadService::ReadingListWillAddReadEntry(
+void ReadingListDownloadService::ReadingListWillAddEntry(
const ReadingListModel* model,
const ReadingListEntry& entry) {
DCHECK_EQ(reading_list_model_, model);
@@ -90,14 +78,15 @@ void ReadingListDownloadService::DownloadAllEntries() {
DCHECK(reading_list_model_->loaded());
size_t size = reading_list_model_->unread_size();
for (size_t i = 0; i < size; i++) {
- const ReadingListEntry& entry =
- reading_list_model_->GetUnreadEntryAtIndex(i);
- this->ScheduleDownloadEntry(entry);
+ const ReadingListEntry* entry = reading_list_model_->GetUnreadEntryAt(i);
+ DCHECK(entry);
+ this->ScheduleDownloadEntry(*entry);
}
size = reading_list_model_->read_size();
for (size_t i = 0; i < size; i++) {
- const ReadingListEntry& entry = reading_list_model_->GetReadEntryAtIndex(i);
- this->ScheduleDownloadEntry(entry);
+ const ReadingListEntry* entry = reading_list_model_->GetReadEntryAt(i);
+ DCHECK(entry);
+ this->ScheduleDownloadEntry(*entry);
}
}

Powered by Google App Engine
This is Rietveld 408576698