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

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: 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 | « chrome/browser/search/thumbnail_source.h ('k') | components/image_fetcher/image_fetcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..2a86129d1071f8351dac735ede9c3590325264e7 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
@@ -80,7 +81,7 @@ base::MessageLoop* ThumbnailSource::MessageLoopForRequestPath(
// TopSites can be accessed from the IO thread. Otherwise, the URLs should be
// accessed on the UI thread.
return thumbnail_service_.get()
- ? NULL
+ ? nullptr
: content::URLDataSource::MessageLoopForRequestPath(path);
}
@@ -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())) {
« no previous file with comments | « chrome/browser/search/thumbnail_source.h ('k') | components/image_fetcher/image_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698