chromium/chrome/browser/favicon/favicon_utils.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/favicon/favicon_utils.h"

#include "base/hash/sha1.h"
#include "build/build_config.h"
#include "chrome/browser/favicon/favicon_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/monogram_utils.h"
#include "chrome/common/url_constants.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/grit/platform_locale_settings.h"
#include "components/favicon/content/content_favicon_driver.h"
#include "components/favicon/core/fallback_url_util.h"
#include "components/favicon/core/favicon_service.h"
#include "components/password_manager/content/common/web_ui_constants.h"
#include "content/public/browser/favicon_status.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/color/color_provider.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_analysis.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/favicon_size.h"
#include "ui/gfx/font_list.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_skia_operations.h"
#include "ui/native_theme/native_theme.h"
#include "ui/resources/grit/ui_resources.h"

#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/constants/ash_features.h"
#endif  // BUILDFLAG(IS_CHROMEOS_ASH)

namespace favicon {

namespace {

// The color of the letter drawn for a fallback icon.  Changing this may require
// changing the algorithm in ReturnRenderedIconForRequest() that guarantees
// contrast.
constexpr SkColor kFallbackIconLetterColor =;

// Desaturate favicon HSL shift values.
const double kDesaturateHue =;
const double kDesaturateSaturation =;
const double kDesaturateLightness =;

// Returns a color based on the hash of |icon_url|'s origin.
SkColor ComputeBackgroundColorForUrl(const GURL& icon_url) {}

// Gets the appropriate light or dark rasterized default favicon.
gfx::Image GetDefaultFaviconForColorScheme(bool is_dark) {}

}  // namespace

void CreateContentFaviconDriverForWebContents(
    content::WebContents* web_contents) {}

SkBitmap GenerateMonogramFavicon(GURL url, int icon_size, int circle_size) {}

gfx::Image TabFaviconFromWebContents(content::WebContents* contents) {}

gfx::Image GetDefaultFavicon() {}

ui::ImageModel GetDefaultFaviconModel(ui::ColorId bg_color) {}

void SaveFaviconEvenIfInIncognito(content::WebContents* contents) {}

bool ShouldThemifyFavicon(GURL url) {}

bool ShouldThemifyFaviconForEntry(content::NavigationEntry* entry) {}

gfx::ImageSkia ThemeFavicon(const gfx::ImageSkia& source,
                            SkColor alternate_color,
                            SkColor active_background,
                            SkColor inactive_background) {}

gfx::ImageSkia ThemeMonochromeFavicon(const gfx::ImageSkia& source,
                                      SkColor background) {}

}  // namespace favicon