Chromium Code Reviews| Index: components/offline_pages/offline_page_model_impl.h |
| diff --git a/components/offline_pages/offline_page_model_impl.h b/components/offline_pages/offline_page_model_impl.h |
| index b93a227ebf40a5f09029fd8ffdbd3921eae29da0..86a24210a09ea8c7e90c8cd3d1c30c6e7b4319f9 100644 |
| --- a/components/offline_pages/offline_page_model_impl.h |
| +++ b/components/offline_pages/offline_page_model_impl.h |
| @@ -23,6 +23,8 @@ |
| #include "base/memory/weak_ptr.h" |
| #include "base/observer_list.h" |
| #include "base/optional.h" |
| +#include "components/bookmarks/browser/bookmark_model.h" |
| +#include "components/bookmarks/browser/bookmark_model_observer.h" |
| #include "components/keyed_service/core/keyed_service.h" |
| #include "components/offline_pages/offline_page_archiver.h" |
| #include "components/offline_pages/offline_page_metadata_store.h" |
| @@ -39,6 +41,10 @@ class TimeDelta; |
| class TimeTicks; |
| } // namespace base |
| +namespace bookmarks { |
| +class BookmarkNode; |
| +} |
| + |
| namespace offline_pages { |
| static const int64_t kInvalidOfflineId = 0; |
| @@ -53,7 +59,9 @@ class OfflinePageStorageManager; |
| // Implementation of service for saving pages offline, storing the offline |
| // copy and metadata, and retrieving them upon request. |
| -class OfflinePageModelImpl : public OfflinePageModel, public KeyedService { |
| +class OfflinePageModelImpl : public OfflinePageModel, |
| + public KeyedService, |
| + public bookmarks::BookmarkModelObserver { |
|
Dmitry Titov
2016/08/01 23:46:58
If you use BaseBookmarkModelObserver as base class
|
| public: |
| // All blocking calls/disk access will happen on the provided |task_runner|. |
| OfflinePageModelImpl( |
| @@ -62,6 +70,34 @@ class OfflinePageModelImpl : public OfflinePageModel, public KeyedService { |
| const scoped_refptr<base::SequencedTaskRunner>& task_runner); |
| ~OfflinePageModelImpl() override; |
| + // Implemented bookmarks::bookmarks::bookmarks::BookmarkModelObserver: |
| + void BookmarkModelLoaded(bookmarks::BookmarkModel* model, |
| + bool ids_reassigned) override {} |
| + void BookmarkNodeMoved(bookmarks::BookmarkModel* model, |
| + const bookmarks::BookmarkNode* old_parent, |
| + int old_index, |
| + const bookmarks::BookmarkNode* new_parent, |
| + int new_index) override {} |
| + void BookmarkNodeAdded(bookmarks::BookmarkModel* model, |
| + const bookmarks::BookmarkNode* parent, |
| + int index) override {} |
| + void BookmarkNodeRemoved(bookmarks::BookmarkModel* model, |
| + const bookmarks::BookmarkNode* parent, |
| + int old_index, |
| + const bookmarks::BookmarkNode* node, |
| + const std::set<GURL>& no_longer_bookmarked) override; |
| + void BookmarkNodeChanged(bookmarks::BookmarkModel* model, |
| + const bookmarks::BookmarkNode* node) override {} |
| + void BookmarkNodeFaviconChanged( |
| + bookmarks::BookmarkModel* model, |
| + const bookmarks::BookmarkNode* node) override {} |
| + void BookmarkNodeChildrenReordered( |
| + bookmarks::BookmarkModel* model, |
| + const bookmarks::BookmarkNode* node) override {} |
| + void BookmarkAllUserNodesRemoved( |
| + bookmarks::BookmarkModel* model, |
| + const std::set<GURL>& removed_urls) override {} |
| + |
| // Implemented methods: |
| void AddObserver(Observer* observer) override; |
| void RemoveObserver(Observer* observer) override; |
| @@ -264,6 +300,10 @@ class OfflinePageModelImpl : public OfflinePageModel, public KeyedService { |
| // Post task to clear storage. |
| void PostClearStorageIfNeededTask(); |
| + // Expire associate pages when a bookmark gets deleted. |
| + void ExpireRemovedBookmarkPages(const std::vector<int64_t>& offline_ids); |
| + void OnRemovedBookmarkPagesExpired(bool result); |
| + |
| void RunWhenLoaded(const base::Closure& job); |
| // Persistent store for offline page metadata. |