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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/framehost/RenderFrameHostImpl.java

Issue 2681933002: Add Java wrapper for RenderFrameHost (Closed)
Patch Set: Make test work with PlzNavigate Created 3 years, 9 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: content/public/android/java/src/org/chromium/content/browser/framehost/RenderFrameHostImpl.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/framehost/RenderFrameHostImpl.java b/content/public/android/java/src/org/chromium/content/browser/framehost/RenderFrameHostImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..90b97407dce0bab04b471154fb3323d9276543b8
--- /dev/null
+++ b/content/public/android/java/src/org/chromium/content/browser/framehost/RenderFrameHostImpl.java
@@ -0,0 +1,49 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.content.browser.framehost;
+
+import org.chromium.base.annotations.CalledByNative;
+import org.chromium.base.annotations.JNINamespace;
+import org.chromium.content_public.browser.RenderFrameHost;
+
+/**
+ * The RenderFrameHostImpl Java wrapper to allow communicating with the native RenderFrameHost
+ * object.
+ */
+@JNINamespace("content")
+public class RenderFrameHostImpl implements RenderFrameHost {
+ private long mNativeRenderFrameHostAndroid;
+ // mDelegate can be null.
+ final RenderFrameHostDelegate mDelegate;
+
+ private RenderFrameHostImpl(
+ long nativeRenderFrameHostAndroid, RenderFrameHostDelegate delegate) {
+ mNativeRenderFrameHostAndroid = nativeRenderFrameHostAndroid;
+ mDelegate = delegate;
+ }
+
+ @CalledByNative
+ private static RenderFrameHostImpl create(
+ long nativeRenderFrameHostAndroid, RenderFrameHostDelegate delegate) {
+ return new RenderFrameHostImpl(nativeRenderFrameHostAndroid, delegate);
+ }
+
+ @CalledByNative
+ private void clearNativePtr() {
+ mNativeRenderFrameHostAndroid = 0;
+ }
+
+ public RenderFrameHostDelegate getRenderFrameHostDelegate() {
+ return mDelegate;
+ }
+
+ @Override
+ public String getLastCommittedURL() {
+ if (mNativeRenderFrameHostAndroid == 0) return null;
+ return nativeGetLastCommittedURL(mNativeRenderFrameHostAndroid);
+ }
+
+ private native String nativeGetLastCommittedURL(long nativeRenderFrameHostAndroid);
+}

Powered by Google App Engine
This is Rietveld 408576698