OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_FAVICON_CORE_LARGE_ICON_SERVICE_H_ | |
6 #define COMPONENTS_FAVICON_CORE_LARGE_ICON_SERVICE_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/task/cancelable_task_tracker.h" | |
11 #include "components/favicon_base/favicon_callback.h" | |
12 #include "components/keyed_service/core/keyed_service.h" | |
13 | |
14 class GURL; | |
15 | |
16 namespace favicon_base { | |
17 struct FaviconRawBitmapResult; | |
18 } | |
19 | |
20 namespace favicon { | |
21 | |
22 class FaviconService; | |
23 | |
24 // The large icon service provides methods to access large icons. It relies on | |
25 // the favicon service. | |
26 class LargeIconService : public KeyedService { | |
27 public: | |
28 LargeIconService(FaviconService* favicon_service); | |
29 | |
30 ~LargeIconService() override; | |
31 | |
32 // Requests the best large icon for the page at |page_url| given the requested | |
33 // |desired_size_in_pixel|. If no good large icon can be found, returns the | |
34 // fallback style to use, for which the background is set to the dominant | |
35 // color of a smaller icon when one is available. | |
36 base::CancelableTaskTracker::TaskId GetLargeIconOrFallbackStyle( | |
37 const GURL& page_url, | |
38 int desired_size_in_pixel, | |
39 const favicon_base::LargeIconCallback& callback, | |
40 base::CancelableTaskTracker* tracker); | |
41 | |
42 private: | |
43 // Intermediate callback for GetLargeIconOrFallbackStyle(). Ensures the large | |
44 // icon is the desired size, if not compute the icon fallback style and use it | |
45 // to invoke |callback|. | |
huangs
2015/04/21 05:00:28
I noticed that the "ensure the large icon is the d
beaudoin
2015/04/21 15:11:11
Added TODO in large_icon_service.cc. Let's discuss
| |
46 void RunLargeIconCallback( | |
47 const favicon_base::LargeIconCallback& callback, | |
48 int desired_size_in_pixel, | |
49 const favicon_base::FaviconRawBitmapResult& bitmap_result); | |
50 | |
51 FaviconService* favicon_service_; | |
52 | |
53 // A pre-populated list of the types of icon files to consider when looking | |
54 // for large icons. Note: this is simply an optimization over populating an | |
55 // icon type vector on each request. | |
56 std::vector<int> large_icon_types_; | |
57 | |
58 DISALLOW_COPY_AND_ASSIGN(LargeIconService); | |
59 }; | |
60 | |
61 } // namespace favicon | |
62 | |
63 #endif // COMPONENTS_FAVICON_CORE_LARGE_ICON_SERVICE_H_ | |
OLD | NEW |