#include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
#include <stddef.h>
#include <memory>
#include <string_view>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/ref_counted_memory.h"
#include "base/memory/scoped_refptr.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/threading/thread.h"
#include "chrome/browser/favicon/favicon_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/component_extension_resources_map.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/image_loader.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_resource.h"
#include "extensions/common/manifest_handlers/icons_handler.h"
#include "extensions/grit/extensions_browser_resources.h"
#include "skia/ext/image_operations.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/resource/resource_scale_factor.h"
#include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/favicon_size.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/skbitmap_operations.h"
#include "url/gurl.h"
namespace extensions {
namespace {
scoped_refptr<base::RefCountedMemory> BitmapToMemory(const SkBitmap* image) { … }
SkBitmap DesaturateImage(const SkBitmap* image) { … }
SkBitmap* ToBitmap(const unsigned char* data, size_t size) { … }
}
ExtensionIconSource::ExtensionIconSource(Profile* profile) : … { … }
struct ExtensionIconSource::ExtensionIconRequest { … };
GURL ExtensionIconSource::GetIconURL(const Extension* extension,
int icon_size,
ExtensionIconSet::Match match,
bool grayscale) { … }
GURL ExtensionIconSource::GetIconURL(const std::string& extension_id,
int icon_size,
ExtensionIconSet::Match match,
bool grayscale) { … }
SkBitmap* ExtensionIconSource::LoadImageByResourceId(int resource_id) { … }
std::string ExtensionIconSource::GetSource() { … }
std::string ExtensionIconSource::GetMimeType(const GURL&) { … }
void ExtensionIconSource::StartDataRequest(
const GURL& url,
const content::WebContents::Getter& wc_getter,
content::URLDataSource::GotDataCallback callback) { … }
bool ExtensionIconSource::AllowCaching() { … }
ExtensionIconSource::~ExtensionIconSource() { … }
const SkBitmap* ExtensionIconSource::GetDefaultAppImage() { … }
const SkBitmap* ExtensionIconSource::GetDefaultExtensionImage() { … }
void ExtensionIconSource::FinalizeImage(const SkBitmap* image,
int request_id) { … }
void ExtensionIconSource::LoadDefaultImage(int request_id) { … }
void ExtensionIconSource::LoadExtensionImage(const ExtensionResource& icon,
int request_id) { … }
void ExtensionIconSource::LoadFaviconImage(int request_id) { … }
void ExtensionIconSource::OnFaviconDataAvailable(
int request_id,
const favicon_base::FaviconRawBitmapResult& bitmap_result) { … }
void ExtensionIconSource::OnImageLoaded(int request_id,
const gfx::Image& image) { … }
void ExtensionIconSource::LoadIconFailed(int request_id) { … }
bool ExtensionIconSource::ParseData(
const std::string& path,
int request_id,
content::URLDataSource::GotDataCallback* callback) { … }
void ExtensionIconSource::SetData(
int request_id,
content::URLDataSource::GotDataCallback callback,
const Extension* extension,
bool grayscale,
int size,
ExtensionIconSet::Match match) { … }
ExtensionIconSource::ExtensionIconRequest* ExtensionIconSource::GetData(
int request_id) { … }
void ExtensionIconSource::ClearData(int request_id) { … }
}