Chromium Code Reviews| 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> |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 54 | 54 |
| 55 namespace sync_driver { | 55 namespace sync_driver { |
| 56 class SyncService; | 56 class SyncService; |
| 57 } | 57 } |
| 58 | 58 |
| 59 namespace ntp_snippets { | 59 namespace ntp_snippets { |
| 60 | 60 |
| 61 class NTPSnippetsDatabase; | 61 class NTPSnippetsDatabase; |
| 62 class NTPSnippetsServiceObserver; | 62 class NTPSnippetsServiceObserver; |
| 63 | 63 |
| 64 // Stores and vends fresh content data for the NTP. | 64 // Stores and vends fresh content data for the NTP. |
|
Marc Treib
2016/07/20 09:17:38
nit: Update the comment, given that it's now a pro
Philipp Keck
2016/07/20 13:20:02
Done, please read the new comment.
Marc Treib
2016/07/20 13:41:11
Yup, better! :)
| |
| 65 // TODO(pke): Rename this service to ArticleSuggestionsService and move to | 65 // TODO(pke): Rename this service to ArticleSuggestionsService and move to |
| 66 // a subdirectory. | 66 // a subdirectory. |
| 67 class NTPSnippetsService : public KeyedService, | 67 class NTPSnippetsService : public KeyedService, |
| 68 public image_fetcher::ImageFetcherDelegate, | 68 public image_fetcher::ImageFetcherDelegate, |
| 69 public ContentSuggestionsProvider { | 69 public ContentSuggestionsProvider { |
| 70 public: | 70 public: |
| 71 // |application_language_code| should be a ISO 639-1 compliant string, e.g. | 71 // |application_language_code| should be a ISO 639-1 compliant string, e.g. |
| 72 // 'en' or 'en-US'. Note that this code should only specify the language, not | 72 // 'en' or 'en-US'. Note that this code should only specify the language, not |
| 73 // the locale, so 'en_US' (English language with US locale) and 'en-GB_US' | 73 // the locale, so 'en_US' (English language with US locale) and 'en-GB_US' |
| 74 // (British English person in the US) are not language codes. | 74 // (British English person in the US) are not language codes. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 146 std::set<std::string> GetSuggestionsHosts() const; | 146 std::set<std::string> GetSuggestionsHosts() const; |
| 147 | 147 |
| 148 // Observer accessors. | 148 // Observer accessors. |
| 149 void AddObserver(NTPSnippetsServiceObserver* observer); | 149 void AddObserver(NTPSnippetsServiceObserver* observer); |
| 150 void RemoveObserver(NTPSnippetsServiceObserver* observer); | 150 void RemoveObserver(NTPSnippetsServiceObserver* observer); |
| 151 | 151 |
| 152 // Returns the maximum number of snippets that will be shown at once. | 152 // Returns the maximum number of snippets that will be shown at once. |
| 153 static int GetMaxSnippetCountForTesting(); | 153 static int GetMaxSnippetCountForTesting(); |
| 154 | 154 |
| 155 private: | 155 private: |
| 156 friend class NTPSnippetsServiceTest; | |
| 156 FRIEND_TEST_ALL_PREFIXES(NTPSnippetsServiceTest, HistorySyncStateChanges); | 157 FRIEND_TEST_ALL_PREFIXES(NTPSnippetsServiceTest, HistorySyncStateChanges); |
| 157 | 158 |
| 158 // TODO(pke): As soon as the DisabledReason is replaced with the new status, | 159 // TODO(pke): As soon as the DisabledReason is replaced with the new status, |
| 159 // also remove the old State enum and replace it with | 160 // also remove the old State enum and replace it with |
| 160 // ContentSuggestionsCategoryStatus and a similar status diagram. | 161 // ContentSuggestionsCategoryStatus and a similar status diagram. |
| 161 // Possible state transitions: | 162 // Possible state transitions: |
| 162 // +------- NOT_INITED ------+ | 163 // +------- NOT_INITED ------+ |
| 163 // | / \ | | 164 // | / \ | |
| 164 // | READY <--> DISABLED <-+ | 165 // | READY <--> DISABLED <-+ |
| 165 // | \ / | 166 // | \ / |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 336 // If the service might be enabled, DisabledReason::NONE will be provided. | 337 // If the service might be enabled, DisabledReason::NONE will be provided. |
| 337 virtual void NTPSnippetsServiceDisabledReasonChanged(DisabledReason) = 0; | 338 virtual void NTPSnippetsServiceDisabledReasonChanged(DisabledReason) = 0; |
| 338 | 339 |
| 339 protected: | 340 protected: |
| 340 virtual ~NTPSnippetsServiceObserver() {} | 341 virtual ~NTPSnippetsServiceObserver() {} |
| 341 }; | 342 }; |
| 342 | 343 |
| 343 } // namespace ntp_snippets | 344 } // namespace ntp_snippets |
| 344 | 345 |
| 345 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_ | 346 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_H_ |
| OLD | NEW |