chromium/components/favicon/core/large_icon_service_impl.cc

// Copyright 2015 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/large_icon_service_impl.h"

#include <algorithm>
#include <optional>
#include <string>

#include "base/functional/bind.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/metrics/histogram_macros.h"
#include "base/no_destructor.h"
#include "base/strings/stringprintf.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/task_runner.h"
#include "base/task/thread_pool.h"
#include "components/favicon/core/favicon_service.h"
#include "components/favicon/core/large_icon_worker.h"
#include "components/favicon_base/favicon_util.h"
#include "components/image_fetcher/core/request_metadata.h"
#include "net/base/network_change_notifier.h"
#include "url/url_canon.h"

namespace favicon {

namespace {

GoogleFaviconServerRequestStatus;
StandardIconSize;
NoBigEnoughIconBehavior;

const char kImageFetcherUmaClient[] =;

const char kGoogleServerV2Url[] =;

// `check_seen` is a legacy parameter which prevents the Google-favicon-server
// from crawling a URL as a result of a Google-favicon-server request in order
// to prevent Google from trying to crawl enterprise/private URLs. Currently the
// Google-favicon-server ignores the `check_seen` parameter and never triggers
// Google crawling a URL. check_seen is set explicitly set explicitly in the
// request URL to make sure `LargeIconService` behavior is not affected if this
// changes at any point in time.
const char kGoogleServerV2RequestFormat[] =;

const int kGoogleServerV2EnforcedMinSizeInPixel =;

const double kGoogleServerV2DesiredToMaxSizeFactor =;

const int kGoogleServerV2MinimumMaxSizeInPixel =;

GURL TrimPageUrlForGoogleServer(const GURL& page_url,
                                bool should_trim_page_url_path) {}

GURL GetRequestUrlForGoogleServerV2(
    const GURL& page_url,
    const std::string& google_server_client_param,
    int desired_size_in_pixel,
    const GURL& server_url) {}

void FinishServerRequestAsynchronously(
    favicon_base::GoogleFaviconServerCallback callback,
    favicon_base::GoogleFaviconServerRequestStatus status) {}

void ReportDownloadedSize(int size) {}

void OnSetOnDemandFaviconComplete(
    favicon_base::GoogleFaviconServerCallback callback,
    bool success) {}

void OnFetchIconFromGoogleServerComplete(
    FaviconService* favicon_service,
    const GURL& page_url,
    const GURL& server_request_url,
    favicon_base::IconType icon_type,
    favicon_base::GoogleFaviconServerCallback callback,
    const gfx::Image& image,
    const image_fetcher::RequestMetadata& metadata) {}

float GetMaxDeviceScale() {}

int IconSizeToInt(StandardIconSize icon_size) {}

}  // namespace

LargeIconServiceImpl::LargeIconServiceImpl(
    FaviconService* favicon_service,
    std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher,
    int desired_size_in_dip_for_server_requests,
    favicon_base::IconType icon_type_for_server_requests,
    const std::string& google_server_client_param)
    :{}

LargeIconServiceImpl::~LargeIconServiceImpl() {}

base::CancelableTaskTracker::TaskId
LargeIconServiceImpl::GetLargeIconRawBitmapOrFallbackStyleForPageUrl(
    const GURL& page_url,
    int min_source_size_in_pixel,
    int desired_size_in_pixel,
    favicon_base::LargeIconCallback raw_bitmap_callback,
    base::CancelableTaskTracker* tracker) {}

base::CancelableTaskTracker::TaskId
LargeIconServiceImpl::GetLargeIconImageOrFallbackStyleForPageUrl(
    const GURL& page_url,
    int min_source_size_in_pixel,
    int desired_size_in_pixel,
    favicon_base::LargeIconImageCallback image_callback,
    base::CancelableTaskTracker* tracker) {}

base::CancelableTaskTracker::TaskId
LargeIconServiceImpl::GetLargeIconRawBitmapForPageUrl(
    const GURL& page_url,
    int min_source_size_in_pixel,
    std::optional<int> size_in_pixel_to_resize_to,
    NoBigEnoughIconBehavior no_big_enough_icon_behavior,
    favicon_base::LargeIconCallback callback,
    base::CancelableTaskTracker* tracker) {}

base::CancelableTaskTracker::TaskId
LargeIconServiceImpl::GetLargeIconRawBitmapOrFallbackStyleForIconUrl(
    const GURL& icon_url,
    int min_source_size_in_pixel,
    int desired_size_in_pixel,
    favicon_base::LargeIconCallback raw_bitmap_callback,
    base::CancelableTaskTracker* tracker) {}

base::CancelableTaskTracker::TaskId
LargeIconServiceImpl::GetIconRawBitmapOrFallbackStyleForPageUrl(
    const GURL& page_url,
    int desired_size_in_pixel,
    favicon_base::LargeIconCallback callback,
    base::CancelableTaskTracker* tracker) {}

void LargeIconServiceImpl::
    GetLargeIconOrFallbackStyleFromGoogleServerSkippingLocalCache(
        const GURL& page_url,
        bool should_trim_page_url_path,
        const net::NetworkTrafficAnnotationTag& traffic_annotation,
        favicon_base::GoogleFaviconServerCallback callback) {}

void LargeIconServiceImpl::GetLargeIconFromCacheFallbackToGoogleServer(
    const GURL& page_url,
    StandardIconSize min_source_size,
    std::optional<StandardIconSize> size_to_resize_to,
    NoBigEnoughIconBehavior no_big_enough_icon_behavior,
    bool should_trim_page_url_path,
    const net::NetworkTrafficAnnotationTag& traffic_annotation,
    favicon_base::LargeIconCallback callback,
    base::CancelableTaskTracker* tracker) {}

void LargeIconServiceImpl::OnIconFetchedFromCache(
    const GURL& page_url,
    int min_source_size_in_pixel,
    std::optional<int> size_in_pixel_to_resize_to,
    NoBigEnoughIconBehavior no_big_enough_icon_behavior,
    bool should_trim_page_url_path,
    const net::NetworkTrafficAnnotationTag& traffic_annotation,
    favicon_base::LargeIconCallback callback,
    base::CancelableTaskTracker* tracker,
    const favicon_base::LargeIconResult& icon_result) {}

void LargeIconServiceImpl::OnIconFetchedFromServer(
    const GURL& page_url,
    int min_source_size_in_pixel,
    std::optional<int> size_in_pixel_to_resize_to,
    favicon_base::LargeIconCallback callback,
    base::CancelableTaskTracker::IsCanceledCallback was_task_canceled_callback,
    MayBeDangling<base::CancelableTaskTracker> tracker,
    favicon_base::GoogleFaviconServerRequestStatus status) {}

void LargeIconServiceImpl::TouchIconFromGoogleServer(const GURL& icon_url) {}

void LargeIconServiceImpl::SetServerUrlForTesting(
    const GURL& server_url_for_testing) {}

base::CancelableTaskTracker::TaskId
LargeIconServiceImpl::GetLargeIconOrFallbackStyleImpl(
    const GURL& page_url,
    int min_source_size_in_pixel,
    std::optional<int> size_in_pixel_to_resize_to,
    NoBigEnoughIconBehavior no_big_enough_icon_behavior,
    favicon_base::LargeIconCallback raw_bitmap_callback,
    favicon_base::LargeIconImageCallback image_callback,
    base::CancelableTaskTracker* tracker) {}

void LargeIconServiceImpl::OnCanSetOnDemandFaviconComplete(
    const GURL& server_request_url,
    const GURL& page_url,
    const net::NetworkTrafficAnnotationTag& traffic_annotation,
    favicon_base::GoogleFaviconServerCallback callback,
    bool can_set_on_demand_favicon) {}

}  // namespace favicon