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

Unified Diff: chrome/browser/favicon/favicon_tab_helper.cc

Issue 285293005: Replace content's faviconURL with components/favicon's (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/favicon/favicon_handler_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« no previous file with comments | « chrome/browser/favicon/favicon_handler_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698