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 "base/memory/weak_ptr.h" | |
| 9 #include "content/renderer/image_downloader/image_downloader_base.h" | |
| 10 | |
| 11 namespace content { | |
| 12 | |
| 13 // A one time image downloader that will download a single image. When there are | |
| 14 // multiple frames, return the first one. Return an empty bitmap if downloading | |
|
nasko
2017/01/04 17:45:33
nit: Returns
May be worthwhile mentioning that thi
xjz
2017/01/04 18:37:58
Done.
| |
| 15 // fails. | |
| 16 class SingleImageDownloader { | |
| 17 public: | |
| 18 using DownloadImageCallback = base::Callback<void(const SkBitmap&)>; | |
| 19 | |
| 20 // Called to download the image in given |url|, and run |cb| when done. | |
| 21 // A new ImageDownloaderBase will be created and used to download the image, | |
| 22 // and will be destructed when downloading finishes or |render_frame| is | |
| 23 // destructed. | |
| 24 static void DownloadImage(base::WeakPtr<RenderFrame> render_frame, | |
| 25 const GURL& url, | |
| 26 const DownloadImageCallback& cb); | |
| 27 | |
| 28 private: | |
| 29 // Callback when downloading finishes. | |
| 30 static void DidDownloadImage( | |
| 31 std::unique_ptr<ImageDownloaderBase> image_downloader, | |
| 32 const DownloadImageCallback& callback, | |
| 33 int http_status_code, | |
| 34 const std::vector<SkBitmap>& images); | |
| 35 | |
| 36 DISALLOW_COPY_AND_ASSIGN(SingleImageDownloader); | |
| 37 }; | |
| 38 | |
| 39 } // namespace content | |
| 40 | |
| 41 #endif // CONTENT_RENDERER_IMAGE_DOWNLOADER_SINGLE_IMAGE_DOWNLOADER_H_ | |
| OLD | NEW |