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 <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
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 "base/optional.h" | 16 #include "base/optional.h" |
17 #include "base/scoped_observer.h" | 17 #include "base/scoped_observer.h" |
| 18 #include "base/supports_user_data.h" |
18 #include "base/task/cancelable_task_tracker.h" | 19 #include "base/task/cancelable_task_tracker.h" |
19 #include "base/time/time.h" | 20 #include "base/time/time.h" |
20 #include "components/history/core/browser/history_service.h" | 21 #include "components/history/core/browser/history_service.h" |
21 #include "components/history/core/browser/history_service_observer.h" | 22 #include "components/history/core/browser/history_service_observer.h" |
22 #include "components/keyed_service/core/keyed_service.h" | 23 #include "components/keyed_service/core/keyed_service.h" |
23 #include "components/ntp_snippets/callbacks.h" | 24 #include "components/ntp_snippets/callbacks.h" |
24 #include "components/ntp_snippets/category.h" | 25 #include "components/ntp_snippets/category.h" |
25 #include "components/ntp_snippets/category_rankers/category_ranker.h" | 26 #include "components/ntp_snippets/category_rankers/category_ranker.h" |
26 #include "components/ntp_snippets/category_status.h" | 27 #include "components/ntp_snippets/category_status.h" |
27 #include "components/ntp_snippets/content_suggestions_provider.h" | 28 #include "components/ntp_snippets/content_suggestions_provider.h" |
(...skipping 12 matching lines...) Expand all Loading... |
40 struct LargeIconImageResult; | 41 struct LargeIconImageResult; |
41 } // namespace favicon_base | 42 } // namespace favicon_base |
42 | 43 |
43 namespace ntp_snippets { | 44 namespace ntp_snippets { |
44 | 45 |
45 class RemoteSuggestionsProvider; | 46 class RemoteSuggestionsProvider; |
46 | 47 |
47 // Retrieves suggestions from a number of ContentSuggestionsProviders and serves | 48 // Retrieves suggestions from a number of ContentSuggestionsProviders and serves |
48 // them grouped into categories. There can be at most one provider per category. | 49 // them grouped into categories. There can be at most one provider per category. |
49 class ContentSuggestionsService : public KeyedService, | 50 class ContentSuggestionsService : public KeyedService, |
| 51 public base::SupportsUserData, |
50 public ContentSuggestionsProvider::Observer, | 52 public ContentSuggestionsProvider::Observer, |
51 public SigninManagerBase::Observer, | 53 public SigninManagerBase::Observer, |
52 public history::HistoryServiceObserver { | 54 public history::HistoryServiceObserver { |
53 public: | 55 public: |
54 class Observer { | 56 class Observer { |
55 public: | 57 public: |
56 // Fired every time the service receives a new set of data for the given | 58 // Fired every time the service receives a new set of data for the given |
57 // |category|, replacing any previously available data (though in most cases | 59 // |category|, replacing any previously available data (though in most cases |
58 // there will be an overlap and only a few changes within the data). The new | 60 // there will be an overlap and only a few changes within the data). The new |
59 // data is then available through |GetSuggestionsForCategory(category)|. | 61 // data is then available through |GetSuggestionsForCategory(category)|. |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 | 410 |
409 // Provides order for categories. | 411 // Provides order for categories. |
410 std::unique_ptr<CategoryRanker> category_ranker_; | 412 std::unique_ptr<CategoryRanker> category_ranker_; |
411 | 413 |
412 DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsService); | 414 DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsService); |
413 }; | 415 }; |
414 | 416 |
415 } // namespace ntp_snippets | 417 } // namespace ntp_snippets |
416 | 418 |
417 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ | 419 #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_SERVICE_H_ |
OLD | NEW |