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

Unified Diff: components/favicon/core/favicon_handler.h

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
« no previous file with comments | « components/favicon/core/favicon_driver_observer.h ('k') | components/favicon/core/favicon_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/favicon/core/favicon_handler.h
diff --git a/components/favicon/core/favicon_handler.h b/components/favicon/core/favicon_handler.h
index a65d19b3d678c30180b78b82149c42e2e6a534ae..b423919b13012bf1b8be97836092b274daab477f 100644
--- a/components/favicon/core/favicon_handler.h
+++ b/components/favicon/core/favicon_handler.h
@@ -12,6 +12,7 @@
#include "base/callback_forward.h"
#include "base/memory/ref_counted.h"
#include "base/task/cancelable_task_tracker.h"
+#include "components/favicon/core/favicon_driver_observer.h"
#include "components/favicon/core/favicon_url.h"
#include "components/favicon_base/favicon_callback.h"
#include "ui/gfx/favicon_size.h"
@@ -78,29 +79,14 @@ class TestFaviconHandler;
class FaviconHandler {
public:
- enum Type {
- // Selects the icon URL of type favicon_base::FAVICON with bitmaps whose
- // edge sizes most closely match "16 * favicon_base::GetFaviconScales()".
- // When favicon_base::GetFaviconScales() returns multiple scales, the ideal
- // match is a .ico file.
- FAVICON,
-
- // Selects the icon URL of type favicon_base::FAVICON with the largest
- // bitmap.
- LARGEST_FAVICON,
-
- // Selects the icon URL of type favicon_base::TOUCH_ICON or
- // favicon_base::TOUCH_PRECOMPOSED_ICON with the largest bitmap.
- LARGEST_TOUCH
- };
-
FaviconHandler(FaviconService* service,
FaviconDriver* driver,
- Type handler_type);
+ FaviconDriverObserver::NotificationIconType handler_type);
virtual ~FaviconHandler();
// Returns the bit mask of favicon_base::IconType based on the handler's type.
- static int GetIconTypesFromHandlerType(Type icon_type);
+ static int GetIconTypesFromHandlerType(
+ FaviconDriverObserver::NotificationIconType handler_type);
// Initiates loading the favicon for the specified url.
void FetchFavicon(const GURL& url);
@@ -234,14 +220,17 @@ class FaviconHandler {
const gfx::Image& image,
favicon_base::IconType icon_type);
- // Notifies |driver_| favicon available. See
- // FaviconDriver::NotifyFaviconAvailable() for |is_active_favicon| in detail.
- void NotifyFaviconAvailable(
+ // Notifies |driver_| that FaviconHandler found an icon which matches the
+ // |handler_type_| criteria. NotifyFaviconUpdated() can be called multiple
+ // times for the same page if:
+ // - a better match is found for |handler_type_| (e.g. newer bitmap data)
+ // - Javascript changes the page's icon URLs.
+ void NotifyFaviconUpdated(
const std::vector<favicon_base::FaviconRawBitmapResult>&
favicon_bitmap_results);
- void NotifyFaviconAvailable(const GURL& icon_url,
- favicon_base::IconType icon_type,
- const gfx::Image& image);
+ void NotifyFaviconUpdated(const GURL& icon_url,
+ favicon_base::IconType icon_type,
+ const gfx::Image& image);
// Return the current candidate if any.
favicon::FaviconURL* current_candidate() {
@@ -259,6 +248,8 @@ class FaviconHandler {
// Used for FaviconService requests.
base::CancelableTaskTracker cancelable_task_tracker_;
+ FaviconDriverObserver::NotificationIconType handler_type_;
+
// URL of the page we're requesting the favicon for.
GURL url_;
« no previous file with comments | « components/favicon/core/favicon_driver_observer.h ('k') | components/favicon/core/favicon_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698