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

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

Issue 1020213002: Componentize conversion of content::FaviconURL to favicon::FaviconURL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@browser
Patch Set: Created 5 years, 9 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/BUILD.gn ('k') | chrome/chrome_browser.gypi » ('j') | 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 2625ee76c3675859b36b4cc8f52218d0a82cbb70..80940039538ea403011162e71effdb0e8acd1c79 100644
--- a/chrome/browser/favicon/favicon_tab_helper.cc
+++ b/chrome/browser/favicon/favicon_tab_helper.cc
@@ -15,6 +15,7 @@
#include "chrome/browser/search/search.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/url_constants.h"
+#include "components/favicon/content/favicon_url_util.h"
#include "components/favicon/core/favicon_handler.h"
#include "components/favicon/core/favicon_service.h"
#include "components/favicon/core/favicon_tab_helper_observer.h"
@@ -283,37 +284,12 @@ void FaviconTabHelper::DidNavigateMainFrame(
FetchFavicon(url);
}
-// 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;
- 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));
- }
+ std::vector<favicon::FaviconURL> favicon_urls =
+ favicon::FaviconURLsFromContentFaviconURLs(candidates);
favicon_handler_->OnUpdateFaviconURL(favicon_urls);
if (touch_icon_handler_.get())
touch_icon_handler_->OnUpdateFaviconURL(favicon_urls);
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698