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

Side by Side Diff: components/suggestions/image_manager.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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/suggestions/image_manager.h" 5 #include "components/suggestions/image_manager.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 16 matching lines...) Expand all
27 std::unique_ptr<SkBitmap> DecodeImage( 27 std::unique_ptr<SkBitmap> DecodeImage(
28 scoped_refptr<base::RefCountedMemory> encoded_data) { 28 scoped_refptr<base::RefCountedMemory> encoded_data) {
29 return suggestions::DecodeJPEGToSkBitmap(encoded_data->front(), 29 return suggestions::DecodeJPEGToSkBitmap(encoded_data->front(),
30 encoded_data->size()); 30 encoded_data->size());
31 } 31 }
32 32
33 // Wraps an ImageManager callback so that it can be used with the ImageFetcher. 33 // Wraps an ImageManager callback so that it can be used with the ImageFetcher.
34 void WrapCallback( 34 void WrapCallback(
35 const suggestions::ImageManager::ImageCallback& wrapped_callback, 35 const suggestions::ImageManager::ImageCallback& wrapped_callback,
36 const std::string& url, 36 const std::string& url,
37 const gfx::Image& image) { 37 const gfx::Image& image,
38 const image_fetcher::RequestMetadata& metadata) {
38 wrapped_callback.Run(GURL(url), image); 39 wrapped_callback.Run(GURL(url), image);
39 } 40 }
40 41
41 } // namespace 42 } // namespace
42 43
43 namespace suggestions { 44 namespace suggestions {
44 45
45 ImageManager::ImageManager() : weak_ptr_factory_(this) {} 46 ImageManager::ImageManager() : weak_ptr_factory_(this) {}
46 47
47 ImageManager::ImageManager( 48 ImageManager::ImageManager(
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 it != pending_cache_requests_.end(); ++it) { 254 it != pending_cache_requests_.end(); ++it) {
254 const ImageCacheRequest& request = it->second; 255 const ImageCacheRequest& request = it->second;
255 for (CallbackVector::const_iterator callback_it = request.callbacks.begin(); 256 for (CallbackVector::const_iterator callback_it = request.callbacks.begin();
256 callback_it != request.callbacks.end(); ++callback_it) { 257 callback_it != request.callbacks.end(); ++callback_it) {
257 ServeFromCacheOrNetwork(request.url, request.image_url, *callback_it); 258 ServeFromCacheOrNetwork(request.url, request.image_url, *callback_it);
258 } 259 }
259 } 260 }
260 } 261 }
261 262
262 } // namespace suggestions 263 } // namespace suggestions
OLDNEW
« no previous file with comments | « components/ntp_tiles/icon_cacher_impl_unittest.cc ('k') | components/suggestions/image_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698