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

Unified Diff: components/image_fetcher/image_fetcher_impl.cc

Issue 2757643002: components/image_fetcher: Expose RequestMetadata from ImageFetcher (Closed)
Patch Set: logo_bridge Created 3 years, 9 months 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: components/image_fetcher/image_fetcher_impl.cc
diff --git a/components/image_fetcher/image_fetcher_impl.cc b/components/image_fetcher/image_fetcher_impl.cc
index bee92cb479c5a371d475aa7be3bb8586a44bfe2c..33d0cd1af1bddbceb46ab50f92458f50f941829a 100644
--- a/components/image_fetcher/image_fetcher_impl.cc
+++ b/components/image_fetcher/image_fetcher_impl.cc
@@ -46,7 +46,7 @@ void ImageFetcherImpl::SetDesiredImageFrameSize(const gfx::Size& size) {
void ImageFetcherImpl::StartOrQueueNetworkRequest(
const std::string& id,
const GURL& image_url,
- base::Callback<void(const std::string&, const gfx::Image&)> callback) {
+ const ImageFetcherCallback& callback) {
// Before starting to fetch the image. Look for a request in progress for
// |image_url|, and queue if appropriate.
ImageRequestMap::iterator it = pending_net_requests_.find(image_url);
@@ -76,12 +76,14 @@ void ImageFetcherImpl::OnImageURLFetched(const GURL& image_url,
delegate_->OnImageDataFetched(it->second.id, image_data);
}
- image_decoder_->DecodeImage(image_data, desired_image_frame_size_,
- base::Bind(&ImageFetcherImpl::OnImageDecoded,
- base::Unretained(this), image_url));
+ image_decoder_->DecodeImage(
+ image_data, desired_image_frame_size_,
+ base::Bind(&ImageFetcherImpl::OnImageDecoded, base::Unretained(this),
+ image_url, metadata));
}
void ImageFetcherImpl::OnImageDecoded(const GURL& image_url,
+ const RequestMetadata& metadata,
const gfx::Image& image) {
// Get request for the given image_url from the request queue.
ImageRequestMap::iterator image_iter = pending_net_requests_.find(image_url);
@@ -90,7 +92,7 @@ void ImageFetcherImpl::OnImageDecoded(const GURL& image_url,
// Run all callbacks
for (const auto& callback : request->callbacks) {
- callback.Run(request->id, image);
+ callback.Run(request->id, image, metadata);
}
// Inform the ImageFetcherDelegate.
« no previous file with comments | « components/image_fetcher/image_fetcher_impl.h ('k') | components/ntp_snippets/remote/remote_suggestions_provider_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698