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

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

Issue 10662041: mac: Remove nav.pdf in favor of IDR_DEFAULT_FAVICON. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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.h" 5 #include "chrome/browser/ui/cocoa/tab_contents/favicon_util.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_standard.h"
12 #include "skia/ext/skia_utils_mac.h" 13 #include "skia/ext/skia_utils_mac.h"
13 #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"
14 #include "ui/gfx/mac/nsimage_cache.h" 16 #include "ui/gfx/mac/nsimage_cache.h"
15 17
16 namespace mac { 18 namespace mac {
17 19
18 NSImage* FaviconForTabContents(TabContents* contents) { 20 NSImage* FaviconForTabContents(TabContents* contents) {
19 // FaviconTabHelper returns IDR_DEFAULT_FAVICON, which is a rasterized version 21 // FaviconTabHelper returns IDR_DEFAULT_FAVICON, which is a rasterized version
20 // of the Mac PDF. Use the PDF so the icon in the Omnibox matches the default 22 // of the Mac PDF. Use the PDF so the icon in the Omnibox matches the default
21 // favicon. 23 // favicon.
Avi (use Gerrit) 2012/06/26 14:28:27 Comment no longer is truthful.
Nico 2012/06/26 21:45:44 Done.
22 if (contents && contents->favicon_tab_helper()->FaviconIsValid()) { 24 if (contents && contents->favicon_tab_helper()->FaviconIsValid()) {
23 CGColorSpaceRef color_space = base::mac::GetSystemColorSpace(); 25 CGColorSpaceRef color_space = base::mac::GetSystemColorSpace();
24 NSImage* image = gfx::SkBitmapToNSImageWithColorSpace( 26 NSImage* image = gfx::SkBitmapToNSImageWithColorSpace(
25 contents->favicon_tab_helper()->GetFavicon(), color_space); 27 contents->favicon_tab_helper()->GetFavicon(), color_space);
26 // The |image| could be nil if the bitmap is null. In that case, fallback 28 // The |image| could be nil if the bitmap is null. In that case, fallback
27 // to the default image. 29 // to the default image.
28 if (image) { 30 if (image) {
29 return image; 31 return image;
30 } 32 }
31 } 33 }
32 34
33 return gfx::GetCachedImageWithName(@"nav.pdf"); 35 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
36 return rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON);
34 } 37 }
35 38
36 } // namespace mac 39 } // namespace mac
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698