chromium/components/favicon/core/favicon_handler.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 "components/favicon/core/favicon_handler.h"

#include <cmath>
#include <utility>
#include <vector>

#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/logging.h"
#include "base/memory/ref_counted_memory.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/ranges/algorithm.h"
#include "build/build_config.h"
#include "components/favicon/core/core_favicon_service.h"
#include "components/favicon_base/favicon_util.h"
#include "components/favicon_base/select_favicon_frames.h"
#include "skia/ext/image_operations.h"
#include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_util.h"

namespace favicon {
namespace {

const int kLargestIconSize =;

// Returns true if `bitmap_results` is non-empty and:
// - At least one of the bitmaps in `bitmap_results` is expired
// OR
// - `bitmap_results` is missing favicons for `desired_size_in_dip` and one of
//   the scale factors in favicon_base::GetFaviconScales().
bool HasExpiredOrIncompleteResult(
    int desired_size_in_dip,
    const std::vector<favicon_base::FaviconRawBitmapResult>& bitmap_results) {}

// Returns true if at least one of `bitmap_results` is valid.
bool HasValidResult(
    const std::vector<favicon_base::FaviconRawBitmapResult>& bitmap_results) {}

std::vector<int> GetDesiredPixelSizes(
    FaviconDriverObserver::NotificationIconType handler_type) {}

bool FaviconURLEquals(const FaviconURL& lhs, const FaviconURL& rhs) {}

// Returns true if `icon_sizes` has the "any" size keyword specified. The 'any'
// value is represented as the size 0x0 (e.g `gfx::Size()` or the predicate
// `gfx::Size::IsZero()`). "0x0" (or generally, a 0 dimension) is considered an
// invalid size by the 'sizes' parser (see for example `WebIconSizesParser` in
// Blink).
bool HasAnySize(const std::vector<gfx::Size>& icon_sizes) {}

}  // namespace

////////////////////////////////////////////////////////////////////////////////

// static
FaviconHandler::FaviconCandidate
FaviconHandler::FaviconCandidate::FromFaviconURL(
    const favicon::FaviconURL& favicon_url,
    const std::vector<int>& desired_pixel_sizes,
    bool want_largest_icon) {}

////////////////////////////////////////////////////////////////////////////////

FaviconHandler::FaviconHandler(
    CoreFaviconService* service,
    Delegate* delegate,
    FaviconDriverObserver::NotificationIconType handler_type)
    :{}

FaviconHandler::~FaviconHandler() = default;

// static
favicon_base::IconTypeSet FaviconHandler::GetIconTypesFromHandlerType(
    FaviconDriverObserver::NotificationIconType handler_type) {}

void FaviconHandler::FetchFavicon(const GURL& page_url, bool is_same_document) {}

bool FaviconHandler::ShouldDownloadNextCandidate() const {}

void FaviconHandler::SetFavicon(const GURL& icon_url,
                                const gfx::Image& image,
                                favicon_base::IconType icon_type) {}

void FaviconHandler::MaybeDeleteFaviconMappings() {}

void FaviconHandler::NotifyFaviconUpdated(
    const std::vector<favicon_base::FaviconRawBitmapResult>&
        favicon_bitmap_results) {}

void FaviconHandler::NotifyFaviconUpdated(const GURL& icon_url,
                                          favicon_base::IconType icon_type,
                                          const gfx::Image& image) {}

void FaviconHandler::OnUpdateCandidates(
    const GURL& page_url,
    const std::vector<FaviconURL>& candidates,
    const GURL& manifest_url) {}

void FaviconHandler::OnFaviconDataForManifestFromFaviconService(
    const std::vector<favicon_base::FaviconRawBitmapResult>&
        favicon_bitmap_results) {}

void FaviconHandler::OnDidDownloadManifest(
    const std::vector<FaviconURL>& candidates) {}

void FaviconHandler::OnGotFinalIconURLCandidates(
    const std::vector<FaviconURL>& candidates) {}

// static
int FaviconHandler::GetMaximalIconSize(
    FaviconDriverObserver::NotificationIconType handler_type,
    bool candidates_from_web_manifest) {}

void FaviconHandler::OnGotInitialHistoryDataAndIconURLCandidates() {}

void FaviconHandler::OnDidDownloadFavicon(
    favicon_base::IconType icon_type,
    int id,
    int http_status_code,
    const GURL& image_url,
    const std::vector<SkBitmap>& bitmaps,
    const std::vector<gfx::Size>& original_bitmap_sizes) {}

const std::vector<GURL> FaviconHandler::GetIconURLs() const {}

bool FaviconHandler::HasPendingTasksForTest() {}

void FaviconHandler::OnFaviconDataForInitialURLFromFaviconService(
    const std::vector<favicon_base::FaviconRawBitmapResult>&
        favicon_bitmap_results) {}

void FaviconHandler::DownloadCurrentCandidateOrAskFaviconService() {}

void FaviconHandler::GetFaviconAndUpdateMappingsUnlessIncognito(
    const GURL& icon_url,
    favicon_base::IconType icon_type,
    favicon_base::FaviconResultsCallback callback) {}

void FaviconHandler::OnFaviconData(
    const std::vector<favicon_base::FaviconRawBitmapResult>&
        favicon_bitmap_results) {}

void FaviconHandler::ScheduleImageDownload(const GURL& image_url,
                                           favicon_base::IconType icon_type) {}

}  // namespace favicon