Chromium Code Reviews| 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 "components/favicon/content/content_favicon_driver.h" | 10 #include "components/favicon/content/content_favicon_driver.h" |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 | 22 |
| 23 } // namespace | 23 } // namespace |
| 24 | 24 |
| 25 namespace mac { | 25 namespace mac { |
| 26 | 26 |
| 27 NSImage* FaviconForWebContents(content::WebContents* contents, SkColor color) { | 27 NSImage* FaviconForWebContents(content::WebContents* contents, SkColor color) { |
| 28 favicon::FaviconDriver* favicon_driver = | 28 favicon::FaviconDriver* favicon_driver = |
| 29 contents ? favicon::ContentFaviconDriver::FromWebContents(contents) | 29 contents ? favicon::ContentFaviconDriver::FromWebContents(contents) |
| 30 : nullptr; | 30 : nullptr; |
| 31 if (favicon_driver && favicon_driver->FaviconIsValid()) { | 31 if (favicon_driver && favicon_driver->FaviconIsValid()) { |
| 32 NSImage* image = favicon_driver->GetFavicon().AsNSImage(); | 32 NSImage* image = favicon_driver->GetFavicon().ToNSImage(); |
| 33 | |
| 33 // The |image| could be nil if the bitmap is null. In that case, fallback | 34 // The |image| could be nil if the bitmap is null. In that case, fallback |
|
Nico
2016/09/15 16:58:37
Is this still true now that you switched the call
spqchan
2016/09/15 22:07:04
Good point, the change was accidental
| |
| 34 // to the default image. | 35 // to the default image. |
| 35 if (image) { | 36 if (image) |
| 36 return image; | 37 return image; |
| 37 } | |
| 38 } | 38 } |
| 39 | 39 |
| 40 if (ui::MaterialDesignController::IsModeMaterial()) { | 40 if (ui::MaterialDesignController::IsModeMaterial()) { |
| 41 return NSImageFromImageSkia(gfx::CreateVectorIcon( | 41 return NSImageFromImageSkia(gfx::CreateVectorIcon( |
| 42 gfx::VectorIconId::DEFAULT_FAVICON, kVectorIconSize, color)); | 42 gfx::VectorIconId::DEFAULT_FAVICON, kVectorIconSize, color)); |
| 43 } | 43 } |
| 44 | 44 |
| 45 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 45 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 46 return rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON).ToNSImage(); | 46 return rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON).ToNSImage(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 } // namespace mac | 49 } // namespace mac |
| OLD | NEW |