| Index: content/public/android/java/src/org/chromium/content/browser/webcontents/WebContentsImpl.java
|
| diff --git a/content/public/android/java/src/org/chromium/content/browser/webcontents/WebContentsImpl.java b/content/public/android/java/src/org/chromium/content/browser/webcontents/WebContentsImpl.java
|
| index 5caa21422090dda3c8d40ff1abb37c6dad6625c0..8d29e19ad6373bb9d04c82dc667901f5af63cd48 100644
|
| --- a/content/public/android/java/src/org/chromium/content/browser/webcontents/WebContentsImpl.java
|
| +++ b/content/public/android/java/src/org/chromium/content/browser/webcontents/WebContentsImpl.java
|
| @@ -21,6 +21,42 @@ import org.chromium.content_public.browser.WebContents;
|
| private long mNativeWebContentsAndroid;
|
| private NavigationController mNavigationController;
|
|
|
| + /**
|
| + * An interface that allows the embedder to be notified of navigation transition
|
| + * related events and respond to them.
|
| + */
|
| + public interface NavigationTransitionDelegate {
|
| + /**
|
| + * Called when the navigation is deferred immediately after the response started.
|
| + *
|
| + * @param enteringColor The background color of the entering document, as a String
|
| + * representing a legal CSS color value. This is inserted into
|
| + * the transition layer's markup after the entering stylesheets
|
| + * have been applied.
|
| + */
|
| + public void didDeferAfterResponseStarted(String enteringColor);
|
| +
|
| + /**
|
| + * Called when a navigation transition has been detected, and we need to check
|
| + * if it's supported.
|
| + */
|
| + public boolean willHandleDeferAfterResponseStarted();
|
| +
|
| + /**
|
| + * Called when the navigation is deferred immediately after the response
|
| + * started.
|
| + */
|
| + public void addEnteringStylesheetToTransition(String stylesheet);
|
| +
|
| + /**
|
| + * Notifies that a navigation transition is started for a given frame.
|
| + * @param frameId A positive, non-zero integer identifying the navigating frame.
|
| + */
|
| + public void didStartNavigationTransitionForFrame(long frameId);
|
| + }
|
| +
|
| + private NavigationTransitionDelegate mNavigationTransitionDelegate = null;
|
| +
|
| private WebContentsImpl(
|
| long nativeWebContentsAndroid, NavigationController navigationController) {
|
| mNativeWebContentsAndroid = nativeWebContentsAndroid;
|
| @@ -136,6 +172,50 @@ import org.chromium.content_public.browser.WebContents;
|
| nativeSelectWordAroundCaret(mNativeWebContentsAndroid);
|
| }
|
|
|
| + @Override
|
| + public String getUrl() {
|
| + return nativeGetURL(mNativeWebContentsAndroid);
|
| + }
|
| +
|
| + @Override
|
| + public boolean isIncognito() {
|
| + return nativeIsIncognito(mNativeWebContentsAndroid);
|
| + }
|
| +
|
| + @Override
|
| + public void resumeResponseDeferredAtStart() {
|
| + nativeResumeResponseDeferredAtStart(mNativeWebContentsAndroid);
|
| + }
|
| +
|
| + @Override
|
| + public void setHasPendingNavigationTransitionForTesting() {
|
| + nativeSetHasPendingNavigationTransitionForTesting(mNativeWebContentsAndroid);
|
| + }
|
| +
|
| + public void setNavigationTransitionDelegate(NavigationTransitionDelegate delegate) {
|
| + mNavigationTransitionDelegate = delegate;
|
| + }
|
| +
|
| + @CalledByNative
|
| + private void didDeferAfterResponseStarted(String enteringColor) {
|
| + if (mNavigationTransitionDelegate != null ) {
|
| + mNavigationTransitionDelegate.didDeferAfterResponseStarted(enteringColor);
|
| + }
|
| + }
|
| +
|
| + @CalledByNative
|
| + private boolean willHandleDeferAfterResponseStarted() {
|
| + if (mNavigationTransitionDelegate == null) return false;
|
| + return mNavigationTransitionDelegate.willHandleDeferAfterResponseStarted();
|
| + }
|
| +
|
| + @CalledByNative
|
| + private void addEnteringStylesheetToTransition(String stylesheet) {
|
| + if (mNavigationTransitionDelegate != null ) {
|
| + mNavigationTransitionDelegate.addEnteringStylesheetToTransition(stylesheet);
|
| + }
|
| + }
|
| +
|
| private native String nativeGetTitle(long nativeWebContentsAndroid);
|
| private native String nativeGetVisibleURL(long nativeWebContentsAndroid);
|
| private native void nativeStop(long nativeWebContentsAndroid);
|
| @@ -155,4 +235,9 @@ import org.chromium.content_public.browser.WebContents;
|
| private native void nativeShowImeIfNeeded(long nativeWebContentsAndroid);
|
| private native void nativeScrollFocusedEditableNodeIntoView(long nativeWebContentsAndroid);
|
| private native void nativeSelectWordAroundCaret(long nativeWebContentsAndroid);
|
| + private native String nativeGetURL(long nativeWebContentsAndroid);
|
| + private native boolean nativeIsIncognito(long nativeWebContentsAndroid);
|
| + private native void nativeResumeResponseDeferredAtStart(long nativeWebContentsAndroid);
|
| + private native void nativeSetHasPendingNavigationTransitionForTesting(
|
| + long nativeWebContentsAndroid);
|
| }
|
|
|