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

Side by Side Diff: chrome/browser/ui/cocoa/tab_contents/favicon_util_mac.mm

Issue 10853018: Fall back to the default favicon on invalid favicon files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/gfx/image/image.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/cocoa/tab_contents/favicon_util_mac.h" 5 #include "chrome/browser/ui/cocoa/tab_contents/favicon_util_mac.h"
6 6
7 #import <AppKit/AppKit.h> 7 #import <AppKit/AppKit.h>
8 8
9 #include "base/mac/mac_util.h" 9 #include "base/mac/mac_util.h"
10 #include "chrome/browser/favicon/favicon_tab_helper.h" 10 #include "chrome/browser/favicon/favicon_tab_helper.h"
11 #include "chrome/browser/ui/tab_contents/tab_contents.h" 11 #include "chrome/browser/ui/tab_contents/tab_contents.h"
12 #include "grit/ui_resources.h" 12 #include "grit/ui_resources.h"
13 #include "skia/ext/skia_utils_mac.h" 13 #include "skia/ext/skia_utils_mac.h"
14 #include "third_party/skia/include/core/SkBitmap.h" 14 #include "third_party/skia/include/core/SkBitmap.h"
15 #include "ui/base/resource/resource_bundle.h" 15 #include "ui/base/resource/resource_bundle.h"
16 #include "ui/gfx/mac/nsimage_cache.h" 16 #include "ui/gfx/mac/nsimage_cache.h"
17 17
18 namespace mac { 18 namespace mac {
19 19
20 NSImage* FaviconForTabContents(TabContents* contents) { 20 NSImage* FaviconForTabContents(TabContents* contents) {
21 if (contents && contents->favicon_tab_helper()->FaviconIsValid()) { 21 if (contents && contents->favicon_tab_helper()->FaviconIsValid()) {
22 NSImage* image = contents->favicon_tab_helper()->GetFavicon().ToNSImage(); 22 NSImage* image = contents->favicon_tab_helper()->GetFavicon().AsNSImage();
Nico 2012/08/05 04:44:48 (Also fixes a frequent crasher on mac that I intro
23 // The |image| could be nil if the bitmap is null. In that case, fallback 23 // The |image| could be nil if the bitmap is null. In that case, fallback
24 // to the default image. 24 // to the default image.
25 if (image) { 25 if (image) {
26 return image; 26 return image;
27 } 27 }
28 } 28 }
29 29
30 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 30 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
31 return rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON); 31 return rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON);
32 } 32 }
33 33
34 } // namespace mac 34 } // namespace mac
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/image/image.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698