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

Unified Diff: components/favicon/core/favicon_driver_impl.cc

Issue 1407353012: Refactor FaviconDriver::OnFaviconAvailable() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@initial_simplify
Patch Set: Created 5 years, 1 month 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
Index: components/favicon/core/favicon_driver_impl.cc
diff --git a/components/favicon/core/favicon_driver_impl.cc b/components/favicon/core/favicon_driver_impl.cc
index dca52dfbe7d3b7218bf7786be3194324a850d3e3..2da8f46c8cd195ae2906c69932b7c105ee1032a5 100644
--- a/components/favicon/core/favicon_driver_impl.cc
+++ b/components/favicon/core/favicon_driver_impl.cc
@@ -48,11 +48,12 @@ FaviconDriverImpl::FaviconDriverImpl(FaviconService* favicon_service,
history_service_(history_service),
bookmark_model_(bookmark_model) {
favicon_handler_.reset(new FaviconHandler(
- favicon_service_, this, kEnableTouchIcon ? FaviconHandler::LARGEST_FAVICON
- : FaviconHandler::FAVICON));
+ favicon_service_, this, kEnableTouchIcon
+ ? FaviconDriverObserver::NON_TOUCH_LARGEST
+ : FaviconDriverObserver::NON_TOUCH_16_DIP));
if (kEnableTouchIcon || IsIconNTPEnabled()) {
touch_icon_handler_.reset(new FaviconHandler(
- favicon_service_, this, FaviconHandler::LARGEST_TOUCH));
+ favicon_service_, this, FaviconDriverObserver::TOUCH_LARGEST));
}
}
@@ -89,33 +90,6 @@ bool FaviconDriverImpl::IsBookmarked(const GURL& url) {
return bookmark_model_ && bookmark_model_->IsBookmarked(url);
}
-void FaviconDriverImpl::OnFaviconAvailable(const GURL& page_url,
- const GURL& icon_url,
- const gfx::Image& image,
- bool is_active_favicon) {
- // Check whether the active URL has changed since FetchFavicon() was called.
- // On iOS only, the active URL can change between calls to FetchFavicon().
- // For instance, FetchFavicon() is not synchronously called when the active
- // URL changes as a result of CRWSessionController::goToEntry().
- if (page_url != GetActiveURL())
- return;
-
- if (is_active_favicon) {
- bool icon_url_changed = GetActiveFaviconURL() != icon_url;
- // No matter what happens, we need to mark the favicon as being set.
- SetActiveFaviconValidity(true);
- SetActiveFaviconURL(icon_url);
-
- if (image.IsEmpty())
- return;
-
- SetActiveFaviconImage(image);
- NotifyFaviconUpdated(icon_url_changed);
- }
- if (!image.IsEmpty())
- NotifyFaviconAvailable(image);
-}
-
bool FaviconDriverImpl::HasPendingTasksForTest() {
if (favicon_handler_->HasPendingTasksForTest())
return true;

Powered by Google App Engine
This is Rietveld 408576698