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

Unified Diff: chrome/browser/search/thumbnail_source.cc

Issue 1974013002: Replace SkBitmap with gfx::Image in the ImageFetcher API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix more iOS build errors. 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
Index: chrome/browser/search/thumbnail_source.cc
diff --git a/chrome/browser/search/thumbnail_source.cc b/chrome/browser/search/thumbnail_source.cc
index b92b10272815177280378fe47dca33dcbd43e743..97e4eff5915b33b444cba45e20f8dd298da3b52f 100644
--- a/chrome/browser/search/thumbnail_source.cc
+++ b/chrome/browser/search/thumbnail_source.cc
@@ -17,6 +17,7 @@
#include "chrome/common/url_constants.h"
#include "components/suggestions/image_encoder.h"
#include "net/url_request/url_request.h"
+#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_skia.h"
// The delimiter between the first url and the fallback url passed to
@@ -111,12 +112,14 @@ void ThumbnailSource::ExtractPageAndThumbnailUrls(
void ThumbnailSource::SendFetchedUrlImage(
const content::URLDataSource::GotDataCallback& callback,
const GURL& url,
- const SkBitmap* bitmap) {
- if (!bitmap) {
+ const gfx::Image& image) {
+ // In case the image could not be retrieved an empty image is returned.
+ if (image.IsEmpty()) {
callback.Run(default_thumbnail_.get());
return;
}
+ const SkBitmap* bitmap = image.ToSkBitmap();
scoped_refptr<base::RefCountedBytes> encoded_data(
new base::RefCountedBytes());
if (!suggestions::EncodeSkBitmapToJPEG(*bitmap, &encoded_data->data())) {

Powered by Google App Engine
This is Rietveld 408576698