Index: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
index 9a3bf0c67c75a39fd5c943b2f7b8ccba64cf0d29..6574621a12c935d60eda75d0582ac182152938b8 100644 |
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
@@ -211,6 +211,23 @@ public class ContentViewCore |
public void onSmartClipDataExtracted(String result); |
} |
+ /** |
+ * 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. |
+ */ |
+ public void didDeferAfterResponseStarted(); |
+ |
+ /** |
+ * Called when a navigation transition has been detected, and we need to check |
+ * if it's supported. |
+ */ |
+ public boolean willHandleDeferAfterResponseStarted(); |
+ } |
+ |
private final Context mContext; |
private ViewGroup mContainerView; |
private InternalAccessDelegate mContainerViewInternals; |
@@ -318,6 +335,8 @@ public class ContentViewCore |
private SmartClipDataListener mSmartClipDataListener = null; |
+ private NavigationTransitionDelegate mNavigationTransitionDelegate = null; |
+ |
// This holds the state of editable text (e.g. contents of <input>, contenteditable) of |
// a focused element. |
// Every time the user, IME, javascript (Blink), autofill etc. modifies the content, the new |
@@ -3004,6 +3023,29 @@ public class ContentViewCore |
mSmartClipDataListener = listener; |
} |
+ @CalledByNative |
+ private void didDeferAfterResponseStarted() { |
+ if (mNavigationTransitionDelegate != null ) { |
+ mNavigationTransitionDelegate.didDeferAfterResponseStarted(); |
+ } |
+ } |
+ |
+ @CalledByNative |
+ private boolean willHandleDeferAfterResponseStarted() { |
+ if (mNavigationTransitionDelegate == null) return false; |
+ return mNavigationTransitionDelegate.willHandleDeferAfterResponseStarted(); |
+ } |
+ |
+ @VisibleForTesting |
+ void setHasPendingNavigationTransitionForTesting() { |
+ if (mNativeContentViewCore == 0) return; |
+ nativeSetHasPendingNavigationTransitionForTesting(mNativeContentViewCore); |
+ } |
+ |
+ public void setNavigationTransitionDelegate(NavigationTransitionDelegate delegate) { |
+ mNavigationTransitionDelegate = delegate; |
+ } |
+ |
/** |
* Offer a long press gesture to the embedding View, primarily for WebView compatibility. |
* |
@@ -3058,6 +3100,11 @@ public class ContentViewCore |
sendOrientationChangeEvent(orientation); |
} |
+ public void resumeResponseDeferredAtStart() { |
+ if (mNativeContentViewCore == 0) return; |
+ nativeResumeResponseDeferredAtStart(mNativeContentViewCore); |
+ } |
+ |
private native WebContents nativeGetWebContentsAndroid(long nativeContentViewCoreImpl); |
private native void nativeOnJavaContentViewCoreDestroyed(long nativeContentViewCoreImpl); |
@@ -3211,4 +3258,9 @@ public class ContentViewCore |
private native void nativeExtractSmartClipData(long nativeContentViewCoreImpl, |
int x, int y, int w, int h); |
+ |
+ private native void nativeResumeResponseDeferredAtStart( |
+ long nativeContentViewCoreImpl); |
+ private native void nativeSetHasPendingNavigationTransitionForTesting( |
+ long nativeContentViewCoreImpl); |
} |