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

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

Issue 414423002: Removing ContentViewCore dependencies from few functions which acts as direct wrapper to WebContents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restructured WillHandleDeferAfterResponseStarted and DidDeferAfterResponseStarted APIs. Created 6 years, 4 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/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);
}

Powered by Google App Engine
This is Rietveld 408576698