Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/containers/hash_tables.h" | 14 #include "base/containers/hash_tables.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "base/task/cancelable_task_tracker.h" | 17 #include "base/task/cancelable_task_tracker.h" |
| 18 #include "components/favicon_base/favicon_callback.h" | 18 #include "components/favicon_base/favicon_callback.h" |
| 19 #include "components/favicon_base/favicon_types.h" | 19 #include "components/favicon_base/favicon_types.h" |
| 20 #include "components/favicon_base/favicon_usage_data.h" | 20 #include "components/favicon_base/favicon_usage_data.h" |
| 21 #include "components/keyed_service/core/keyed_service.h" | 21 #include "components/keyed_service/core/keyed_service.h" |
| 22 #include "ui/gfx/favicon_size.h" | |
| 22 | 23 |
| 23 class GURL; | 24 class GURL; |
| 24 | 25 |
| 25 namespace history { | 26 namespace history { |
| 26 class HistoryService; | 27 class HistoryService; |
| 27 } | 28 } |
| 28 | 29 |
| 29 namespace favicon { | 30 namespace favicon { |
| 30 | 31 |
| 31 class FaviconClient; | 32 class FaviconClient; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 int desired_size_in_dip, | 88 int desired_size_in_dip, |
| 88 const favicon_base::FaviconResultsCallback& callback, | 89 const favicon_base::FaviconResultsCallback& callback, |
| 89 base::CancelableTaskTracker* tracker); | 90 base::CancelableTaskTracker* tracker); |
| 90 | 91 |
| 91 ////////////////////////////////////////////////////////////////////////////// | 92 ////////////////////////////////////////////////////////////////////////////// |
| 92 // Methods to request favicon bitmaps from the history backend for |page_url|. | 93 // Methods to request favicon bitmaps from the history backend for |page_url|. |
| 93 // |page_url| is the web page the favicon is associated with. | 94 // |page_url| is the web page the favicon is associated with. |
| 94 // (e.g. <http://www.google.com>) | 95 // (e.g. <http://www.google.com>) |
| 95 | 96 |
| 96 // Requests the favicon for the page at |page_url| of type | 97 // Requests the favicon for the page at |page_url| of type |
| 97 // favicon_base::FAVICON and of size gfx::kFaviconSize. The returned | 98 // favicon_base::FAVICON and of size |faviconSize|. gfx::kFaviconSize is used |
| 98 // gfx::Image is populated with representations for all of the scale factors | 99 // by default for |faviconSize|, while gfx::kHdpiFaviconSize should be used |
| 99 // supported by the platform (e.g. MacOS). If data is unavailable for some or | 100 // for high DPI machines or displays. The returned gfx::Image is populated |
| 100 // all of the scale factors, the bitmaps with the best matching sizes are | 101 // with representations for all of the scale factors supported by the platform |
| 101 // resized. | 102 // (e.g. MacOS). If data is unavailable for some or all of the scale factors, |
| 103 // the bitmaps with the best matching sizes are resized. | |
| 102 base::CancelableTaskTracker::TaskId GetFaviconImageForPageURL( | 104 base::CancelableTaskTracker::TaskId GetFaviconImageForPageURL( |
| 103 const GURL& page_url, | 105 const GURL& page_url, |
| 104 const favicon_base::FaviconImageCallback& callback, | 106 const favicon_base::FaviconImageCallback& callback, |
| 105 base::CancelableTaskTracker* tracker); | 107 base::CancelableTaskTracker* tracker, |
| 108 const int faviconSize = gfx::kFaviconSize); | |
|
sky
2017/01/31 23:28:44
You shouldn't need to specify a size. The gfx::Ima
chengx
2017/02/02 20:52:58
Acknowledged.
| |
| 106 | 109 |
| 107 // Requests the favicon for the page at |page_url| with one of |icon_types| | 110 // Requests the favicon for the page at |page_url| with one of |icon_types| |
| 108 // and with |desired_size_in_pixel|. |icon_types| can be any combination of | 111 // and with |desired_size_in_pixel|. |icon_types| can be any combination of |
| 109 // IconTypes. If favicon bitmaps for several IconTypes are available, the | 112 // IconTypes. If favicon bitmaps for several IconTypes are available, the |
| 110 // favicon bitmap is chosen in the priority of TOUCH_PRECOMPOSED_ICON, | 113 // favicon bitmap is chosen in the priority of TOUCH_PRECOMPOSED_ICON, |
| 111 // TOUCH_ICON and FAVICON. If there is no favicon bitmap of size | 114 // TOUCH_ICON and FAVICON. If there is no favicon bitmap of size |
| 112 // |desired_size_in_pixel|, the favicon bitmap which best matches | 115 // |desired_size_in_pixel|, the favicon bitmap which best matches |
| 113 // |desired_size_in_pixel| is resized. If |desired_size_in_pixel| is 0, | 116 // |desired_size_in_pixel| is resized. If |desired_size_in_pixel| is 0, |
| 114 // the largest favicon bitmap is returned. Results with a higher priority | 117 // the largest favicon bitmap is returned. Results with a higher priority |
| 115 // IconType are preferred over an exact match of the favicon bitmap size. | 118 // IconType are preferred over an exact match of the favicon bitmap size. |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 247 base::hash_set<MissingFaviconURLHash> missing_favicon_urls_; | 250 base::hash_set<MissingFaviconURLHash> missing_favicon_urls_; |
| 248 std::unique_ptr<FaviconClient> favicon_client_; | 251 std::unique_ptr<FaviconClient> favicon_client_; |
| 249 history::HistoryService* history_service_; | 252 history::HistoryService* history_service_; |
| 250 | 253 |
| 251 DISALLOW_COPY_AND_ASSIGN(FaviconService); | 254 DISALLOW_COPY_AND_ASSIGN(FaviconService); |
| 252 }; | 255 }; |
| 253 | 256 |
| 254 } // namespace favicon | 257 } // namespace favicon |
| 255 | 258 |
| 256 #endif // COMPONENTS_FAVICON_CORE_FAVICON_SERVICE_H_ | 259 #endif // COMPONENTS_FAVICON_CORE_FAVICON_SERVICE_H_ |
| OLD | NEW |