Commit c598cda6 authored by Nico Weber's avatar Nico Weber

mac: Remove unused favicon_util_mac

Bug: 832676
Change-Id: I3088c0fa54d5b549f27dd158bbe46ec7834360a8
Reviewed-on: https://chromium-review.googlesource.com/1255207
Commit-Queue: Nico Weber <thakis@chromium.org>
Reviewed-by: default avatarWei Li <weili@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595524}
parent 4679a2dc
...@@ -120,8 +120,6 @@ jumbo_split_static_library("ui") { ...@@ -120,8 +120,6 @@ jumbo_split_static_library("ui") {
"cocoa/single_web_contents_dialog_manager_cocoa.mm", "cocoa/single_web_contents_dialog_manager_cocoa.mm",
"cocoa/ssl_client_certificate_selector_cocoa.h", "cocoa/ssl_client_certificate_selector_cocoa.h",
"cocoa/ssl_client_certificate_selector_cocoa.mm", "cocoa/ssl_client_certificate_selector_cocoa.mm",
"cocoa/tab_contents/favicon_util_mac.h",
"cocoa/tab_contents/favicon_util_mac.mm",
"cocoa/tab_contents/overlayable_contents_controller.h", "cocoa/tab_contents/overlayable_contents_controller.h",
"cocoa/tab_contents/overlayable_contents_controller.mm", "cocoa/tab_contents/overlayable_contents_controller.mm",
"cocoa/tab_contents/tab_contents_controller.h", "cocoa/tab_contents/tab_contents_controller.h",
......
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_FAVICON_UTIL_MAC_H_
#define CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_FAVICON_UTIL_MAC_H_
#include "third_party/skia/include/core/SkColor.h"
@class NSImage;
namespace content {
class WebContents;
}
namespace mac {
// Returns an autoreleased favicon for a given WebContents. If |contents|
// is NULL or there's no favicon for the NavigationEntry, this will return the
// default image. The color parameter is only used for the default vector image
// in Material design.
NSImage* FaviconForWebContents(content::WebContents* contents,
SkColor color = SK_ColorBLACK);
} // namespace mac
#endif // CHROME_BROWSER_UI_COCOA_TAB_CONTENTS_FAVICON_UTIL_MAC_H_
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/cocoa/tab_contents/favicon_util_mac.h"
#import <Cocoa/Cocoa.h>
#include "base/mac/scoped_nsobject.h"
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/favicon/favicon_utils.h"
#include "skia/ext/skia_utils_mac.h"
#include "ui/base/material_design/material_design_controller.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_skia_util_mac.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/resources/grit/ui_resources.h"
namespace {
const CGFloat kVectorIconSize = 16;
bool HasDefaultFavicon(content::WebContents* contents) {
gfx::Image favicon = favicon::TabFaviconFromWebContents(contents);
if (favicon.IsEmpty())
return false;
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
const gfx::ImageSkia* default_favicon =
rb.GetImageSkiaNamed(IDR_DEFAULT_FAVICON);
return favicon.ToImageSkia()->BackedBySameObjectAs(*default_favicon);
}
} // namespace
namespace mac {
NSImage* FaviconForWebContents(content::WebContents* contents, SkColor color) {
// If |contents| is using the default favicon, it needs to be drawn in
// |color|, which means this function can't necessarily reuse the existing
// favicon.
if (contents && !HasDefaultFavicon(contents)) {
NSImage* image = favicon::TabFaviconFromWebContents(contents).AsNSImage();
// The |image| could be nil if the bitmap is null. In that case, fallback
// to the default image.
if (image)
return image;
}
return NSImageFromImageSkia(
gfx::CreateVectorIcon(kDefaultFaviconIcon, kVectorIconSize, color));
}
} // namespace mac
...@@ -18,10 +18,6 @@ ...@@ -18,10 +18,6 @@
#include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_bundle.h"
#include "ui/resources/grit/ui_resources.h" #include "ui/resources/grit/ui_resources.h"
#if defined(OS_MACOSX)
#include "chrome/browser/ui/views_mode_controller.h"
#endif
namespace { namespace {
base::string16 FormatUrlToSubdomain(const GURL& url) { base::string16 FormatUrlToSubdomain(const GURL& url) {
...@@ -60,15 +56,6 @@ base::string16 TabUIHelper::GetTitle() const { ...@@ -60,15 +56,6 @@ base::string16 TabUIHelper::GetTitle() const {
gfx::Image TabUIHelper::GetFavicon() const { gfx::Image TabUIHelper::GetFavicon() const {
if (ShouldUseFaviconFromHistory() && tab_ui_data_) if (ShouldUseFaviconFromHistory() && tab_ui_data_)
return tab_ui_data_->favicon; return tab_ui_data_->favicon;
#if defined(OS_MACOSX)
if (views_mode_controller::IsViewsBrowserCocoa())
return gfx::Image();
// For views browser windows on Mac, it will fall through to be handled
// in the following function. If default favicon needs to be drawn more
// visible on dark theme, consider porting code from
// mac::FaviconForWebContents().
#endif
return favicon::TabFaviconFromWebContents(web_contents()); return favicon::TabFaviconFromWebContents(web_contents());
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment