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

Unified Diff: components/offline_pages/offline_page_model.cc

Issue 1471453003: Remove offline copy when the URL of a bookmark is changed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch to land Created 5 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
« no previous file with comments | « components/offline_pages/offline_page_model.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/offline_pages/offline_page_model.cc
diff --git a/components/offline_pages/offline_page_model.cc b/components/offline_pages/offline_page_model.cc
index 14530042f5f892a163c81d0294aa9559f27111c5..906df2e19fb67637a7f217d0611ae47a43eac9e4 100644
--- a/components/offline_pages/offline_page_model.cc
+++ b/components/offline_pages/offline_page_model.cc
@@ -472,6 +472,16 @@ void OfflinePageModel::BookmarkNodeRemoved(
MarkPageForDeletion(node->id(), base::Bind(&EmptyDeleteCallback));
}
+void OfflinePageModel::BookmarkNodeChanged(
+ bookmarks::BookmarkModel* model,
+ const bookmarks::BookmarkNode* node) {
+ // BookmarkNodeChanged could be triggered if title or URL gets changed. If
+ // the latter, we need to invalidate the offline copy.
+ DCHECK(offline_pages_.count(node->id()) > 0);
+ if (offline_pages_[node->id()].url != node->url())
+ DeletePageByBookmarkId(node->id(), DeletePageCallback());
+}
+
void OfflinePageModel::OnEnsureArchivesDirCreatedDone() {
store_->Load(base::Bind(&OfflinePageModel::OnLoadDone,
weak_ptr_factory_.GetWeakPtr()));
« no previous file with comments | « components/offline_pages/offline_page_model.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698