OLD | NEW |
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 <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
10 #include "chrome/app/vector_icons/vector_icons.h" | 10 #include "chrome/app/vector_icons/vector_icons.h" |
11 #include "chrome/browser/favicon/favicon_utils.h" | 11 #include "chrome/browser/favicon/favicon_utils.h" |
12 #include "skia/ext/skia_utils_mac.h" | 12 #include "skia/ext/skia_utils_mac.h" |
13 #include "ui/base/material_design/material_design_controller.h" | 13 #include "ui/base/material_design/material_design_controller.h" |
14 #include "ui/gfx/image/image.h" | 14 #include "ui/gfx/image/image.h" |
15 #include "ui/gfx/image/image_skia_util_mac.h" | 15 #include "ui/gfx/image/image_skia_util_mac.h" |
16 #include "ui/gfx/paint_vector_icon.h" | 16 #include "ui/gfx/paint_vector_icon.h" |
17 #include "ui/resources/grit/ui_resources.h" | |
18 | 17 |
19 namespace { | 18 namespace { |
20 | 19 |
21 const CGFloat kVectorIconSize = 16; | 20 const CGFloat kVectorIconSize = 16; |
22 | 21 |
23 } // namespace | 22 } // namespace |
24 | 23 |
25 namespace mac { | 24 namespace mac { |
26 | 25 |
27 NSImage* FaviconForWebContents(content::WebContents* contents, SkColor color) { | 26 NSImage* FaviconForWebContents(content::WebContents* contents, SkColor color) { |
28 if (contents) { | 27 if (contents) { |
29 NSImage* image = favicon::TabFaviconFromWebContents(contents).AsNSImage(); | 28 NSImage* image = favicon::TabFaviconFromWebContents(contents).AsNSImage(); |
30 | 29 |
31 // The |image| could be nil if the bitmap is null. In that case, fallback | 30 // The |image| could be nil if the bitmap is null. In that case, fallback |
32 // to the default image. | 31 // to the default image. |
33 if (image) | 32 if (image) |
34 return image; | 33 return image; |
35 } | 34 } |
36 | 35 |
37 return NSImageFromImageSkia( | 36 return NSImageFromImageSkia( |
38 gfx::CreateVectorIcon(kDefaultFaviconIcon, kVectorIconSize, color)); | 37 gfx::CreateVectorIcon(kDefaultFaviconIcon, kVectorIconSize, color)); |
39 } | 38 } |
40 | 39 |
41 } // namespace mac | 40 } // namespace mac |
OLD | NEW |