blob: e244dc44ec485dd337b36ba0cb3c3b189e077691 [file] [log] [blame]
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/common/image_downloader/image_downloader.mojom.h"
#include "content/renderer/image_downloader/image_downloader_base.h"
#include "mojo/public/cpp/bindings/binding.h"
namespace content {
class ImageDownloaderImpl : public mojom::ImageDownloader,
public ImageDownloaderBase {
~ImageDownloaderImpl() override;
static void CreateMojoService(RenderFrame* render_frame,
mojom::ImageDownloaderRequest request);
ImageDownloaderImpl(RenderFrame* render_frame,
mojom::ImageDownloaderRequest request);
// Override ImageDownloaderBase::OnDestruct().
void OnDestruct() override;
// ImageDownloader implementation.
void DownloadImage(const GURL& url,
bool is_favicon,
uint32_t max_bitmap_size,
bool bypass_cache,
DownloadImageCallback callback) override;
// Called when downloading finishes. All frames in |images| whose size <=
// |max_image_size| will be returned through |callback|. If all of the frames
// are larger than |max_image_size|, the smallest frame is resized to
// |max_image_size| and is the only result. |max_image_size| == 0 is
// interpreted as no max image size.
void DidDownloadImage(uint32_t max_bitmap_size,
DownloadImageCallback callback,
int32_t http_status_code,
const std::vector<SkBitmap>& images);
mojo::Binding<mojom::ImageDownloader> binding_;
} // namespace content