| OLD | NEW |
| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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_size_in_dip| from the favicons which |
| 124 // ICON_URL2 -> TOUCH_ICON, not known to the database, | 124 // were just mapped to |page_url| are returned. If |desired_size_in_dip| has a |
| 125 // ICON_URL3 -> TOUCH_PRECOMPOSED_ICON, known to the database } | 125 // '0' entry, 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 Loading... |
| 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_ |
| OLD | NEW |