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

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

Issue 2230473002: Refactor and extend SnippetsBridge for multi-section support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@categoryinfo
Patch Set: Michael's nits and renamings Created 4 years, 4 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_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 <string> 10 #include <string>
(...skipping 18 matching lines...) Expand all
29 // Retrieves suggestions from a number of ContentSuggestionsProviders and serves 29 // Retrieves suggestions from a number of ContentSuggestionsProviders and serves
30 // them grouped into categories. There can be at most one provider per category. 30 // them grouped into categories. There can be at most one provider per category.
31 class ContentSuggestionsService : public KeyedService, 31 class ContentSuggestionsService : public KeyedService,
32 public ContentSuggestionsProvider::Observer { 32 public ContentSuggestionsProvider::Observer {
33 public: 33 public:
34 using ImageFetchedCallback = 34 using ImageFetchedCallback =
35 base::Callback<void(const std::string& suggestion_id, const gfx::Image&)>; 35 base::Callback<void(const std::string& suggestion_id, const gfx::Image&)>;
36 36
37 class Observer { 37 class Observer {
38 public: 38 public:
39 // Fired every time the service receives a new set of data, replacing any 39 // Fired every time the service receives a new set of data for the given
40 // previously available data (though in most cases there will be an overlap 40 // |category|, replacing any previously available data (though in most cases
41 // and only a few changes within the data). The new data is then available 41 // there will be an overlap and only a few changes within the data). The new
42 // through the getters of the service. 42 // data is then available through |GetSuggestionsForCategory(category)|.
43 virtual void OnNewSuggestions() = 0; 43 virtual void OnNewSuggestions(Category category) = 0;
44 44
45 // Fired when the status of a suggestions category changed. When the status 45 // Fired when the status of a suggestions category changed. When the status
46 // changes to an unavailable status, the suggestions of the respective 46 // changes to an unavailable status, the suggestions of the respective
47 // category have been invalidated, which means that they must no longer be 47 // category have been invalidated, which means that they must no longer be
48 // displayed to the user. The UI must immediately clear any suggestions of 48 // displayed to the user. The UI must immediately clear any suggestions of
49 // that category. 49 // that category.
50 virtual void OnCategoryStatusChanged(Category category, 50 virtual void OnCategoryStatusChanged(Category category,
51 CategoryStatus new_status) = 0; 51 CategoryStatus new_status) = 0;
52 52
53 // Sent when the service is shutting down. After the service has shut down, 53 // Sent when the service is shutting down. After the service has shut down,
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 // background fetching and debugging calls to it. If the NTPSnippetsService is 211 // background fetching and debugging calls to it. If the NTPSnippetsService is
212 // loaded, it is also present in |providers_|, otherwise this is a nullptr. 212 // loaded, it is also present in |providers_|, otherwise this is a nullptr.
213 NTPSnippetsService* ntp_snippets_service_; 213 NTPSnippetsService* ntp_snippets_service_;
214 214
215 DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsService); 215 DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsService);
216 }; 216 };
217 217
218 } // namespace ntp_snippets 218 } // namespace ntp_snippets
219 219
220 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ 220 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698