Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Unified Diff: content/renderer/image_downloader/image_downloader_core.h

Issue 2538853002: Media Remoting: Draw remoting interstitial on poster image. (Closed)
Patch Set: Addressed comments. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/image_downloader/image_downloader_core.h
diff --git a/content/renderer/image_downloader/image_downloader_impl.h b/content/renderer/image_downloader/image_downloader_core.h
similarity index 42%
copy from content/renderer/image_downloader/image_downloader_impl.h
copy to content/renderer/image_downloader/image_downloader_core.h
index 310ed0384c7f409b06f29a03589172fdef3cb6e9..df61ca9b7c6e94b6e2afe57cfd7af683480f1214 100644
--- a/content/renderer/image_downloader/image_downloader_impl.h
+++ b/content/renderer/image_downloader/image_downloader_core.h
@@ -1,100 +1,73 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2016 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.
-#ifndef CONTENT_RENDERER_IMAGE_DOWNLOADER_IMAGE_DOWNLOADER_IMPL_H_
-#define CONTENT_RENDERER_IMAGE_DOWNLOADER_IMAGE_DOWNLOADER_IMPL_H_
+#ifndef CONTENT_RENDERER_IMAGE_DOWNLOADER_IMAGE_DOWNLOADER_CORE_H_
+#define CONTENT_RENDERER_IMAGE_DOWNLOADER_IMAGE_DOWNLOADER_CORE_H_
#include <stdint.h>
#include <vector>
-#include "base/macros.h"
+#include "base/callback.h"
#include "base/memory/scoped_vector.h"
-#include "content/common/image_downloader/image_downloader.mojom.h"
-#include "content/public/renderer/render_frame_observer.h"
#include "content/public/renderer/render_thread_observer.h"
-#include "mojo/public/cpp/bindings/binding.h"
+#include "third_party/skia/include/core/SkBitmap.h"
#include "url/gurl.h"
-class SkBitmap;
-
-namespace gfx {
-class Size;
-}
-
namespace content {
class MultiResolutionImageResourceFetcher;
class RenderFrame;
-class ImageDownloaderImpl : public mojom::ImageDownloader,
- public RenderFrameObserver,
- public RenderThreadObserver {
+class ImageDownloaderCore : public RenderThreadObserver {
public:
- ~ImageDownloaderImpl() override;
-
- static void CreateMojoService(RenderFrame* render_frame,
- mojom::ImageDownloaderRequest request);
+ // |render_frame| outlives this class.
+ explicit ImageDownloaderCore(RenderFrame* render_frame);
+ ~ImageDownloaderCore() override;
// RenderThreadObserver implementation.
void OnRenderProcessShutdown() override;
- private:
- ImageDownloaderImpl(RenderFrame* render_frame,
- mojom::ImageDownloaderRequest request);
-
- // RenderFrameObserver implementation.
- void OnDestruct() override;
-
- // ImageDownloader methods:
+ using DownloadCallback =
+ base::Callback<void(int32_t, const std::vector<SkBitmap>&)>;
+ // Request to aynchronously download an image. When done, |callback| will be
+ // called.
void DownloadImage(const GURL& url,
bool is_favicon,
- uint32_t max_bitmap_size,
bool bypass_cache,
- const DownloadImageCallback& callback) override;
+ const DownloadCallback& callback);
+ private:
// Requests to fetch an image. When done, the ImageDownloaderImpl
miu 2016/12/03 01:05:30 s/ImageDownloaderImpl/image downloader/
xjz 2016/12/06 19:50:55 Done.
// is notified by way of DidFetchImage. Returns true if the
// request was successfully started, false otherwise.
// If the image is a favicon, cookies will not be
// sent nor accepted during download. If the image has multiple frames, all
- // the frames whose size <= |max_image_size| are returned. 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.
+ // frames are returned.
bool FetchImage(const GURL& image_url,
bool is_favicon,
- uint32_t max_image_size,
bool bypass_cache,
- const DownloadImageCallback& callback);
+ const DownloadCallback& callback);
// This callback is triggered when FetchImage completes, either
// succesfully or with a failure. See FetchImage for more
// details.
- void DidFetchImage(uint32_t max_image_size,
- const DownloadImageCallback& callback,
+ void DidFetchImage(const DownloadCallback& callback,
MultiResolutionImageResourceFetcher* fetcher,
const std::vector<SkBitmap>& images);
- // Reply download result
- void ReplyDownloadResult(
- int32_t http_status_code,
- const std::vector<SkBitmap>& result_images,
- const std::vector<gfx::Size>& result_original_image_sizes,
- const DownloadImageCallback& callback);
-
typedef ScopedVector<MultiResolutionImageResourceFetcher>
ImageResourceFetcherList;
// ImageResourceFetchers schedule via FetchImage.
ImageResourceFetcherList image_fetchers_;
- mojo::Binding<mojom::ImageDownloader> binding_;
+ RenderFrame* const render_frame_; // Outlives this class.
- DISALLOW_COPY_AND_ASSIGN(ImageDownloaderImpl);
+ DISALLOW_COPY_AND_ASSIGN(ImageDownloaderCore);
};
} // namespace content
-#endif // CONTENT_RENDERER_IMAGE_DOWNLOADER_IMAGE_DOWNLOADER_IMPL_H_
+#endif // CONTENT_RENDERER_IMAGE_DOWNLOADER_IMAGE_DOWNLOADER_CORE_H_

Powered by Google App Engine
This is Rietveld 408576698