Commit 81e513a9 authored by thakis@chromium.org's avatar thakis@chromium.org

Fall back to the default favicon on invalid favicon files.

I regressed this in r149891.

BUG=140689

Review URL: https://chromiumcodereview.appspot.com/10853018

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150092 0039d316-1c4b-4281-b951-d872f2087c98
parent 7cd52e4b
......@@ -13,7 +13,7 @@ namespace mac {
NSImage* FaviconForTabContents(TabContents* contents) {
if (contents && contents->favicon_tab_helper()->FaviconIsValid()) {
NSImage* image = contents->favicon_tab_helper()->GetFavicon().ToNSImage();
NSImage* image = contents->favicon_tab_helper()->GetFavicon().AsNSImage();
// The |image| could be nil if the bitmap is null. In that case, fallback
// to the default image.
if (image) {
......
......@@ -342,9 +342,15 @@ SkBitmap Image::AsBitmap() const {
}
ImageSkia Image::AsImageSkia() const {
return IsEmpty() ? ImageSkia(SkBitmap()) : *ToImageSkia();
return IsEmpty() ? ImageSkia() : *ToImageSkia();
}
#if defined(OS_MACOSX)
NSImage* Image::AsNSImage() const {
return IsEmpty() ? nil : ToNSImage();
}
#endif
ImageSkia* Image::CopyImageSkia() const {
return new ImageSkia(*ToImageSkia());
}
......
......@@ -97,7 +97,7 @@ class UI_EXPORT Image {
// Converts the Image to the desired representation and stores it internally.
// The returned result is a weak pointer owned by and scoped to the life of
// the Image.
// the Image. Must only be called if IsEmpty() is false.
const SkBitmap* ToSkBitmap() const;
const ImageSkia* ToImageSkia() const;
#if defined(TOOLKIT_GTK)
......@@ -110,10 +110,15 @@ class UI_EXPORT Image {
// Same as ToSkBitmap(), but returns a null SkBitmap if this image is empty.
SkBitmap AsBitmap() const;
// Same as ToSkBitmap(), but returns a ImageSkia with a null SkBitmap if this
// Same as ToImageSkia(), but returns an empty ImageSkia if this
// image is empty.
ImageSkia AsImageSkia() const;
#if defined(OS_MACOSX)
// Same as ToSkBitmap(), but returns nil if this image is empty.
NSImage* AsNSImage() const;
#endif
// Performs a conversion, like above, but returns a copy of the result rather
// than a weak pointer. The caller is responsible for deleting the result.
// Note that the result is only a copy in terms of memory management; the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment