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

Side by Side Diff: components/ntp_snippets/offline_pages/recent_tab_suggestions_provider.h

Issue 2568033005: [NTP::SectionOrder] Replace CategoryFactory with a category ranker. (Closed)
Patch Set: download provider tests. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_NTP_SNIPPETS_OFFLINE_PAGES_RECENT_TAB_SUGGESTIONS_PROVIDER_H_ 5 #ifndef COMPONENTS_NTP_SNIPPETS_OFFLINE_PAGES_RECENT_TAB_SUGGESTIONS_PROVIDER_H_
6 #define COMPONENTS_NTP_SNIPPETS_OFFLINE_PAGES_RECENT_TAB_SUGGESTIONS_PROVIDER_H_ 6 #define COMPONENTS_NTP_SNIPPETS_OFFLINE_PAGES_RECENT_TAB_SUGGESTIONS_PROVIDER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/callback_forward.h" 12 #include "base/callback_forward.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/time/time.h" 15 #include "base/time/time.h"
16 #include "components/ntp_snippets/category.h" 16 #include "components/ntp_snippets/category.h"
17 #include "components/ntp_snippets/category_factory.h"
18 #include "components/ntp_snippets/category_status.h" 17 #include "components/ntp_snippets/category_status.h"
19 #include "components/ntp_snippets/content_suggestion.h" 18 #include "components/ntp_snippets/content_suggestion.h"
20 #include "components/ntp_snippets/content_suggestions_provider.h" 19 #include "components/ntp_snippets/content_suggestions_provider.h"
21 #include "components/offline_pages/core/offline_page_model.h" 20 #include "components/offline_pages/core/offline_page_model.h"
22 21
23 class PrefRegistrySimple; 22 class PrefRegistrySimple;
24 class PrefService; 23 class PrefService;
25 24
26 namespace ntp_snippets { 25 namespace ntp_snippets {
27 26
28 // Provides recent tabs content suggestions from the offline pages model 27 // Provides recent tabs content suggestions from the offline pages model
29 // obtaining the data through OfflinePageProxy. 28 // obtaining the data through OfflinePageProxy.
30 class RecentTabSuggestionsProvider 29 class RecentTabSuggestionsProvider
31 : public ContentSuggestionsProvider, 30 : public ContentSuggestionsProvider,
32 public offline_pages::OfflinePageModel::Observer { 31 public offline_pages::OfflinePageModel::Observer {
33 public: 32 public:
34 RecentTabSuggestionsProvider( 33 RecentTabSuggestionsProvider(
35 ContentSuggestionsProvider::Observer* observer, 34 ContentSuggestionsProvider::Observer* observer,
36 CategoryFactory* category_factory,
37 offline_pages::OfflinePageModel* offline_page_model, 35 offline_pages::OfflinePageModel* offline_page_model,
38 PrefService* pref_service); 36 PrefService* pref_service);
39 ~RecentTabSuggestionsProvider() override; 37 ~RecentTabSuggestionsProvider() override;
40 38
41 // ContentSuggestionsProvider implementation. 39 // ContentSuggestionsProvider implementation.
42 CategoryStatus GetCategoryStatus(Category category) override; 40 CategoryStatus GetCategoryStatus(Category category) override;
43 CategoryInfo GetCategoryInfo(Category category) override; 41 CategoryInfo GetCategoryInfo(Category category) override;
44 void DismissSuggestion(const ContentSuggestion::ID& suggestion_id) override; 42 void DismissSuggestion(const ContentSuggestion::ID& suggestion_id) override;
45 void FetchSuggestionImage(const ContentSuggestion::ID& suggestion_id, 43 void FetchSuggestionImage(const ContentSuggestion::ID& suggestion_id,
46 const ImageFetchedCallback& callback) override; 44 const ImageFetchedCallback& callback) override;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 PrefService* pref_service_; 113 PrefService* pref_service_;
116 114
117 base::WeakPtrFactory<RecentTabSuggestionsProvider> weak_ptr_factory_; 115 base::WeakPtrFactory<RecentTabSuggestionsProvider> weak_ptr_factory_;
118 116
119 DISALLOW_COPY_AND_ASSIGN(RecentTabSuggestionsProvider); 117 DISALLOW_COPY_AND_ASSIGN(RecentTabSuggestionsProvider);
120 }; 118 };
121 119
122 } // namespace ntp_snippets 120 } // namespace ntp_snippets
123 121
124 #endif // COMPONENTS_NTP_SNIPPETS_OFFLINE_PAGES_RECENT_TAB_SUGGESTIONS_PROVIDER _H_ 122 #endif // COMPONENTS_NTP_SNIPPETS_OFFLINE_PAGES_RECENT_TAB_SUGGESTIONS_PROVIDER _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698