| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/image_downloader/image_downloader_impl.h" | 5 #include "content/renderer/image_downloader/image_downloader_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 uint32_t max_image_size, | 169 uint32_t max_image_size, |
| 170 bool bypass_cache, | 170 bool bypass_cache, |
| 171 const DownloadImageCallback& callback) { | 171 const DownloadImageCallback& callback) { |
| 172 blink::WebLocalFrame* frame = render_frame()->GetWebFrame(); | 172 blink::WebLocalFrame* frame = render_frame()->GetWebFrame(); |
| 173 DCHECK(frame); | 173 DCHECK(frame); |
| 174 | 174 |
| 175 // Create an image resource fetcher and assign it with a call back object. | 175 // Create an image resource fetcher and assign it with a call back object. |
| 176 image_fetchers_.push_back(new MultiResolutionImageResourceFetcher( | 176 image_fetchers_.push_back(new MultiResolutionImageResourceFetcher( |
| 177 image_url, frame, 0, is_favicon ? WebURLRequest::RequestContextFavicon | 177 image_url, frame, 0, is_favicon ? WebURLRequest::RequestContextFavicon |
| 178 : WebURLRequest::RequestContextImage, | 178 : WebURLRequest::RequestContextImage, |
| 179 bypass_cache ? WebURLRequest::ReloadBypassingCache | 179 bypass_cache ? WebURLRequest::BypassingCache |
| 180 : WebURLRequest::UseProtocolCachePolicy, | 180 : WebURLRequest::UseProtocolCachePolicy, |
| 181 base::Bind(&ImageDownloaderImpl::DidFetchImage, base::Unretained(this), | 181 base::Bind(&ImageDownloaderImpl::DidFetchImage, base::Unretained(this), |
| 182 max_image_size, callback))); | 182 max_image_size, callback))); |
| 183 return true; | 183 return true; |
| 184 } | 184 } |
| 185 | 185 |
| 186 void ImageDownloaderImpl::DidFetchImage( | 186 void ImageDownloaderImpl::DidFetchImage( |
| 187 uint32_t max_image_size, | 187 uint32_t max_image_size, |
| 188 const DownloadImageCallback& callback, | 188 const DownloadImageCallback& callback, |
| 189 MultiResolutionImageResourceFetcher* fetcher, | 189 MultiResolutionImageResourceFetcher* fetcher, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 210 int32_t http_status_code, | 210 int32_t http_status_code, |
| 211 const std::vector<SkBitmap>& result_images, | 211 const std::vector<SkBitmap>& result_images, |
| 212 const std::vector<gfx::Size>& result_original_image_sizes, | 212 const std::vector<gfx::Size>& result_original_image_sizes, |
| 213 const DownloadImageCallback& callback) { | 213 const DownloadImageCallback& callback) { |
| 214 callback.Run(http_status_code, | 214 callback.Run(http_status_code, |
| 215 mojo::Array<skia::mojom::BitmapPtr>::From(result_images), | 215 mojo::Array<skia::mojom::BitmapPtr>::From(result_images), |
| 216 mojo::Array<mojo::SizePtr>::From(result_original_image_sizes)); | 216 mojo::Array<mojo::SizePtr>::From(result_original_image_sizes)); |
| 217 } | 217 } |
| 218 | 218 |
| 219 } // namespace content | 219 } // namespace content |
| OLD | NEW |