diff options
author | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-14 15:52:27 +0000 |
---|---|---|
committer | rsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-14 15:52:27 +0000 |
commit | c9e2a17bc8e0362a89fa0ceb50228eb29396c009 (patch) | |
tree | 94975f121b3376f486aa70d364cf2e8f6bac0264 /chrome/browser/ui/cocoa/tabpose_window.mm | |
parent | 530cd6292136de5798bfd05c4ae960cba8e8b84b (diff) | |
download | chromium_src-c9e2a17bc8e0362a89fa0ceb50228eb29396c009.zip chromium_src-c9e2a17bc8e0362a89fa0ceb50228eb29396c009.tar.gz chromium_src-c9e2a17bc8e0362a89fa0ceb50228eb29396c009.tar.bz2 |
[Mac] Replace instances of IDR_DEFAULT_FAVICON with nav.pdf.
The PNG is a rasterized version of the PDF, so the colors are slightly
different. Some parts of the UI use the PDF and others use the PNG. This CL
reconciles that usage to always use the PDF for a consistent look.
BUG=27626
TEST=visual
Review URL: http://codereview.chromium.org/6812027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81594 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/cocoa/tabpose_window.mm')
-rw-r--r-- | chrome/browser/ui/cocoa/tabpose_window.mm | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/chrome/browser/ui/cocoa/tabpose_window.mm b/chrome/browser/ui/cocoa/tabpose_window.mm index 2626f72..d821c76 100644 --- a/chrome/browser/ui/cocoa/tabpose_window.mm +++ b/chrome/browser/ui/cocoa/tabpose_window.mm @@ -8,6 +8,7 @@ #include <algorithm> +#include "app/mac/nsimage_cache.h" #include "base/mac/mac_util.h" #include "base/mac/scoped_cftyperef.h" #include "base/memory/scoped_callback_factory.h" @@ -23,6 +24,7 @@ #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h" #import "chrome/browser/ui/cocoa/browser_window_controller.h" #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" +#import "chrome/browser/ui/cocoa/tab_contents/favicon_util.h" #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" #import "chrome/browser/ui/cocoa/tabs/tab_strip_model_observer_bridge.h" #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" @@ -436,7 +438,7 @@ class Tile { NSRect GetFaviconStartRectRelativeTo(const Tile& tile) const; NSRect favicon_rect() const { return NSIntegralRect(favicon_rect_); } - SkBitmap favicon() const; + NSImage* favicon() const; // This changes |title_rect| and |favicon_rect| such that the favicon is on // the font's baseline and that the minimum distance between thumb rect and @@ -497,13 +499,13 @@ NSRect Tile::GetFaviconStartRectRelativeTo(const Tile& tile) const { return rect; } -SkBitmap Tile::favicon() const { +NSImage* Tile::favicon() const { if (contents_->extension_tab_helper()->is_app()) { - SkBitmap* icon = contents_->extension_tab_helper()->GetExtensionAppIcon(); - if (icon) - return *icon; + SkBitmap* bitmap = contents_->extension_tab_helper()->GetExtensionAppIcon(); + if (bitmap) + return gfx::SkBitmapToNSImage(*bitmap); } - return contents_->tab_contents()->GetFavicon(); + return mac::FaviconForTabContents(contents_->tab_contents()); } NSRect Tile::GetTitleStartRectRelativeTo(const Tile& tile) const { @@ -1076,17 +1078,8 @@ void AnimateCALayerOpacityFromTo( NSFont* font = [NSFont systemFontOfSize:tile.title_font_size()]; tile.set_font_metrics([font ascender], -[font descender]); - NSImage* nsFavicon = gfx::SkBitmapToNSImage(tile.favicon()); - // Either we don't have a valid favicon or there was some issue converting - // it from an SkBitmap. Either way, just show the default. - if (!nsFavicon) { - NSImage* defaultFavicon = - ResourceBundle::GetSharedInstance().GetNativeImageNamed( - IDR_DEFAULT_FAVICON); - nsFavicon = defaultFavicon; - } base::mac::ScopedCFTypeRef<CGImageRef> favicon( - base::mac::CopyNSImageToCGImage(nsFavicon)); + base::mac::CopyNSImageToCGImage(tile.favicon())); CALayer* faviconLayer = [CALayer layer]; if (showZoom) { |