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

Unified Diff: components/offline_pages/offline_page_model_impl.cc

Issue 2469933002: Offline Pages: Replace Observer::OfflinePageModelChanged with OfflinePageAdded. (Closed)
Patch Set: Rebase. 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: components/offline_pages/offline_page_model_impl.cc
diff --git a/components/offline_pages/offline_page_model_impl.cc b/components/offline_pages/offline_page_model_impl.cc
index b026304f41c633487a3eaaedd5c426585d38541a..548d6bd9bc813f41bfb682538358f348420ff974 100644
--- a/components/offline_pages/offline_page_model_impl.cc
+++ b/components/offline_pages/offline_page_model_impl.cc
@@ -719,6 +719,7 @@ void OfflinePageModelImpl::OnAddOfflinePageDone(
const OfflinePageItem& offline_page,
ItemActionStatus status) {
SavePageResult result;
+
if (status == ItemActionStatus::SUCCESS) {
offline_pages_[offline_page.offline_id] = offline_page;
result = SavePageResult::SUCCESS;
@@ -741,8 +742,13 @@ void OfflinePageModelImpl::OnAddOfflinePageDone(
}
DeletePendingArchiver(archiver);
+
+ // We don't want to notify observers if the add failed.
+ if (result != SavePageResult::SUCCESS)
+ return;
+
for (Observer& observer : observers_)
- observer.OfflinePageModelChanged(this);
+ observer.OfflinePageAdded(this, offline_page);
}
void OfflinePageModelImpl::OnMarkPageAccesseDone(

Powered by Google App Engine
This is Rietveld 408576698