Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_NTP_SNIPPETS_OFFLINE_PAGES_OFFLINE_PAGE_SUGGESTIONS_PROVIDER_ H_ | |
| 6 #define COMPONENTS_NTP_SNIPPETS_OFFLINE_PAGES_OFFLINE_PAGE_SUGGESTIONS_PROVIDER_ H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/callback_forward.h" | |
| 12 #include "components/keyed_service/core/keyed_service.h" | |
| 13 #include "components/ntp_snippets/content_suggestion.h" | |
| 14 #include "components/ntp_snippets/content_suggestions_category.h" | |
| 15 #include "components/ntp_snippets/content_suggestions_category_status.h" | |
| 16 #include "components/ntp_snippets/content_suggestions_provider.h" | |
| 17 #include "components/offline_pages/offline_page_model.h" | |
| 18 #include "components/offline_pages/offline_page_types.h" | |
| 19 | |
| 20 namespace gfx { | |
| 21 class Image; | |
| 22 } | |
| 23 | |
| 24 namespace ntp_snippets { | |
| 25 | |
| 26 // Provides content suggestions from the offline pages model. | |
| 27 // Currently, those are only the pages that the user last navigated to in an | |
| 28 // open tab and offlined bookmarks. | |
| 29 class OfflinePageSuggestionsProvider | |
| 30 : public KeyedService, | |
| 31 public ContentSuggestionsProvider, | |
| 32 public offline_pages::OfflinePageModel::Observer { | |
| 33 public: | |
| 34 OfflinePageSuggestionsProvider( | |
| 35 offline_pages::OfflinePageModel* offline_page_model); | |
| 36 ~OfflinePageSuggestionsProvider() override; | |
| 37 | |
| 38 // Inherited from KeyedService. | |
| 39 void Shutdown() override; | |
| 40 | |
| 41 private: | |
| 42 // ContentSuggestionsProvider implementation | |
| 43 void SetObserver(ContentSuggestionsProvider::Observer* observer) override; | |
| 44 ContentSuggestionsCategoryStatus GetCategoryStatus( | |
| 45 ContentSuggestionsCategory category) override; | |
| 46 void DiscardSuggestion(const std::string& suggestion_id) override; | |
| 47 void FetchSuggestionImage(const std::string& suggestion_id, | |
| 48 const ImageFetchedCallback& callback) override; | |
| 49 void ClearCachedSuggestionsForDebugging() override; | |
| 50 void ClearDiscardedSuggestionsForDebugging() override; | |
| 51 | |
| 52 // OfflinePageModel::Observer implementation | |
| 53 void OfflinePageModelLoaded(offline_pages::OfflinePageModel* model) override; | |
| 54 void OfflinePageModelChanged(offline_pages::OfflinePageModel* model) override; | |
| 55 void OfflinePageDeleted(int64_t offline_id, | |
| 56 const offline_pages::ClientId& client_id) override; | |
| 57 | |
| 58 // Queries the OfflinePageModel for offline pages. | |
| 59 void FetchOfflinePages(); | |
| 60 | |
| 61 // Callback from the OfflinePageModel | |
|
Marc Treib
2016/07/14 14:17:24
Here too: period after comment
Philipp Keck
2016/07/14 15:30:06
Done.
| |
| 62 void OnOfflinePagesLoaded( | |
| 63 const offline_pages::MultipleOfflinePageItemResult& result); | |
| 64 | |
| 65 ContentSuggestionsCategoryStatus category_status_; | |
| 66 | |
| 67 ContentSuggestionsProvider::Observer* observer_; | |
| 68 | |
| 69 offline_pages::OfflinePageModel* offline_page_model_; | |
| 70 | |
| 71 DISALLOW_COPY_AND_ASSIGN(OfflinePageSuggestionsProvider); | |
| 72 }; | |
| 73 | |
| 74 } // namespace ntp_snippets | |
| 75 | |
| 76 #endif // COMPONENTS_NTP_SNIPPETS_OFFLINE_PAGES_OFFLINE_PAGE_SUGGESTIONS_PROVID ER_H_ | |
| OLD | NEW |