#include "chrome/browser/ui/webui/fileicon_source.h"
#include <string_view>
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/ref_counted_memory.h"
#include "base/strings/escape.h"
#include "base/strings/string_split.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/common/webui_url_constants.h"
#include "net/base/url_util.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/webui/web_ui_util.h"
#include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_skia_rep.h"
#include "url/gurl.h"
namespace {
QueryIconSizeMap;
const char kFileIconPath[] = …;
const char kIconSizeParameter[] = …;
const char kPathParameter[] = …;
const char kScaleFactorParameter[] = …;
IconLoader::IconSize SizeStringToIconSize(std::string_view size_string) { … }
void ParseQueryParams(const std::string& path,
base::FilePath* file_path,
float* scale_factor,
IconLoader::IconSize* icon_size) { … }
}
FileIconSource::IconRequestDetails::IconRequestDetails() = default;
FileIconSource::IconRequestDetails::IconRequestDetails(
IconRequestDetails&& other) = default;
FileIconSource::IconRequestDetails& FileIconSource::IconRequestDetails::
operator=(IconRequestDetails&& other) = default;
FileIconSource::IconRequestDetails::~IconRequestDetails() = default;
FileIconSource::FileIconSource() = default;
FileIconSource::~FileIconSource() = default;
void FileIconSource::FetchFileIcon(
const base::FilePath& path,
float scale_factor,
IconLoader::IconSize icon_size,
content::URLDataSource::GotDataCallback callback) { … }
std::string FileIconSource::GetSource() { … }
void FileIconSource::StartDataRequest(
const GURL& url,
const content::WebContents::Getter& wc_getter,
content::URLDataSource::GotDataCallback callback) { … }
std::string FileIconSource::GetMimeType(const GURL&) { … }
bool FileIconSource::AllowCaching() { … }
void FileIconSource::OnFileIconDataAvailable(IconRequestDetails details,
gfx::Image icon) { … }