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

Unified Diff: ios/chrome/browser/suggestions/image_fetcher_impl.mm

Issue 1974013002: Replace SkBitmap with gfx::Image in the ImageFetcher API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync again Created 4 years, 7 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
« no previous file with comments | « ios/chrome/browser/suggestions/image_fetcher_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/suggestions/image_fetcher_impl.mm
diff --git a/ios/chrome/browser/suggestions/image_fetcher_impl.mm b/ios/chrome/browser/suggestions/image_fetcher_impl.mm
index 553f02cbb1fbd7c15b2c637ffd6d7667a73cdf9a..677d80b742ca180fddccdb289117b3853d3036a3 100644
--- a/ios/chrome/browser/suggestions/image_fetcher_impl.mm
+++ b/ios/chrome/browser/suggestions/image_fetcher_impl.mm
@@ -11,6 +11,7 @@
#include "ios/chrome/browser/net/image_fetcher.h"
#include "net/url_request/url_request_context_getter.h"
#include "skia/ext/skia_utils_ios.h"
+#include "ui/gfx/image/image.h"
namespace suggestions {
@@ -33,11 +34,12 @@ void ImageFetcherImpl::SetImageFetcherDelegate(
void ImageFetcherImpl::StartOrQueueNetworkRequest(
const GURL& url,
const GURL& image_url,
- base::Callback<void(const GURL&, const SkBitmap*)> callback) {
+ base::Callback<void(const GURL&, const gfx::Image&)> callback) {
if (image_url.is_empty()) {
- callback.Run(url, nullptr);
+ gfx::Image empty_image;
+ callback.Run(url, empty_image);
if (delegate_) {
- delegate_->OnImageFetched(url, nullptr);
+ delegate_->OnImageFetched(url, empty_image);
}
return;
}
@@ -47,20 +49,20 @@ void ImageFetcherImpl::StartOrQueueNetworkRequest(
^(const GURL& original_url, int response_code, NSData* data) {
if (data) {
// Most likely always returns 1x images.
- UIImage* image = [UIImage imageWithData:data scale:1];
- if (image) {
- SkBitmap bitmap =
- skia::CGImageToSkBitmap(image.CGImage, [image size], YES);
- callback.Run(page_url, &bitmap);
+ UIImage* ui_image = [UIImage imageWithData:data scale:1];
+ if (ui_image) {
+ gfx::Image gfx_image(ui_image);
+ callback.Run(page_url, gfx_image);
if (delegate_) {
- delegate_->OnImageFetched(page_url, &bitmap);
+ delegate_->OnImageFetched(page_url, gfx_image);
}
return;
}
}
- callback.Run(page_url, nullptr);
+ gfx::Image empty_image;
+ callback.Run(page_url, empty_image);
if (delegate_) {
- delegate_->OnImageFetched(page_url, nullptr);
+ delegate_->OnImageFetched(page_url, empty_image);
}
};
imageFetcher_->StartDownload(image_url, fetcher_callback);
« no previous file with comments | « ios/chrome/browser/suggestions/image_fetcher_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698