Chromium Code Reviews| 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..dc46fc929e9660ae318875a88e3dfffdca6bd8f5 |
| --- /dev/null |
| +++ b/content/public/android/java/src/org/chromium/content/browser/framehost/RenderFrameHostImpl.java |
| @@ -0,0 +1,51 @@ |
| +// 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") |
| +// TODO(tedchoc): Remove the package restriction once this class moves to a non-public content |
|
boliu
2017/03/06 23:12:38
remove this comment and the package part. WebConte
rwlbuis
2017/03/07 19:44:56
Done.
|
| +// package whose visibility will be enforced via DEPS. |
| +/* package */ 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); |
| +} |