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_REMOTE_SUGGESTIONS_PROVIDER_H_ | 5 #ifndef COMPONENTS_NTP_SNIPPETS_REMOTE_REMOTE_SUGGESTIONS_PROVIDER_H_ |
6 #define COMPONENTS_NTP_SNIPPETS_REMOTE_REMOTE_SUGGESTIONS_PROVIDER_H_ | 6 #define COMPONENTS_NTP_SNIPPETS_REMOTE_REMOTE_SUGGESTIONS_PROVIDER_H_ |
7 | 7 |
8 #include <cstddef> | 8 #include <cstddef> |
9 #include <deque> | 9 #include <deque> |
10 #include <map> | 10 #include <map> |
(...skipping 27 matching lines...) Expand all Loading... | |
38 class Image; | 38 class Image; |
39 } // namespace gfx | 39 } // namespace gfx |
40 | 40 |
41 namespace image_fetcher { | 41 namespace image_fetcher { |
42 class ImageDecoder; | 42 class ImageDecoder; |
43 class ImageFetcher; | 43 class ImageFetcher; |
44 } // namespace image_fetcher | 44 } // namespace image_fetcher |
45 | 45 |
46 namespace ntp_snippets { | 46 namespace ntp_snippets { |
47 | 47 |
48 struct NTPSnippetsRequestParams; | |
tschumann
2016/12/16 16:36:20
no need to distinguish struct vs class in forward
fhorschig
2016/12/20 10:07:38
Done.
| |
48 class RemoteSuggestionsDatabase; | 49 class RemoteSuggestionsDatabase; |
49 class UserClassifier; | 50 class UserClassifier; |
50 | 51 |
51 // CachedImageFetcher takes care of fetching images from the network and caching | 52 // CachedImageFetcher takes care of fetching images from the network and caching |
52 // them in the database. | 53 // them in the database. |
53 // TODO(tschumann): Move into a separate library and inject the | 54 // TODO(tschumann): Move into a separate library and inject the |
54 // CachedImageFetcher into the RemoteSuggestionsProvider. This allows us to get | 55 // CachedImageFetcher into the RemoteSuggestionsProvider. This allows us to get |
55 // rid of exposing this member for testing and lets us test the caching logic | 56 // rid of exposing this member for testing and lets us test the caching logic |
56 // separately. | 57 // separately. |
57 class CachedImageFetcher : public image_fetcher::ImageFetcherDelegate { | 58 class CachedImageFetcher : public image_fetcher::ImageFetcherDelegate { |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
386 | 387 |
387 // Updates the category info for |category|. If a corresponding | 388 // Updates the category info for |category|. If a corresponding |
388 // CategoryContent object does not exist, it will be created. | 389 // CategoryContent object does not exist, it will be created. |
389 // Returns the existing or newly created object. | 390 // Returns the existing or newly created object. |
390 CategoryContent* UpdateCategoryInfo(Category category, | 391 CategoryContent* UpdateCategoryInfo(Category category, |
391 const CategoryInfo& info); | 392 const CategoryInfo& info); |
392 | 393 |
393 void RestoreCategoriesFromPrefs(); | 394 void RestoreCategoriesFromPrefs(); |
394 void StoreCategoriesToPrefs(); | 395 void StoreCategoriesToPrefs(); |
395 | 396 |
396 NTPSnippetsFetcher::Params BuildFetchParams() const; | 397 NTPSnippetsRequestParams BuildFetchParams() const; |
397 | 398 |
398 void MarkEmptyCategoriesAsLoading(); | 399 void MarkEmptyCategoriesAsLoading(); |
399 | 400 |
400 State state_; | 401 State state_; |
401 | 402 |
402 PrefService* pref_service_; | 403 PrefService* pref_service_; |
403 | 404 |
404 const Category articles_category_; | 405 const Category articles_category_; |
405 | 406 |
406 std::map<Category, CategoryContent, Category::CompareByID> category_contents_; | 407 std::map<Category, CategoryContent, Category::CompareByID> category_contents_; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
438 | 439 |
439 // A clock for getting the time. This allows to inject a clock in tests. | 440 // A clock for getting the time. This allows to inject a clock in tests. |
440 std::unique_ptr<base::Clock> clock_; | 441 std::unique_ptr<base::Clock> clock_; |
441 | 442 |
442 DISALLOW_COPY_AND_ASSIGN(RemoteSuggestionsProvider); | 443 DISALLOW_COPY_AND_ASSIGN(RemoteSuggestionsProvider); |
443 }; | 444 }; |
444 | 445 |
445 } // namespace ntp_snippets | 446 } // namespace ntp_snippets |
446 | 447 |
447 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_REMOTE_SUGGESTIONS_PROVIDER_H_ | 448 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_REMOTE_SUGGESTIONS_PROVIDER_H_ |
OLD | NEW |