OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 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 #include "content/renderer/image_downloader/single_image_downloader.h" | |
6 | |
7 #include "base/bind.h" | |
8 #include "base/logging.h" | |
9 | |
10 namespace content { | |
11 | |
12 // Static | |
13 void SingleImageDownloader::DownloadImage(RenderFrame* render_frame, | |
14 const GURL& url, | |
15 const DownloadImageCallback& cb) { | |
16 DCHECK(!cb.is_null()); | |
17 DCHECK(render_frame); | |
miu
2016/12/20 00:48:06
See comment in header file (re: using WeakPtr inst
xjz
2016/12/20 21:46:25
Done.
| |
18 | |
19 std::unique_ptr<ImageDownloaderBase> image_downloader( | |
20 new ImageDownloaderBase(render_frame)); | |
21 ImageDownloaderBase* image_downloader_ptr = image_downloader.get(); | |
22 image_downloader_ptr->DownloadImage( | |
23 url, false, false, base::Bind(&SingleImageDownloader::DidDownloadImage, | |
24 base::Passed(&image_downloader), cb)); | |
25 } | |
26 | |
27 // Static | |
28 void SingleImageDownloader::DidDownloadImage( | |
29 std::unique_ptr<ImageDownloaderBase> image_downloader, | |
30 const DownloadImageCallback& callback, | |
31 int http_status_code, | |
32 const std::vector<SkBitmap>& images) { | |
33 DCHECK(!callback.is_null()); | |
34 callback.Run(images.empty() ? SkBitmap() : images[0]); | |
35 } | |
36 | |
37 } // namespace content | |
OLD | NEW |