Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(882)

Side by Side Diff: components/ntp_tiles/icon_cacher_impl.h

Issue 2722133002: [Remote suggestions] Use Google server for fetching MostLikely icons (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/ntp_tiles/icon_cacher.h ('k') | components/ntp_tiles/icon_cacher_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/task/cancelable_task_tracker.h" 13 #include "base/task/cancelable_task_tracker.h"
14 #include "components/ntp_tiles/icon_cacher.h" 14 #include "components/ntp_tiles/icon_cacher.h"
15 #include "components/ntp_tiles/popular_sites.h" 15 #include "components/ntp_tiles/popular_sites.h"
16 16
17 namespace favicon { 17 namespace favicon {
18 class FaviconService; 18 class FaviconService;
19 class LargeIconService;
19 } // namespace favicon 20 } // namespace favicon
20 21
21 namespace favicon_base { 22 namespace favicon_base {
22 struct FaviconImageResult; 23 struct FaviconImageResult;
24 struct LargeIconResult;
23 } // namespace favicon_base 25 } // namespace favicon_base
24 26
25 namespace gfx { 27 namespace gfx {
26 class Image; 28 class Image;
27 } // namespace gfx 29 } // namespace gfx
28 30
29 namespace image_fetcher { 31 namespace image_fetcher {
30 class ImageFetcher; 32 class ImageFetcher;
31 } // namespace image_fetcher 33 } // namespace image_fetcher
32 34
33 namespace ntp_tiles { 35 namespace ntp_tiles {
34 36
35 class IconCacherImpl : public IconCacher { 37 class IconCacherImpl : public IconCacher {
36 public: 38 public:
39 // TODO(jkrcal): Make this eventually use only LargeIconService.
40 // crbug.com/696563
37 IconCacherImpl(favicon::FaviconService* favicon_service, 41 IconCacherImpl(favicon::FaviconService* favicon_service,
42 favicon::LargeIconService* large_icon_service,
38 std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher); 43 std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher);
39 ~IconCacherImpl() override; 44 ~IconCacherImpl() override;
40 45
41 void StartFetch(PopularSites::Site site, 46 void StartFetchPopularSites(PopularSites::Site site,
42 const base::Callback<void(bool)>& done) override; 47 const base::Callback<void(bool)>& done) override;
48 void StartFetchMostLikely(const GURL& page_url,
49 const base::Callback<void(bool)>& done) override;
43 50
44 private: 51 private:
45 void OnGetFaviconImageForPageURLFinished( 52 void OnGetFaviconImageForPageURLFinished(
46 PopularSites::Site site, 53 PopularSites::Site site,
47 const base::Callback<void(bool)>& done, 54 const base::Callback<void(bool)>& done,
48 const favicon_base::FaviconImageResult& result); 55 const favicon_base::FaviconImageResult& result);
49 56
50 void OnFaviconDownloaded(PopularSites::Site site, 57 void OnPopularSitesFaviconDownloaded(PopularSites::Site site,
51 const base::Callback<void(bool)>& done, 58 const base::Callback<void(bool)>& done,
52 const std::string& id, 59 const std::string& id,
53 const gfx::Image& fetched_image); 60 const gfx::Image& fetched_image);
61
62 void OnGetLargeIconOrFallbackStyleFinished(
63 const GURL& page_url,
64 const base::Callback<void(bool)>& done,
65 const favicon_base::LargeIconResult& result);
66
67 void OnMostLikelyFaviconDownloaded(
68 const GURL& page_url,
69 const base::Callback<void(bool)>& done,
70 const favicon_base::LargeIconResult& result);
54 71
55 base::CancelableTaskTracker tracker_; 72 base::CancelableTaskTracker tracker_;
56 favicon::FaviconService* const favicon_service_; 73 favicon::FaviconService* const favicon_service_;
74 favicon::LargeIconService* const large_icon_service_;
57 std::unique_ptr<image_fetcher::ImageFetcher> const image_fetcher_; 75 std::unique_ptr<image_fetcher::ImageFetcher> const image_fetcher_;
58 76
59 DISALLOW_COPY_AND_ASSIGN(IconCacherImpl); 77 DISALLOW_COPY_AND_ASSIGN(IconCacherImpl);
60 }; 78 };
61 79
62 } // namespace ntp_tiles 80 } // namespace ntp_tiles
63 81
64 #endif // COMPONENTS_NTP_TILES_ICON_CACHER_IMPL_H_ 82 #endif // COMPONENTS_NTP_TILES_ICON_CACHER_IMPL_H_
OLDNEW
« no previous file with comments | « components/ntp_tiles/icon_cacher.h ('k') | components/ntp_tiles/icon_cacher_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698