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

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

Issue 2823093002: Make FaviconService::GetRawFaviconForPageURL() select the best candidate among all the icon types (Closed)
Patch Set: Merge branch 'master' into icon_type Created 3 years, 8 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 (c) 2017 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2017 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_FAVICON_SERVICE_H_ 5 #ifndef COMPONENTS_FAVICON_CORE_FAVICON_SERVICE_H_
6 #define COMPONENTS_FAVICON_CORE_FAVICON_SERVICE_H_ 6 #define COMPONENTS_FAVICON_CORE_FAVICON_SERVICE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // resized. 83 // resized.
84 virtual base::CancelableTaskTracker::TaskId GetFaviconImageForPageURL( 84 virtual base::CancelableTaskTracker::TaskId GetFaviconImageForPageURL(
85 const GURL& page_url, 85 const GURL& page_url,
86 const favicon_base::FaviconImageCallback& callback, 86 const favicon_base::FaviconImageCallback& callback,
87 base::CancelableTaskTracker* tracker) = 0; 87 base::CancelableTaskTracker* tracker) = 0;
88 88
89 // Requests the favicon for the page at |page_url| with one of |icon_types| 89 // Requests the favicon for the page at |page_url| with one of |icon_types|
90 // and with |desired_size_in_pixel|. |icon_types| can be any combination of 90 // and with |desired_size_in_pixel|. |icon_types| can be any combination of
91 // IconTypes. If favicon bitmaps for several IconTypes are available, the 91 // IconTypes. If favicon bitmaps for several IconTypes are available, the
92 // favicon bitmap is chosen in the priority of TOUCH_PRECOMPOSED_ICON, 92 // favicon bitmap is chosen in the priority of TOUCH_PRECOMPOSED_ICON,
93 // TOUCH_ICON and FAVICON. If there is no favicon bitmap of size 93 // TOUCH_ICON and FAVICON. If there is no favicon bitmap of size
mastiz 2017/04/18 08:04:34 Update?
pkotwicz 2017/04/20 04:06:19 Done.
94 // |desired_size_in_pixel|, the favicon bitmap which best matches 94 // |desired_size_in_pixel|, the favicon bitmap which best matches
95 // |desired_size_in_pixel| is resized. If |desired_size_in_pixel| is 0, 95 // |desired_size_in_pixel| is resized. If |desired_size_in_pixel| is 0,
96 // the largest favicon bitmap is returned. Results with a higher priority 96 // the largest favicon bitmap is returned. Results with a higher priority
97 // IconType are preferred over an exact match of the favicon bitmap size. 97 // IconType are preferred over an exact match of the favicon bitmap size.
98 virtual base::CancelableTaskTracker::TaskId GetRawFaviconForPageURL( 98 virtual base::CancelableTaskTracker::TaskId GetRawFaviconForPageURL(
99 const GURL& page_url, 99 const GURL& page_url,
100 int icon_types, 100 int icon_types,
101 int desired_size_in_pixel, 101 int desired_size_in_pixel,
102 const favicon_base::FaviconRawBitmapCallback& callback, 102 const favicon_base::FaviconRawBitmapCallback& callback,
103 base::CancelableTaskTracker* tracker) = 0; 103 base::CancelableTaskTracker* tracker) = 0;
104 104
105 // See HistoryService::GetLargestFaviconForPageURL(). 105 // See HistoryService::GetLargestFaviconForPageURL().
106 virtual base::CancelableTaskTracker::TaskId GetLargestRawFaviconForPageURL( 106 virtual base::CancelableTaskTracker::TaskId GetLargestRawFaviconForPageURL(
107 const GURL& page_url, 107 const GURL& page_url,
108 const std::vector<int>& icon_types, 108 const std::vector<int>& icon_types,
109 int minimum_size_in_pixels, 109 int minimum_size_in_pixels,
110 const favicon_base::FaviconRawBitmapCallback& callback, 110 const favicon_base::FaviconRawBitmapCallback& callback,
111 base::CancelableTaskTracker* tracker) = 0; 111 base::CancelableTaskTracker* tracker) = 0;
112 112
113 virtual base::CancelableTaskTracker::TaskId GetFaviconForPageURL( 113 virtual base::CancelableTaskTracker::TaskId GetFaviconForPageURL(
114 const GURL& page_url, 114 const GURL& page_url,
115 int icon_types, 115 int icon_types,
116 int desired_size_in_dip, 116 int desired_size_in_dip,
117 const favicon_base::FaviconResultsCallback& callback, 117 const favicon_base::FaviconResultsCallback& callback,
118 base::CancelableTaskTracker* tracker) = 0; 118 base::CancelableTaskTracker* tracker) = 0;
119 119
120 // Set the favicon mappings to |page_url| for |icon_types| in the history 120 // Maps |page_url| to the favicon at |icon_url| if there is an entry in the
121 // database. 121 // database for |icon_url| and |icon_type|. This occurs when there is a
122 // Sample |icon_urls|: 122 // mapping from a different page URL to |icon_url|. The favicon bitmaps whose
123 // { ICON_URL1 -> TOUCH_ICON, known to the database, 123 // edge sizes most closely match |desired_sizes| from the favicons which were
124 // ICON_URL2 -> TOUCH_ICON, not known to the database, 124 // just mapped to |page_url| are returned. If |desired_sizes| has a '0' entry,
125 // ICON_URL3 -> TOUCH_PRECOMPOSED_ICON, known to the database } 125 // the largest favicon bitmap is returned.
126 // The new mappings are computed from |icon_urls| with these rules:
127 // 1) Any urls in |icon_urls| which are not already known to the database are
128 // rejected.
129 // Sample new mappings to |page_url|: { ICON_URL1, ICON_URL3 }
130 // 2) If |icon_types| has multiple types, the mappings are only set for the
131 // largest icon type.
132 // Sample new mappings to |page_url|: { ICON_URL3 }
133 // |icon_types| can only have multiple IconTypes if
134 // |icon_types| == TOUCH_ICON | TOUCH_PRECOMPOSED_ICON.
135 // The favicon bitmaps which most closely match |desired_size_in_dip|
136 // at the reosurce scale factors supported by the current platform (eg MacOS)
137 // in addition to 1x from the favicons which were just mapped to |page_url|
138 // are returned. If |desired_size_in_dip| is 0, the largest favicon bitmap is
139 // returned.
140 virtual base::CancelableTaskTracker::TaskId UpdateFaviconMappingsAndFetch( 126 virtual base::CancelableTaskTracker::TaskId UpdateFaviconMappingsAndFetch(
141 const GURL& page_url, 127 const GURL& page_url,
142 const std::vector<GURL>& icon_urls, 128 const GURL& icon_url,
143 int icon_types, 129 favicon_base::IconType icon_type,
144 int desired_size_in_dip, 130 int desired_size_in_dip,
145 const favicon_base::FaviconResultsCallback& callback, 131 const favicon_base::FaviconResultsCallback& callback,
146 base::CancelableTaskTracker* tracker) = 0; 132 base::CancelableTaskTracker* tracker) = 0;
147 133
148 // Used to request a bitmap for the favicon with |favicon_id| which is not 134 // Used to request a bitmap for the favicon with |favicon_id| which is not
149 // resized from the size it is stored at in the database. If there are 135 // resized from the size it is stored at in the database. If there are
150 // multiple favicon bitmaps for |favicon_id|, the largest favicon bitmap is 136 // multiple favicon bitmaps for |favicon_id|, the largest favicon bitmap is
151 // returned. 137 // returned.
152 virtual base::CancelableTaskTracker::TaskId GetLargestRawFaviconForID( 138 virtual base::CancelableTaskTracker::TaskId GetLargestRawFaviconForID(
153 favicon_base::FaviconID favicon_id, 139 favicon_base::FaviconID favicon_id,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 191
206 // Avoid repeated requests to download missing favicon. 192 // Avoid repeated requests to download missing favicon.
207 virtual void UnableToDownloadFavicon(const GURL& icon_url) = 0; 193 virtual void UnableToDownloadFavicon(const GURL& icon_url) = 0;
208 virtual bool WasUnableToDownloadFavicon(const GURL& icon_url) const = 0; 194 virtual bool WasUnableToDownloadFavicon(const GURL& icon_url) const = 0;
209 virtual void ClearUnableToDownloadFavicons() = 0; 195 virtual void ClearUnableToDownloadFavicons() = 0;
210 }; 196 };
211 197
212 } // namespace favicon 198 } // namespace favicon
213 199
214 #endif // COMPONENTS_FAVICON_CORE_FAVICON_SERVICE_H_ 200 #endif // COMPONENTS_FAVICON_CORE_FAVICON_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698