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