Index: chrome/browser/android/content_view_util.cc |
diff --git a/chrome/browser/android/content_view_util.cc b/chrome/browser/android/content_view_util.cc |
index 898affb93910b178b28f69846de3e8cd1fb4351e..eb37ba4b6eb6b4bee2ac7dc884b0da0748d7f84d 100644 |
--- a/chrome/browser/android/content_view_util.cc |
+++ b/chrome/browser/android/content_view_util.cc |
@@ -8,6 +8,7 @@ |
#include "chrome/browser/browser_process.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/profiles/profile_manager.h" |
+#include "content/public/browser/android/content_view_core.h" |
#include "content/public/browser/web_contents.h" |
#include "jni/ContentViewUtil_jni.h" |
@@ -22,6 +23,21 @@ static jlong CreateNativeWebContents( |
return reinterpret_cast<intptr_t>(content::WebContents::Create(params)); |
} |
+static jlong CreateNativeWebContentsWithSharedSiteInstance( |
+ JNIEnv* env, jclass clazz, jobject jcontent_view_core) { |
+ Profile* profile = g_browser_process->profile_manager()->GetLastUsedProfile(); |
+ |
+ content::ContentViewCore* content_view_core = |
+ content::ContentViewCore::GetNativeContentViewCore(env, |
+ jcontent_view_core); |
+ CHECK(content_view_core); |
+ |
+ content::WebContents::CreateParams params(profile, |
+ content_view_core->GetWebContents()->GetSiteInstance()); |
+ |
+ return reinterpret_cast<intptr_t>(content::WebContents::Create(params)); |
+} |
+ |
static void DestroyNativeWebContents( |
JNIEnv* env, jclass clazz, jlong web_contents_ptr) { |
content::WebContents* web_contents = |