Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_RENDERER_IMAGE_DOWNLOADER_SINGLE_IMAGE_DOWNLOADER_H_ | |
| 6 #define CONTENT_RENDERER_IMAGE_DOWNLOADER_SINGLE_IMAGE_DOWNLOADER_H_ | |
| 7 | |
| 8 #include "content/renderer/image_downloader/image_downloader_base.h" | |
| 9 | |
| 10 namespace content { | |
| 11 | |
| 12 // A one time image downloader that will download a single image. When there are | |
| 13 // multiple frames, return the first one. Return an empty bitmap if downloading | |
| 14 // fails. | |
| 15 class SingleImageDownloader { | |
| 16 public: | |
| 17 using DownloadImageCallback = base::Callback<void(const SkBitmap&)>; | |
| 18 | |
| 19 // Called to download the image in given |url|, and run |cb| when done. | |
| 20 // A new ImageDownloaderBase will be created and used to download the image, | |
| 21 // and will be destructed when downloading finishes or |render_frame| is | |
| 22 // destructed. | |
| 23 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.
| |
| 24 const GURL& url, | |
| 25 const DownloadImageCallback& cb); | |
| 26 | |
| 27 private: | |
| 28 // Callback when downloading finishes. | |
| 29 static void DidDownloadImage( | |
| 30 std::unique_ptr<ImageDownloaderBase> image_downloader, | |
| 31 const DownloadImageCallback& callback, | |
| 32 int http_status_code, | |
| 33 const std::vector<SkBitmap>& images); | |
| 34 | |
| 35 DISALLOW_COPY_AND_ASSIGN(SingleImageDownloader); | |
| 36 }; | |
| 37 | |
| 38 } // namespace content | |
| 39 | |
| 40 #endif // CONTENT_RENDERER_IMAGE_DOWNLOADER_SINGLE_IMAGE_DOWNLOADER_H_ | |
| OLD | NEW |