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

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

Issue 2342443006: [Offline pages] Use the new policy bits (Closed)
Patch Set: fix download bridge and ntp suggestions to use correct policy controller Created 4 years, 2 months 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_OFFLINE_PAGE_SUGGESTIONS_PROVIDER_ H_ 5 #ifndef COMPONENTS_NTP_SNIPPETS_OFFLINE_PAGES_OFFLINE_PAGE_SUGGESTIONS_PROVIDER_ H_
6 #define COMPONENTS_NTP_SNIPPETS_OFFLINE_PAGES_OFFLINE_PAGE_SUGGESTIONS_PROVIDER_ H_ 6 #define COMPONENTS_NTP_SNIPPETS_OFFLINE_PAGES_OFFLINE_PAGE_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 "components/ntp_snippets/category.h" 13 #include "components/ntp_snippets/category.h"
14 #include "components/ntp_snippets/category_factory.h" 14 #include "components/ntp_snippets/category_factory.h"
15 #include "components/ntp_snippets/category_status.h" 15 #include "components/ntp_snippets/category_status.h"
16 #include "components/ntp_snippets/content_suggestion.h" 16 #include "components/ntp_snippets/content_suggestion.h"
17 #include "components/ntp_snippets/content_suggestions_provider.h" 17 #include "components/ntp_snippets/content_suggestions_provider.h"
18 #include "components/offline_pages/offline_page_model.h" 18 #include "components/offline_pages/offline_page_model.h"
19 #include "components/offline_pages/offline_page_types.h" 19 #include "components/offline_pages/offline_page_types.h"
20 20
21 class PrefRegistrySimple; 21 class PrefRegistrySimple;
22 class PrefService; 22 class PrefService;
23 23
24 namespace gfx { 24 namespace gfx {
25 class Image; 25 class Image;
26 } 26 }
27 27
28 namespace offline_pages {
29 struct ClientId;
30 }
31
28 namespace ntp_snippets { 32 namespace ntp_snippets {
29 33
30 // Provides content suggestions from the offline pages model. 34 // Provides content suggestions from the offline pages model.
31 // Currently, those are only the pages that the user last navigated to in an 35 // Currently, those are only the pages that the user last navigated to in an
32 // open tab and offlined bookmarks. 36 // open tab and offlined bookmarks.
33 class OfflinePageSuggestionsProvider 37 class OfflinePageSuggestionsProvider
34 : public ContentSuggestionsProvider, 38 : public ContentSuggestionsProvider,
35 public offline_pages::OfflinePageModel::Observer { 39 public offline_pages::OfflinePageModel::Observer {
36 public: 40 public:
37 OfflinePageSuggestionsProvider( 41 OfflinePageSuggestionsProvider(
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // for the given |category|. 112 // for the given |category|.
109 std::string GetDismissedPref(Category category) const; 113 std::string GetDismissedPref(Category category) const;
110 114
111 // Reads dismissed IDs for the given |category|. 115 // Reads dismissed IDs for the given |category|.
112 std::set<std::string> ReadDismissedIDsFromPrefs(Category category) const; 116 std::set<std::string> ReadDismissedIDsFromPrefs(Category category) const;
113 117
114 // Writes |dismissed_ids| for the given |category|. 118 // Writes |dismissed_ids| for the given |category|.
115 void StoreDismissedIDsToPrefs(Category category, 119 void StoreDismissedIDsToPrefs(Category category,
116 const std::set<std::string>& dismissed_ids); 120 const std::set<std::string>& dismissed_ids);
117 121
122 // Determine if |client_id| is supported by downloads feature.
123 bool IsDownload(const offline_pages::ClientId& client_id);
124
125 // Determine if |client_id| is supported by recent tabs feature.
126 bool IsRecentTab(const offline_pages::ClientId& client_id);
127
118 CategoryStatus recent_tabs_status_; 128 CategoryStatus recent_tabs_status_;
119 CategoryStatus downloads_status_; 129 CategoryStatus downloads_status_;
120 130
121 offline_pages::OfflinePageModel* offline_page_model_; 131 offline_pages::OfflinePageModel* offline_page_model_;
122 132
123 const Category recent_tabs_category_; 133 const Category recent_tabs_category_;
124 const Category downloads_category_; 134 const Category downloads_category_;
125 135
126 PrefService* pref_service_; 136 PrefService* pref_service_;
127 137
128 // Whether the Download Manager UI is enabled, in which case the More button 138 // Whether the Download Manager UI is enabled, in which case the More button
129 // for the Downloads section can redirect there. 139 // for the Downloads section can redirect there.
130 const bool download_manager_ui_enabled_; 140 const bool download_manager_ui_enabled_;
131 141
132 DISALLOW_COPY_AND_ASSIGN(OfflinePageSuggestionsProvider); 142 DISALLOW_COPY_AND_ASSIGN(OfflinePageSuggestionsProvider);
133 }; 143 };
134 144
135 } // namespace ntp_snippets 145 } // namespace ntp_snippets
136 146
137 #endif // COMPONENTS_NTP_SNIPPETS_OFFLINE_PAGES_OFFLINE_PAGE_SUGGESTIONS_PROVID ER_H_ 147 #endif // COMPONENTS_NTP_SNIPPETS_OFFLINE_PAGES_OFFLINE_PAGE_SUGGESTIONS_PROVID ER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698