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

Unified Diff: android_webview/native/aw_contents.cc

Issue 12207061: Add a utility method to receive an AwContents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add a DCHECK Created 7 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
« no previous file with comments | « android_webview/native/aw_contents.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « android_webview/native/aw_contents.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698