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

Side by Side Diff: components/ntp_snippets/content_suggestions_service.h

Issue 2581163004: [NTP::SectionOrder] Propagate new order through ContentSuggestionsService. (Closed)
Patch Set: tschumann@ comments. 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_CONTENT_SUGGESTIONS_SERVICE_H_ 5 #ifndef COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_
6 #define COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ 6 #define COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 std::unique_ptr<CategoryRanker> category_ranker); 93 std::unique_ptr<CategoryRanker> category_ranker);
94 ~ContentSuggestionsService() override; 94 ~ContentSuggestionsService() override;
95 95
96 // Inherited from KeyedService. 96 // Inherited from KeyedService.
97 void Shutdown() override; 97 void Shutdown() override;
98 98
99 static void RegisterProfilePrefs(PrefRegistrySimple* registry); 99 static void RegisterProfilePrefs(PrefRegistrySimple* registry);
100 100
101 State state() { return state_; } 101 State state() { return state_; }
102 102
103 // Gets all categories for which a provider is registered. The categories 103 // Gets all categories for which a provider is registered. The categories may
104 // may or may not be available, see |GetCategoryStatus()|. 104 // or may not be available, see |GetCategoryStatus()|. The order in which the
105 const std::vector<Category>& GetCategories() const { return categories_; } 105 // categories are returned is the order in which they should be displayed.
106 const std::vector<Category>& GetCategories();
Marc Treib 2016/12/19 13:22:46 Hm, it's a bit unfortunate that this can't be cons
vitaliii 2016/12/19 15:28:59 Done.
106 107
107 // Gets the status of a category. 108 // Gets the status of a category.
108 CategoryStatus GetCategoryStatus(Category category) const; 109 CategoryStatus GetCategoryStatus(Category category) const;
109 110
110 // Gets the meta information of a category. 111 // Gets the meta information of a category.
111 base::Optional<CategoryInfo> GetCategoryInfo(Category category) const; 112 base::Optional<CategoryInfo> GetCategoryInfo(Category category) const;
112 113
113 // Gets the available suggestions for a category. The result is empty if the 114 // Gets the available suggestions for a category. The result is empty if the
114 // category is available and empty, but also if the category is unavailable 115 // category is available and empty, but also if the category is unavailable
115 // for any reason, see |GetCategoryStatus()|. 116 // for any reason, see |GetCategoryStatus()|.
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 std::map<Category, ContentSuggestionsProvider*, Category::CompareByID> 278 std::map<Category, ContentSuggestionsProvider*, Category::CompareByID>
278 providers_by_category_; 279 providers_by_category_;
279 280
280 // All dismissed categories and their providers. These may be restored by 281 // All dismissed categories and their providers. These may be restored by
281 // RestoreDismissedCategories(). The provider can be null if the dismissed 282 // RestoreDismissedCategories(). The provider can be null if the dismissed
282 // category has received no updates since initialisation. 283 // category has received no updates since initialisation.
283 // (see RestoreDismissedCategoriesFromPrefs()) 284 // (see RestoreDismissedCategoriesFromPrefs())
284 std::map<Category, ContentSuggestionsProvider*, Category::CompareByID> 285 std::map<Category, ContentSuggestionsProvider*, Category::CompareByID>
285 dismissed_providers_by_category_; 286 dismissed_providers_by_category_;
286 287
287 // All current suggestion categories, in an order determined by the 288 // All current suggestion categories in undefined order. This vector contains
288 // |category_factory_|. This vector contains exactly the same categories as 289 // exactly the same categories as |providers_by_category_|.
289 // |providers_by_category_|.
290 std::vector<Category> categories_; 290 std::vector<Category> categories_;
291 291
292 // All current suggestions grouped by category. This contains an entry for 292 // All current suggestions grouped by category. This contains an entry for
293 // every category in |categories_| whose status is an available status. It may 293 // every category in |categories_| whose status is an available status. It may
294 // contain an empty vector if the category is available but empty (or still 294 // contain an empty vector if the category is available but empty (or still
295 // loading). 295 // loading).
296 std::map<Category, std::vector<ContentSuggestion>, Category::CompareByID> 296 std::map<Category, std::vector<ContentSuggestion>, Category::CompareByID>
297 suggestions_by_category_; 297 suggestions_by_category_;
298 298
299 // Observer for the SigninManager. All observers are notified when the signin 299 // Observer for the SigninManager. All observers are notified when the signin
(...skipping 22 matching lines...) Expand all
322 322
323 // Provides order for categories. 323 // Provides order for categories.
324 std::unique_ptr<CategoryRanker> category_ranker_; 324 std::unique_ptr<CategoryRanker> category_ranker_;
325 325
326 DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsService); 326 DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsService);
327 }; 327 };
328 328
329 } // namespace ntp_snippets 329 } // namespace ntp_snippets
330 330
331 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ 331 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698