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