| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_NTP_SNIPPETS_SERVICE_H_ | 5 #ifndef COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_ |
| 6 #define COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_ | 6 #define COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
| 18 #include "base/sequenced_task_runner.h" | 18 #include "base/sequenced_task_runner.h" |
| 19 #include "base/timer/timer.h" | 19 #include "base/timer/timer.h" |
| 20 #include "components/keyed_service/core/keyed_service.h" | 20 #include "components/keyed_service/core/keyed_service.h" |
| 21 #include "components/ntp_snippets/ntp_snippet.h" | 21 #include "components/ntp_snippets/ntp_snippet.h" |
| 22 #include "components/ntp_snippets/ntp_snippets_fetcher.h" | 22 #include "components/ntp_snippets/ntp_snippets_fetcher.h" |
| 23 #include "components/ntp_snippets/ntp_snippets_scheduler.h" | 23 #include "components/ntp_snippets/ntp_snippets_scheduler.h" |
| 24 #include "components/suggestions/suggestions_service.h" | 24 #include "components/suggestions/suggestions_service.h" |
| 25 | 25 |
| 26 class PrefRegistrySimple; | 26 class PrefRegistrySimple; |
| 27 class PrefService; | 27 class PrefService; |
| 28 class SkBitmap; | |
| 29 | 28 |
| 30 namespace base { | 29 namespace base { |
| 31 class Value; | 30 class Value; |
| 32 } | 31 } |
| 33 | 32 |
| 33 namespace gfx { |
| 34 class Image; |
| 35 } |
| 36 |
| 34 namespace image_fetcher { | 37 namespace image_fetcher { |
| 35 class ImageFetcher; | 38 class ImageFetcher; |
| 36 } | 39 } |
| 37 | 40 |
| 38 namespace suggestions { | 41 namespace suggestions { |
| 39 class SuggestionsProfile; | 42 class SuggestionsProfile; |
| 40 } | 43 } |
| 41 | 44 |
| 42 namespace ntp_snippets { | 45 namespace ntp_snippets { |
| 43 | 46 |
| 44 class NTPSnippetsServiceObserver; | 47 class NTPSnippetsServiceObserver; |
| 45 | 48 |
| 46 // Stores and vends fresh content data for the NTP. | 49 // Stores and vends fresh content data for the NTP. |
| 47 class NTPSnippetsService : public KeyedService { | 50 class NTPSnippetsService : public KeyedService { |
| 48 public: | 51 public: |
| 49 using ImageFetchedCallback = | 52 using ImageFetchedCallback = |
| 50 base::Callback<void(const std::string& snippet_id, const SkBitmap*)>; | 53 base::Callback<void(const std::string& snippet_id, const gfx::Image&)>; |
| 51 | 54 |
| 52 // |application_language_code| should be a ISO 639-1 compliant string, e.g. | 55 // |application_language_code| should be a ISO 639-1 compliant string, e.g. |
| 53 // 'en' or 'en-US'. Note that this code should only specify the language, not | 56 // 'en' or 'en-US'. Note that this code should only specify the language, not |
| 54 // the locale, so 'en_US' (English language with US locale) and 'en-GB_US' | 57 // the locale, so 'en_US' (English language with US locale) and 'en-GB_US' |
| 55 // (British English person in the US) are not language codes. | 58 // (British English person in the US) are not language codes. |
| 56 NTPSnippetsService( | 59 NTPSnippetsService( |
| 57 PrefService* pref_service, | 60 PrefService* pref_service, |
| 58 suggestions::SuggestionsService* suggestions_service, | 61 suggestions::SuggestionsService* suggestions_service, |
| 59 scoped_refptr<base::SequencedTaskRunner> file_task_runner, | 62 scoped_refptr<base::SequencedTaskRunner> file_task_runner, |
| 60 const std::string& application_language_code, | 63 const std::string& application_language_code, |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 // hosts. (e.g. the user manually removed all MostLikely tiles.) | 207 // hosts. (e.g. the user manually removed all MostLikely tiles.) |
| 205 virtual void NTPSnippetsServiceCleared() = 0; | 208 virtual void NTPSnippetsServiceCleared() = 0; |
| 206 | 209 |
| 207 protected: | 210 protected: |
| 208 virtual ~NTPSnippetsServiceObserver() {} | 211 virtual ~NTPSnippetsServiceObserver() {} |
| 209 }; | 212 }; |
| 210 | 213 |
| 211 } // namespace ntp_snippets | 214 } // namespace ntp_snippets |
| 212 | 215 |
| 213 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_ | 216 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_ |
| OLD | NEW |