| 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_TILES_ICON_CACHER_IMPL_H_ | 5 #ifndef COMPONENTS_NTP_TILES_ICON_CACHER_IMPL_H_ |
| 6 #define COMPONENTS_NTP_TILES_ICON_CACHER_IMPL_H_ | 6 #define COMPONENTS_NTP_TILES_ICON_CACHER_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 namespace favicon_base { | 21 namespace favicon_base { |
| 22 struct FaviconImageResult; | 22 struct FaviconImageResult; |
| 23 } // namespace favicon_base | 23 } // namespace favicon_base |
| 24 | 24 |
| 25 namespace gfx { | 25 namespace gfx { |
| 26 class Image; | 26 class Image; |
| 27 } // namespace gfx | 27 } // namespace gfx |
| 28 | 28 |
| 29 namespace image_fetcher { | 29 namespace image_fetcher { |
| 30 class ImageFetcher; | 30 class ImageFetcher; |
| 31 struct RequestMetadata; |
| 31 } // namespace image_fetcher | 32 } // namespace image_fetcher |
| 32 | 33 |
| 33 namespace ntp_tiles { | 34 namespace ntp_tiles { |
| 34 | 35 |
| 35 class IconCacherImpl : public IconCacher { | 36 class IconCacherImpl : public IconCacher { |
| 36 public: | 37 public: |
| 37 IconCacherImpl(favicon::FaviconService* favicon_service, | 38 IconCacherImpl(favicon::FaviconService* favicon_service, |
| 38 std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher); | 39 std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher); |
| 39 ~IconCacherImpl() override; | 40 ~IconCacherImpl() override; |
| 40 | 41 |
| 41 void StartFetch(PopularSites::Site site, | 42 void StartFetch(PopularSites::Site site, |
| 42 const base::Closure& icon_available, | 43 const base::Closure& icon_available, |
| 43 const base::Closure& preliminary_icon_available) override; | 44 const base::Closure& preliminary_icon_available) override; |
| 44 | 45 |
| 45 private: | 46 private: |
| 46 void OnGetFaviconImageForPageURLFinished( | 47 void OnGetFaviconImageForPageURLFinished( |
| 47 PopularSites::Site site, | 48 PopularSites::Site site, |
| 48 const base::Closure& icon_available, | 49 const base::Closure& icon_available, |
| 49 const base::Closure& preliminary_icon_available, | 50 const base::Closure& preliminary_icon_available, |
| 50 const favicon_base::FaviconImageResult& result); | 51 const favicon_base::FaviconImageResult& result); |
| 51 | 52 |
| 52 void OnFaviconDownloaded(PopularSites::Site site, | 53 void OnFaviconDownloaded(PopularSites::Site site, |
| 53 const base::Closure& icon_available, | 54 const base::Closure& icon_available, |
| 54 const std::string& id, | 55 const std::string& id, |
| 55 const gfx::Image& fetched_image); | 56 const gfx::Image& fetched_image, |
| 57 const image_fetcher::RequestMetadata& metadata); |
| 56 | 58 |
| 57 bool ProvideDefaultIcon(const PopularSites::Site& site); | 59 bool ProvideDefaultIcon(const PopularSites::Site& site); |
| 58 void SaveIconForSite(const PopularSites::Site& site, const gfx::Image image); | 60 void SaveIconForSite(const PopularSites::Site& site, const gfx::Image image); |
| 59 | 61 |
| 60 base::CancelableTaskTracker tracker_; | 62 base::CancelableTaskTracker tracker_; |
| 61 favicon::FaviconService* const favicon_service_; | 63 favicon::FaviconService* const favicon_service_; |
| 62 std::unique_ptr<image_fetcher::ImageFetcher> const image_fetcher_; | 64 std::unique_ptr<image_fetcher::ImageFetcher> const image_fetcher_; |
| 63 | 65 |
| 64 DISALLOW_COPY_AND_ASSIGN(IconCacherImpl); | 66 DISALLOW_COPY_AND_ASSIGN(IconCacherImpl); |
| 65 }; | 67 }; |
| 66 | 68 |
| 67 } // namespace ntp_tiles | 69 } // namespace ntp_tiles |
| 68 | 70 |
| 69 #endif // COMPONENTS_NTP_TILES_ICON_CACHER_IMPL_H_ | 71 #endif // COMPONENTS_NTP_TILES_ICON_CACHER_IMPL_H_ |
| OLD | NEW |