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

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

Issue 297973002: Navigation transitions: Block first response until after transitions have run. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 6 years, 6 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/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 7f6d364b9c9a50ea02976ff5e24e6b44036516af..377bf026e918a51089ed02cc9d034797cb694c13 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
@@ -213,6 +213,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
@@ -3020,6 +3039,29 @@ public class ContentViewCore
}
}
+ @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.
*
@@ -3074,6 +3116,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);
@@ -3235,4 +3282,9 @@ public class ContentViewCore
private native void nativeExtractSmartClipData(long nativeContentViewCoreImpl,
int x, int y, int w, int h);
private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl, boolean opaque);
+
+ private native void nativeResumeResponseDeferredAtStart(
+ long nativeContentViewCoreImpl);
+ private native void nativeSetHasPendingNavigationTransitionForTesting(
+ long nativeContentViewCoreImpl);
}
« no previous file with comments | « content/content_tests.gypi ('k') | content/public/android/javatests/src/org/chromium/content/browser/TransitionTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698