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

Unified Diff: components/offline_pages/core/offline_page_model_impl.cc

Issue 2469933002: Offline Pages: Replace Observer::OfflinePageModelChanged with OfflinePageAdded. (Closed)
Patch Set: nits 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/core/offline_page_model_impl.cc
diff --git a/components/offline_pages/core/offline_page_model_impl.cc b/components/offline_pages/core/offline_page_model_impl.cc
index 32f8213107a614134f35d528905eba5225ce9de0..011dfbe2a1670cf224c0f9d3590e227b9ee7c57f 100644
--- a/components/offline_pages/core/offline_page_model_impl.cc
+++ b/components/offline_pages/core/offline_page_model_impl.cc
@@ -717,6 +717,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;
@@ -739,8 +740,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(
« no previous file with comments | « components/offline_pages/core/offline_page_model.h ('k') | components/offline_pages/core/offline_page_model_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698