#include "chrome/browser/web_applications/web_contents/web_app_icon_downloader.h"
#include <string>
#include <tuple>
#include <vector>
#include "base/check_op.h"
#include "base/containers/flat_set.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/metrics/field_trial_params.h"
#include "base/metrics/histogram_functions.h"
#include "base/task/sequenced_task_runner.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "chrome/browser/web_applications/web_app_constants.h"
#include "chrome/browser/web_applications/web_app_helpers.h"
#include "chrome/browser/web_applications/web_app_install_utils.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
#include "net/http/http_status_code.h"
#include "third_party/blink/public/mojom/favicon/favicon_url.mojom.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/geometry/size.h"
namespace web_app {
namespace {
BASE_FEATURE(…);
base::FeatureParam<base::TimeDelta> kTimeoutTime(
&kIconDownloaderTimeout,
"timeout_time",
WebAppIconDownloader::kDefaultSecondsToWaitForIconDownloading);
bool WebContentsShuttingDown(content::WebContents* web_contents) { … }
}
WebAppIconDownloader::WebAppIconDownloader() = default;
WebAppIconDownloader::~WebAppIconDownloader() = default;
void WebAppIconDownloader::Start(
content::WebContents* web_contents,
const IconUrlSizeSet& extra_icon_urls_with_sizes,
WebAppIconDownloaderCallback callback,
IconDownloaderOptions options) { … }
bool WebAppIconDownloader::IsRunning() { … }
int WebAppIconDownloader::DownloadImage(const GURL& url,
const gfx::Size& preferred_size) { … }
const std::vector<blink::mojom::FaviconURLPtr>&
WebAppIconDownloader::GetFaviconURLsFromWebContents() { … }
void WebAppIconDownloader::FetchIcons(
const IconUrlSizeSet& urls_to_download_with_size) { … }
void WebAppIconDownloader::DidDownloadFavicon(
int id,
int http_status_code,
const GURL& image_url,
const std::vector<SkBitmap>& bitmaps,
const std::vector<gfx::Size>& original_bitmap_sizes) { … }
void WebAppIconDownloader::PrimaryPageChanged(content::Page& page) { … }
void WebAppIconDownloader::WebContentsDestroyed() { … }
void WebAppIconDownloader::MaybeCompleteCallback() { … }
void WebAppIconDownloader::CancelDownloads(
IconsDownloadedResult result,
DownloadedIconsHttpResults icons_http_results,
WebAppIconDownloaderResult metrics_result) { … }
void WebAppIconDownloader::OnTimeout() { … }
}