Index: chrome/browser/android/tab_android.cc |
diff --git a/chrome/browser/android/tab_android.cc b/chrome/browser/android/tab_android.cc |
index baa0a000cb2aeef6856c7b08386b17534184d8da..2c8553045d4f545065da94864d23b0576747a69f 100644 |
--- a/chrome/browser/android/tab_android.cc |
+++ b/chrome/browser/android/tab_android.cc |
@@ -12,6 +12,7 @@ |
#include "chrome/browser/browser_about_handler.h" |
#include "chrome/browser/chrome_notification_types.h" |
#include "chrome/browser/content_settings/tab_specific_content_settings.h" |
+#include "chrome/browser/favicon/favicon_tab_helper.h" |
#include "chrome/browser/google/google_url_tracker_factory.h" |
#include "chrome/browser/infobars/infobar_service.h" |
#include "chrome/browser/prerender/prerender_contents.h" |
@@ -46,7 +47,10 @@ |
#include "content/public/browser/user_metrics.h" |
#include "content/public/browser/web_contents.h" |
#include "jni/Tab_jni.h" |
+#include "skia/ext/image_operations.h" |
#include "third_party/WebKit/public/platform/WebReferrerPolicy.h" |
+#include "ui/gfx/android/java_bitmap.h" |
+#include "ui/gfx/favicon_size.h" |
TabAndroid* TabAndroid::FromWebContents(content::WebContents* web_contents) { |
CoreTabHelper* core_tab_helper = CoreTabHelper::FromWebContents(web_contents); |
@@ -517,6 +521,30 @@ bool TabAndroid::Print(JNIEnv* env, jobject obj) { |
return true; |
} |
+ScopedJavaLocalRef<jobject> TabAndroid::GetFavicon(JNIEnv* env, jobject obj) { |
+ ScopedJavaLocalRef<jobject> bitmap; |
+ FaviconTabHelper* favicon_tab_helper = |
+ FaviconTabHelper::FromWebContents(web_contents_.get()); |
+ if (!favicon_tab_helper) |
+ return bitmap; |
+ if (!favicon_tab_helper->FaviconIsValid()) |
+ return bitmap; |
+ |
+ SkBitmap favicon = favicon_tab_helper->GetFavicon().AsBitmap(); |
+ |
+ if (!favicon.isNull()) { |
+ if (favicon.width() != gfx::kFaviconSize || |
+ favicon.height() != gfx::kFaviconSize) |
+ favicon = |
+ skia::ImageOperations::Resize(favicon, |
+ skia::ImageOperations::RESIZE_BEST, |
+ gfx::kFaviconSize, |
+ gfx::kFaviconSize); |
+ bitmap = gfx::ConvertToJavaBitmap(&favicon); |
David Trainor- moved to gerrit
2014/07/09 20:34:51
I think this is still incorrect. It looks like yo
|
+ } |
+ return bitmap; |
+} |
+ |
prerender::PrerenderManager* TabAndroid::GetPrerenderManager() const { |
Profile* profile = GetProfile(); |
if (!profile) |