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_REMOTE_NTP_SNIPPETS_SERVICE_H_ | 5 #ifndef COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_SERVICE_H_ |
6 #define COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_SERVICE_H_ | 6 #define COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_SERVICE_H_ |
7 | 7 |
8 #include <cstddef> | 8 #include <cstddef> |
9 #include <map> | 9 #include <map> |
10 #include <memory> | 10 #include <memory> |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 // Converts the cached snippets to article content suggestions and notifies | 272 // Converts the cached snippets to article content suggestions and notifies |
273 // the observers. | 273 // the observers. |
274 void NotifyNewSuggestions(); | 274 void NotifyNewSuggestions(); |
275 | 275 |
276 // Updates the internal status for |category| to |category_status_| and | 276 // Updates the internal status for |category| to |category_status_| and |
277 // notifies the content suggestions observer if it changed. | 277 // notifies the content suggestions observer if it changed. |
278 void UpdateCategoryStatus(Category category, CategoryStatus status); | 278 void UpdateCategoryStatus(Category category, CategoryStatus status); |
279 // Calls UpdateCategoryStatus() for all provided categories. | 279 // Calls UpdateCategoryStatus() for all provided categories. |
280 void UpdateAllCategoryStatus(CategoryStatus status); | 280 void UpdateAllCategoryStatus(CategoryStatus status); |
281 | 281 |
| 282 void RestoreCategoriesFromPrefs(); |
| 283 void StoreCategoriesToPrefs(); |
| 284 |
282 State state_; | 285 State state_; |
283 | 286 |
284 PrefService* pref_service_; | 287 PrefService* pref_service_; |
285 | 288 |
286 const Category articles_category_; | 289 const Category articles_category_; |
287 | 290 |
288 // TODO(sfiera): Reduce duplication of CategoryContent with CategoryInfo. | 291 // TODO(sfiera): Reduce duplication of CategoryContent with CategoryInfo. |
289 struct CategoryContent { | 292 struct CategoryContent { |
290 CategoryStatus status = CategoryStatus::INITIALIZING; | 293 CategoryStatus status = CategoryStatus::INITIALIZING; |
291 | 294 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 | 356 |
354 // Request throttler for limiting requests to thumbnail images. | 357 // Request throttler for limiting requests to thumbnail images. |
355 RequestThrottler thumbnail_requests_throttler_; | 358 RequestThrottler thumbnail_requests_throttler_; |
356 | 359 |
357 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsService); | 360 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsService); |
358 }; | 361 }; |
359 | 362 |
360 } // namespace ntp_snippets | 363 } // namespace ntp_snippets |
361 | 364 |
362 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_SERVICE_H_ | 365 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_SERVICE_H_ |
OLD | NEW |