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

Unified Diff: chrome/browser/android/ntp/most_visited_sites_bridge.cc

Issue 2000653002: Replace the usage of SkBitmap with gfx::Image in the suggestion service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: accidental up load. This patchset was not committed with this CL Created 4 years, 6 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/android/ntp/most_visited_sites_bridge.h ('k') | components/ntp_tiles/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/ntp/most_visited_sites_bridge.cc
diff --git a/chrome/browser/android/ntp/most_visited_sites_bridge.cc b/chrome/browser/android/ntp/most_visited_sites_bridge.cc
index 4fb1ab07582c4e251f1c7d4d663c3d80f808d9e4..a20e6979590e4d587b4784b4802f267d634d8a7d 100644
--- a/chrome/browser/android/ntp/most_visited_sites_bridge.cc
+++ b/chrome/browser/android/ntp/most_visited_sites_bridge.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/history/top_sites_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_android.h"
+#include "chrome/browser/search/suggestions/image_decoder_impl.h"
#include "chrome/browser/search/suggestions/suggestions_service_factory.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/supervised_user/supervised_user_service.h"
@@ -39,22 +40,6 @@ using base::android::ToJavaArrayOfStrings;
using content::BrowserThread;
using suggestions::SuggestionsServiceFactory;
-namespace {
-
-void CallJavaWithBitmap(
- std::unique_ptr<ScopedJavaGlobalRef<jobject>> j_callback,
- bool is_local_thumbnail,
- const SkBitmap* bitmap) {
- JNIEnv* env = AttachCurrentThread();
- ScopedJavaLocalRef<jobject> j_bitmap;
- if (bitmap)
- j_bitmap = gfx::ConvertToJavaBitmap(bitmap);
- Java_ThumbnailCallback_onMostVisitedURLsThumbnailAvailable(
- env, j_callback->obj(), j_bitmap.obj(), is_local_thumbnail);
-}
-
-} // namespace
-
MostVisitedSitesBridge::SupervisorBridge::SupervisorBridge(Profile* profile)
: profile_(profile),
supervisor_observer_(nullptr),
@@ -173,7 +158,8 @@ MostVisitedSitesBridge::MostVisitedSitesBridge(Profile* profile)
ChromePopularSites::GetDirectory(),
TopSitesFactory::GetForProfile(profile),
SuggestionsServiceFactory::GetForProfile(profile),
- &supervisor_) {
+ &supervisor_,
+ new suggestions::ImageDecoderImpl()) {
// Register the thumbnails debugging page.
// TODO(sfiera): find thumbnails a home. They don't belong here.
content::URLDataSource::Add(profile, new ThumbnailListSource(profile));
@@ -195,18 +181,6 @@ void MostVisitedSitesBridge::SetMostVisitedURLsObserver(
most_visited_.SetMostVisitedURLsObserver(java_observer_.get(), num_sites);
}
-void MostVisitedSitesBridge::GetURLThumbnail(
- JNIEnv* env,
- const JavaParamRef<jobject>& obj,
- const JavaParamRef<jstring>& j_url,
- const JavaParamRef<jobject>& j_callback_obj) {
- std::unique_ptr<ScopedJavaGlobalRef<jobject>> j_callback(
- new ScopedJavaGlobalRef<jobject>(env, j_callback_obj));
- auto callback = base::Bind(&CallJavaWithBitmap, base::Passed(&j_callback));
- GURL url(ConvertJavaStringToUTF8(env, j_url));
- most_visited_.GetURLThumbnail(url, callback);
-}
-
void MostVisitedSitesBridge::AddOrRemoveBlacklistedUrl(
JNIEnv* env,
const JavaParamRef<jobject>& obj,
« no previous file with comments | « chrome/browser/android/ntp/most_visited_sites_bridge.h ('k') | components/ntp_tiles/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698