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

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

Issue 2538853002: Media Remoting: Draw remoting interstitial on poster image. (Closed)
Patch Set: Addressed xhwang's comment. 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/single_image_downloader.h
diff --git a/content/renderer/image_downloader/single_image_downloader.h b/content/renderer/image_downloader/single_image_downloader.h
new file mode 100644
index 0000000000000000000000000000000000000000..e6624f12bb97fd3046ecb3738a03129faea7b06c
--- /dev/null
+++ b/content/renderer/image_downloader/single_image_downloader.h
@@ -0,0 +1,40 @@
+// 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_SINGLE_IMAGE_DOWNLOADER_H_
+#define CONTENT_RENDERER_IMAGE_DOWNLOADER_SINGLE_IMAGE_DOWNLOADER_H_
+
+#include "content/renderer/image_downloader/image_downloader_base.h"
+
+namespace content {
+
+// A one time image downloader that will download a single image. When there are
+// multiple frames, return the first one. Return an empty bitmap if downloading
+// fails.
+class SingleImageDownloader {
+ public:
+ using DownloadImageCallback = base::Callback<void(const SkBitmap&)>;
+
+ // Called to download the image in given |url|, and run |cb| when done.
+ // A new ImageDownloaderBase will be created and used to download the image,
+ // and will be destructed when downloading finishes or |render_frame| is
+ // destructed.
+ static void DownloadImage(RenderFrame* render_frame,
miu 2016/12/20 00:48:06 Because the RenderFrame is used in a callback func
xjz 2016/12/20 21:46:25 Done.
+ const GURL& url,
+ const DownloadImageCallback& cb);
+
+ private:
+ // Callback when downloading finishes.
+ static void DidDownloadImage(
+ std::unique_ptr<ImageDownloaderBase> image_downloader,
+ const DownloadImageCallback& callback,
+ int http_status_code,
+ const std::vector<SkBitmap>& images);
+
+ DISALLOW_COPY_AND_ASSIGN(SingleImageDownloader);
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_IMAGE_DOWNLOADER_SINGLE_IMAGE_DOWNLOADER_H_

Powered by Google App Engine
This is Rietveld 408576698