Index: android_webview/native/aw_contents.cc |
diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc |
index f170e4927ac7041ee9ce4006daaf45e2d441da1d..334808f969aa586c8c2ed4f42e8ca5894155dbbd 100644 |
--- a/android_webview/native/aw_contents.cc |
+++ b/android_webview/native/aw_contents.cc |
@@ -35,6 +35,7 @@ |
#include "content/public/browser/cert_store.h" |
#include "content/public/browser/navigation_entry.h" |
#include "content/public/browser/render_process_host.h" |
+#include "content/public/browser/render_view_host.h" |
#include "content/public/browser/web_contents.h" |
#include "content/public/common/ssl_status.h" |
#include "jni/AwContents_jni.h" |
@@ -115,6 +116,18 @@ AwContents* AwContents::FromWebContents(WebContents* web_contents) { |
return AwContentsUserData::GetContents(web_contents); |
} |
+// static |
+AwContents* AwContents::FromID(int render_process_id, int render_view_id) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ const content::RenderViewHost* rvh = |
+ content::RenderViewHost::FromID(render_process_id, render_view_id); |
+ if (!rvh) return NULL; |
+ content::WebContents* web_contents = |
+ content::WebContents::FromRenderViewHost(rvh); |
+ if (!web_contents) return NULL; |
+ return FromWebContents(web_contents); |
+} |
+ |
AwContents::AwContents(JNIEnv* env, |
jobject obj, |
jobject web_contents_delegate) |