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

Unified Diff: chrome/browser/enhanced_bookmarks/android/enhanced_bookmarks_bridge.cc

Issue 896093007: [Android] Open up API in jni bridge to fetch images from tab (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add javadoc Created 5 years, 10 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/enhanced_bookmarks/android/enhanced_bookmarks_bridge.cc
diff --git a/chrome/browser/enhanced_bookmarks/android/enhanced_bookmarks_bridge.cc b/chrome/browser/enhanced_bookmarks/android/enhanced_bookmarks_bridge.cc
index eadcae76c0445fef41133af2fa8a0302d15dfd04..19e028f8f82512b13b3f17ad31a08a368c562c34 100644
--- a/chrome/browser/enhanced_bookmarks/android/enhanced_bookmarks_bridge.cc
+++ b/chrome/browser/enhanced_bookmarks/android/enhanced_bookmarks_bridge.cc
@@ -7,7 +7,9 @@
#include "base/android/jni_array.h"
#include "base/android/jni_string.h"
#include "base/prefs/pref_service.h"
+#include "chrome/browser/android/tab_android.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
+#include "chrome/browser/enhanced_bookmarks/android/bookmark_image_service_android.h"
#include "chrome/browser/enhanced_bookmarks/android/bookmark_image_service_factory.h"
#include "chrome/browser/enhanced_bookmarks/chrome_bookmark_server_cluster_service.h"
#include "chrome/browser/enhanced_bookmarks/chrome_bookmark_server_cluster_service_factory.h"
@@ -21,7 +23,6 @@
#include "components/bookmarks/browser/bookmark_utils.h"
#include "components/bookmarks/common/android/bookmark_id.h"
#include "components/bookmarks/common/android/bookmark_type.h"
-#include "components/enhanced_bookmarks/bookmark_image_service.h"
#include "components/enhanced_bookmarks/enhanced_bookmark_model.h"
#include "components/enhanced_bookmarks/image_record.h"
#include "components/signin/core/browser/signin_manager.h"
@@ -75,8 +76,8 @@ EnhancedBookmarksBridge::EnhancedBookmarksBridge(JNIEnv* env,
cluster_service_ =
ChromeBookmarkServerClusterServiceFactory::GetForBrowserContext(profile_);
cluster_service_->AddObserver(this);
- bookmark_image_service_ =
- BookmarkImageServiceFactory::GetForBrowserContext(profile_);
+ bookmark_image_service_ = static_cast<BookmarkImageServiceAndroid*>(
+ BookmarkImageServiceFactory::GetForBrowserContext(profile_));
search_service_.reset(new BookmarkServerSearchService(
profile_->GetRequestContext(),
ProfileOAuth2TokenServiceFactory::GetForProfile(profile_),
@@ -108,6 +109,14 @@ void EnhancedBookmarksBridge::SalientImageForUrl(JNIEnv* env,
url, base::Bind(&Callback, j_callback_ptr.release()));
}
+void EnhancedBookmarksBridge::FetchImageForTab(JNIEnv* env,
+ jobject obj,
+ jobject j_tab) {
+ TabAndroid* tab = TabAndroid::GetNativeTab(env, j_tab);
+ bookmark_image_service_->RetrieveSalientImageFromContext(
+ tab->web_contents()->GetMainFrame(), tab->GetURL(), true);
+}
Kibeom Kim (inactive) 2015/02/09 21:30:34 In addition to using WebContent, since this is par
Kibeom Kim (inactive) 2015/02/09 21:57:24 discussed offline. It's just two lines, so let's j
+
ScopedJavaLocalRef<jstring> EnhancedBookmarksBridge::GetBookmarkDescription(
JNIEnv* env, jobject obj, jlong id, jint type) {
DCHECK(enhanced_bookmark_model_->loaded());

Powered by Google App Engine
This is Rietveld 408576698