Index: chrome/browser/ui/cocoa/tab_contents/favicon_util_mac.mm |
diff --git a/chrome/browser/ui/cocoa/tab_contents/favicon_util_mac.mm b/chrome/browser/ui/cocoa/tab_contents/favicon_util_mac.mm |
index 16074c23d05d43fc0fd3bf3c62ba3ddc23ebac61..af2c8472c6ed5899af82250c0af47bfa97105ec0 100644 |
--- a/chrome/browser/ui/cocoa/tab_contents/favicon_util_mac.mm |
+++ b/chrome/browser/ui/cocoa/tab_contents/favicon_util_mac.mm |
@@ -98,11 +98,14 @@ NSImage* FaviconForWebContents(content::WebContents* contents, SkColor color) { |
NSImage* image = favicon_driver->GetFavicon().AsNSImage(); |
// The |image| could be nil if the bitmap is null. In that case, fallback |
// to the default image. |
- if (image) { |
+ if (image) |
return image; |
- } |
} |
+ return DefaultFavicon(color); |
+} |
+ |
+NSImage* DefaultFavicon(SkColor color) { |
if (ui::MaterialDesignController::IsModeMaterial()) |
return [DefaultFaviconImageRep imageForColor:color]; |
@@ -110,4 +113,14 @@ NSImage* FaviconForWebContents(content::WebContents* contents, SkColor color) { |
return rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON).ToNSImage(); |
} |
+bool ShouldUseDefaultFavicon(content::WebContents* contents) { |
+ favicon::FaviconDriver* favicon_driver = |
+ contents ? favicon::ContentFaviconDriver::FromWebContents(contents) |
+ : nullptr; |
+ if (favicon_driver && favicon_driver->FaviconIsValid()) |
+ return favicon_driver->GetFavicon().IsEmpty(); |
+ |
+ return YES; |
+} |
+ |
} // namespace mac |