#include "components/favicon/core/favicon_backend.h"
#include "base/containers/contains.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/rand_util.h"
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
#include "components/favicon/core/favicon_backend_delegate.h"
#include "components/favicon/core/favicon_database.h"
#include "components/favicon_base/favicon_util.h"
#include "components/favicon_base/select_favicon_frames.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/codec/png_codec.h"
#include "url/origin.h"
namespace favicon {
RedirectList;
namespace {
constexpr base::TimeDelta kFaviconRefetchDelta = …;
bool IsFaviconBitmapExpired(base::Time last_updated) { … }
bool AreIconTypesEquivalent(favicon_base::IconType type_a,
favicon_base::IconType type_b) { … }
}
std::unique_ptr<FaviconBackend> FaviconBackend::Create(
const base::FilePath& path,
FaviconBackendDelegate* delegate) { … }
FaviconBackend::~FaviconBackend() { … }
void FaviconBackend::Commit() { … }
void FaviconBackend::TrimMemory() { … }
favicon_base::FaviconRawBitmapResult FaviconBackend::GetLargestFaviconForUrl(
const GURL& page_url,
const std::vector<favicon_base::IconTypeSet>& icon_types_list,
int minimum_size_in_pixels) { … }
std::vector<favicon_base::FaviconRawBitmapResult>
FaviconBackend::GetFaviconsForUrl(const GURL& page_url,
const favicon_base::IconTypeSet& icon_types,
const std::vector<int>& desired_sizes,
bool fallback_to_host) { … }
std::vector<favicon_base::FaviconRawBitmapResult>
FaviconBackend::GetFaviconForId(favicon_base::FaviconID favicon_id,
int desired_size) { … }
UpdateFaviconMappingsResult FaviconBackend::UpdateFaviconMappingsAndFetch(
const base::flat_set<GURL>& page_urls,
const GURL& icon_url,
favicon_base::IconType icon_type,
const std::vector<int>& desired_sizes) { … }
base::flat_set<GURL> FaviconBackend::DeleteFaviconMappings(
const base::flat_set<GURL>& page_urls,
favicon_base::IconType icon_type) { … }
MergeFaviconResult FaviconBackend::MergeFavicon(
const GURL& page_url,
const GURL& icon_url,
favicon_base::IconType icon_type,
scoped_refptr<base::RefCountedMemory> bitmap_data,
const gfx::Size& pixel_size) { … }
std::set<GURL> FaviconBackend::CloneFaviconMappingsForPages(
const GURL& page_url_to_read,
const favicon_base::IconTypeSet& icon_types,
const base::flat_set<GURL>& page_urls_to_write) { … }
std::vector<GURL> FaviconBackend::GetFaviconUrlsForUrl(const GURL& page_url) { … }
bool FaviconBackend::CanSetOnDemandFavicons(const GURL& page_url,
favicon_base::IconType icon_type) { … }
SetFaviconsResult FaviconBackend::SetOnDemandFavicons(
const GURL& page_url,
favicon_base::IconType icon_type,
const GURL& icon_url,
const std::vector<SkBitmap>& bitmaps) { … }
bool FaviconBackend::SetFaviconsOutOfDateForPage(const GURL& page_url) { … }
bool FaviconBackend::SetFaviconsOutOfDateBetween(base::Time begin,
base::Time end) { … }
void FaviconBackend::TouchOnDemandFavicon(const GURL& icon_url) { … }
SetFaviconsResult FaviconBackend::SetFavicons(
const base::flat_set<GURL>& page_urls,
favicon_base::IconType icon_type,
const GURL& icon_url,
const std::vector<SkBitmap>& bitmaps,
FaviconBitmapType bitmap_type) { … }
FaviconBackend::FaviconBackend(std::unique_ptr<FaviconDatabase> db,
FaviconBackendDelegate* delegate)
: … { … }
bool FaviconBackend::SetFaviconBitmaps(favicon_base::FaviconID icon_id,
const std::vector<SkBitmap>& bitmaps,
FaviconBitmapType type) { … }
bool FaviconBackend::IsFaviconBitmapDataEqual(
FaviconBitmapID bitmap_id,
const scoped_refptr<base::RefCountedMemory>& new_bitmap_data) { … }
std::vector<favicon_base::FaviconRawBitmapResult>
FaviconBackend::GetFaviconsFromDB(const GURL& page_url,
const favicon_base::IconTypeSet& icon_types,
const std::vector<int>& desired_sizes,
bool fallback_to_host) { … }
std::vector<favicon_base::FaviconRawBitmapResult>
FaviconBackend::GetFaviconBitmapResultsForBestMatch(
const std::vector<favicon_base::FaviconID>& candidate_favicon_ids,
const std::vector<int>& desired_sizes) { … }
bool FaviconBackend::SetFaviconMappingsForPageAndRedirects(
const GURL& page_url,
favicon_base::IconType icon_type,
favicon_base::FaviconID icon_id) { … }
std::vector<GURL> FaviconBackend::SetFaviconMappingsForPages(
const base::flat_set<GURL>& page_urls,
favicon_base::IconType icon_type,
favicon_base::FaviconID icon_id) { … }
bool FaviconBackend::SetFaviconMappingsForPage(
const GURL& page_url,
favicon_base::IconType icon_type,
favicon_base::FaviconID icon_id) { … }
bool FaviconBackend::ClearAllExcept(const std::vector<GURL>& kept_page_urls) { … }
}