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

Side by Side Diff: components/favicon/core/large_icon_service.h

Issue 2685173002: Extend LargeIconService to fetch missing favicons from a Google server (Closed)
Patch Set: Created 3 years, 10 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
OLDNEW
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_FAVICON_CORE_LARGE_ICON_SERVICE_H_ 5 #ifndef COMPONENTS_FAVICON_CORE_LARGE_ICON_SERVICE_H_
6 #define COMPONENTS_FAVICON_CORE_LARGE_ICON_SERVICE_H_ 6 #define COMPONENTS_FAVICON_CORE_LARGE_ICON_SERVICE_H_
7 7
8 #include <string>
8 #include <vector> 9 #include <vector>
9 10
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "base/task/cancelable_task_tracker.h" 12 #include "base/task/cancelable_task_tracker.h"
12 #include "components/favicon_base/favicon_callback.h" 13 #include "components/favicon_base/favicon_callback.h"
13 #include "components/keyed_service/core/keyed_service.h" 14 #include "components/keyed_service/core/keyed_service.h"
14 15
15 class GURL; 16 class GURL;
16 17
17 namespace base { 18 namespace base {
18 class TaskRunner; 19 class TaskRunner;
19 } 20 }
20 21
22 namespace image_fetcher {
23 class ImageFetcher;
24 }
25
21 namespace favicon { 26 namespace favicon {
22 27
23 class FaviconService; 28 class FaviconService;
24 29
25 // The large icon service provides methods to access large icons. It relies on 30 // The large icon service provides methods to access large icons. It relies on
26 // the favicon service. 31 // the favicon service.
27 class LargeIconService : public KeyedService { 32 class LargeIconService : public KeyedService {
28 public: 33 public:
29 LargeIconService( 34 LargeIconService(
30 FaviconService* favicon_service, 35 FaviconService* favicon_service,
31 const scoped_refptr<base::TaskRunner>& background_task_runner); 36 const scoped_refptr<base::TaskRunner>& background_task_runner,
37 std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher);
32 ~LargeIconService() override; 38 ~LargeIconService() override;
33 39
34 // Requests the best large icon for the page at |page_url|. 40 // Requests the best large icon for the page at |page_url|.
35 // Case 1. An icon exists whose size is >= |min_source_size_in_pixel|: 41 // Case 1. An icon exists whose size is >= |min_source_size_in_pixel|:
36 // - If |desired_size_in_pixel| == 0: returns icon as is. 42 // - If |desired_size_in_pixel| == 0: returns icon as is.
37 // - Else: returns the icon resized to |desired_size_in_pixel|. 43 // - Else: returns the icon resized to |desired_size_in_pixel|.
38 // Case 2. An icon exists whose size is < |min_source_size_in_pixel|: 44 // Case 2. An icon exists whose size is < |min_source_size_in_pixel|:
39 // - Extracts dominant color of smaller image, returns a fallback icon style 45 // - Extracts dominant color of smaller image, returns a fallback icon style
40 // that has a matching background. 46 // that has a matching background.
41 // Case 3. No icon exists. 47 // Case 3. No icon exists.
(...skipping 12 matching lines...) Expand all
54 friend class TestLargeIconService; 60 friend class TestLargeIconService;
55 61
56 FaviconService* favicon_service_; 62 FaviconService* favicon_service_;
57 scoped_refptr<base::TaskRunner> background_task_runner_; 63 scoped_refptr<base::TaskRunner> background_task_runner_;
58 64
59 // A pre-populated list of icon types to consider when looking for large 65 // A pre-populated list of icon types to consider when looking for large
60 // icons. This is an optimization over populating an icon type vector on each 66 // icons. This is an optimization over populating an icon type vector on each
61 // request. 67 // request.
62 std::vector<int> large_icon_types_; 68 std::vector<int> large_icon_types_;
63 69
70 std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher_;
71
64 DISALLOW_COPY_AND_ASSIGN(LargeIconService); 72 DISALLOW_COPY_AND_ASSIGN(LargeIconService);
65 }; 73 };
66 74
67 } // namespace favicon 75 } // namespace favicon
68 76
69 #endif // COMPONENTS_FAVICON_CORE_LARGE_ICON_SERVICE_H_ 77 #endif // COMPONENTS_FAVICON_CORE_LARGE_ICON_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698