OLD | NEW |
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 <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/callback_forward.h" | 14 #include "base/callback_forward.h" |
15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
16 #include "components/keyed_service/core/keyed_service.h" | 16 #include "components/keyed_service/core/keyed_service.h" |
17 #include "components/ntp_snippets/content_suggestions_category_status.h" | 17 #include "components/ntp_snippets/content_suggestions_category_status.h" |
18 #include "components/ntp_snippets/content_suggestions_provider.h" | 18 #include "components/ntp_snippets/content_suggestions_provider.h" |
19 | 19 |
20 namespace gfx { | 20 namespace gfx { |
21 class Image; | 21 class Image; |
22 } | 22 } |
23 | 23 |
24 namespace ntp_snippets { | 24 namespace ntp_snippets { |
25 | 25 |
26 // Retrieves suggestions from a number of ContentSuggestionsProviders and serves | 26 // Retrieves suggestions from a number of ContentSuggestionsProviders and serves |
27 // them grouped into categories. There can be at most one provider per category. | 27 // them grouped into categories. There can be at most one provider per category. |
28 // NOTE: This class is not yet in use, please use NTPSnippetsService for now | |
29 // (see ntp_snippets_service.h). | |
30 class ContentSuggestionsService : public KeyedService, | 28 class ContentSuggestionsService : public KeyedService, |
31 public ContentSuggestionsProvider::Observer { | 29 public ContentSuggestionsProvider::Observer { |
32 public: | 30 public: |
33 using ImageFetchedCallback = | 31 using ImageFetchedCallback = |
34 base::Callback<void(const std::string& suggestion_id, const gfx::Image&)>; | 32 base::Callback<void(const std::string& suggestion_id, const gfx::Image&)>; |
35 | 33 |
36 class Observer { | 34 class Observer { |
37 public: | 35 public: |
38 // Fired every time the service receives a new set of data, replacing any | 36 // Fired every time the service receives a new set of data, replacing any |
39 // previously available data (though in most cases there will be an overlap | 37 // previously available data (though in most cases there will be an overlap |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 base::ObserverList<Observer> observers_; | 165 base::ObserverList<Observer> observers_; |
168 | 166 |
169 const std::vector<ContentSuggestion> no_suggestions_; | 167 const std::vector<ContentSuggestion> no_suggestions_; |
170 | 168 |
171 DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsService); | 169 DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsService); |
172 }; | 170 }; |
173 | 171 |
174 } // namespace ntp_snippets | 172 } // namespace ntp_snippets |
175 | 173 |
176 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ | 174 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ |
OLD | NEW |