Index: chrome/browser/favicon/favicon_tab_helper.cc |
diff --git a/chrome/browser/favicon/favicon_tab_helper.cc b/chrome/browser/favicon/favicon_tab_helper.cc |
index f203f141962d39bed479a535e4997c698d761d14..d5b4098382c2e4fa2017d597a59ac4ad121ff520 100644 |
--- a/chrome/browser/favicon/favicon_tab_helper.cc |
+++ b/chrome/browser/favicon/favicon_tab_helper.cc |
@@ -16,6 +16,7 @@ |
#include "chrome/common/chrome_constants.h" |
#include "chrome/common/url_constants.h" |
#include "components/bookmarks/core/browser/bookmark_model.h" |
+#include "components/favicon_base/favicon_types.h" |
#include "content/public/browser/favicon_status.h" |
#include "content/public/browser/invalidate_type.h" |
#include "content/public/browser/navigation_controller.h" |
@@ -25,6 +26,7 @@ |
#include "content/public/browser/render_view_host.h" |
#include "content/public/browser/web_contents.h" |
#include "content/public/browser/web_contents_delegate.h" |
+#include "content/public/common/favicon_url.h" |
#include "ui/gfx/codec/png_codec.h" |
#include "ui/gfx/image/image.h" |
#include "ui/gfx/image/image_skia.h" |
@@ -222,14 +224,40 @@ void FaviconTabHelper::DidNavigateMainFrame( |
FetchFavicon(details.entry->GetURL()); |
} |
+// Returns favicon_base::IconType the given icon_type corresponds to. |
+// TODO(jif): Move function to /components/favicon_base/content/ |
+// crbug.com/374281. |
+favicon_base::IconType ToChromeIconType( |
+ content::FaviconURL::IconType icon_type) { |
+ switch (icon_type) { |
+ case content::FaviconURL::FAVICON: |
+ return favicon_base::FAVICON; |
+ case content::FaviconURL::TOUCH_ICON: |
+ return favicon_base::TOUCH_ICON; |
+ case content::FaviconURL::TOUCH_PRECOMPOSED_ICON: |
+ return favicon_base::TOUCH_PRECOMPOSED_ICON; |
+ case content::FaviconURL::INVALID_ICON: |
+ return favicon_base::INVALID_ICON; |
+ } |
+ NOTREACHED(); |
+ return favicon_base::INVALID_ICON; |
+} |
+ |
void FaviconTabHelper::DidUpdateFaviconURL( |
const std::vector<content::FaviconURL>& candidates) { |
DCHECK(!candidates.empty()); |
favicon_urls_ = candidates; |
- |
- favicon_handler_->OnUpdateFaviconURL(candidates); |
+ std::vector<favicon::FaviconURL> favicon_urls; |
+ for (size_t i = 0; i < candidates.size(); i++) { |
+ const content::FaviconURL& candidate = candidates[i]; |
+ favicon_urls.push_back( |
+ favicon::FaviconURL(candidate.icon_url, |
+ ToChromeIconType(candidate.icon_type), |
+ candidate.icon_sizes)); |
+ } |
+ favicon_handler_->OnUpdateFaviconURL(favicon_urls); |
if (touch_icon_handler_.get()) |
- touch_icon_handler_->OnUpdateFaviconURL(candidates); |
+ touch_icon_handler_->OnUpdateFaviconURL(favicon_urls); |
} |
FaviconService* FaviconTabHelper::GetFaviconService() { |