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

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

Issue 7200045: Move app/mac/ files to ui/gfx/mac/ directory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 6 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 "app/mac/nsimage_cache.h"
10 #include "base/mac/mac_util.h" 9 #include "base/mac/mac_util.h"
11 #include "chrome/browser/favicon/favicon_tab_helper.h" 10 #include "chrome/browser/favicon/favicon_tab_helper.h"
12 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
13 #include "skia/ext/skia_utils_mac.h" 12 #include "skia/ext/skia_utils_mac.h"
13 #include "ui/gfx/mac/nsimage_cache.h"
14 14
15 namespace mac { 15 namespace mac {
16 16
17 NSImage* FaviconForTabContents(TabContentsWrapper* contents) { 17 NSImage* FaviconForTabContents(TabContentsWrapper* contents) {
18 // TabContents returns IDR_DEFAULT_FAVICON, which is a rasterized version of 18 // TabContents returns IDR_DEFAULT_FAVICON, which is a rasterized version of
19 // the Mac PDF. Use the PDF so the icon in the Omnibox matches the default 19 // the Mac PDF. Use the PDF so the icon in the Omnibox matches the default
20 // favicon. 20 // favicon.
21 if (contents && contents->favicon_tab_helper()->FaviconIsValid()) { 21 if (contents && contents->favicon_tab_helper()->FaviconIsValid()) {
22 CGColorSpaceRef color_space = base::mac::GetSystemColorSpace(); 22 CGColorSpaceRef color_space = base::mac::GetSystemColorSpace();
23 NSImage* image = gfx::SkBitmapToNSImageWithColorSpace( 23 NSImage* image = gfx::SkBitmapToNSImageWithColorSpace(
24 contents->favicon_tab_helper()->GetFavicon(), color_space); 24 contents->favicon_tab_helper()->GetFavicon(), color_space);
25 // The |image| could be nil if the bitmap is null. In that case, fallback 25 // The |image| could be nil if the bitmap is null. In that case, fallback
26 // to the default image. 26 // to the default image.
27 if (image) { 27 if (image) {
28 return image; 28 return image;
29 } 29 }
30 } 30 }
31 31
32 return app::mac::GetCachedImageWithName(@"nav.pdf"); 32 return app::mac::GetCachedImageWithName(@"nav.pdf");
33 } 33 }
34 34
35 } // namespace mac 35 } // namespace mac
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698