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); |
+} |