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

Unified Diff: chrome/browser/ui/cocoa/tab_contents/favicon_util_mac.mm

Issue 2126043002: [Material][Mac] Fix Default Favicon's Color (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleaned up Created 4 years, 5 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
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

Powered by Google App Engine
This is Rietveld 408576698