| Index: android_webview/java/src/org/chromium/android_webview/AwContents.java
|
| diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java
|
| index 17bfdb5d1d2ac29b5e436d156161098e7d3e37d9..502d0dcca76b5f9e17c7fb58a850f525350e7c66 100644
|
| --- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
|
| +++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
|
| @@ -35,6 +35,7 @@ import org.chromium.base.JNINamespace;
|
| import org.chromium.base.ThreadUtils;
|
| import org.chromium.content.browser.ContentSettings;
|
| import org.chromium.content.browser.ContentVideoView;
|
| +import org.chromium.content.browser.ContentViewClient;
|
| import org.chromium.content.browser.ContentViewCore;
|
| import org.chromium.content.browser.ContentViewStatics;
|
| import org.chromium.content.browser.LoadUrlParams;
|
| @@ -300,6 +301,22 @@ public class AwContents {
|
| isAccessFromFileURLsGrantedByDefault, new AwLayoutSizer());
|
| }
|
|
|
| + private static ContentViewCore createAndInitializeContentViewCore(ViewGroup containerView,
|
| + InternalAccessDelegate internalDispatcher, int nativeWebContents,
|
| + ContentViewCore.PinchGestureStateListener pinchGestureStateListener,
|
| + ContentViewClient contentViewClient,
|
| + ContentViewCore.ZoomControlsDelegate zoomControlsDelegate) {
|
| + ContentViewCore contentViewCore = new ContentViewCore(containerView.getContext());
|
| + // Note INPUT_EVENTS_DELIVERED_IMMEDIATELY is passed to avoid triggering vsync in the
|
| + // compositor, not because input events are delivered immediately.
|
| + contentViewCore.initialize(containerView, internalDispatcher, nativeWebContents, null,
|
| + ContentViewCore.INPUT_EVENTS_DELIVERED_IMMEDIATELY);
|
| + contentViewCore.setPinchGestureStateListener(pinchGestureStateListener);
|
| + contentViewCore.setContentViewClient(contentViewClient);
|
| + contentViewCore.setZoomControlsDelegate(zoomControlsDelegate);
|
| + return contentViewCore;
|
| + }
|
| +
|
| /**
|
| * @param layoutSizer the AwLayoutSizer instance implementing the sizing policy for the view.
|
| *
|
| @@ -315,8 +332,6 @@ public class AwContents {
|
| mDIPScale = DeviceDisplayInfo.create(containerView.getContext()).getDIPScale();
|
| // Note that ContentViewCore must be set up before AwContents, as ContentViewCore
|
| // setup performs process initialisation work needed by AwContents.
|
| - mContentViewCore = new ContentViewCore(containerView.getContext());
|
| - mContentViewCore.setPinchGestureStateListener(new AwPinchGestureStateListener());
|
| mContentsClientBridge = new AwContentsClientBridge(contentsClient);
|
| mLayoutSizer = layoutSizer;
|
| mLayoutSizer.setDelegate(new AwLayoutSizerDelegate());
|
| @@ -328,11 +343,11 @@ public class AwContents {
|
| mCleanupReference = new CleanupReference(this, new DestroyRunnable(mNativeAwContents));
|
|
|
| int nativeWebContents = nativeGetWebContents(mNativeAwContents);
|
| - mContentViewCore.initialize(
|
| - containerView, internalAccessAdapter, nativeWebContents, null);
|
| - mContentViewCore.setContentViewClient(mContentsClient.getContentViewClient());
|
| mZoomControls = new AwZoomControls(this);
|
| - mContentViewCore.setZoomControlsDelegate(mZoomControls);
|
| + mContentViewCore = createAndInitializeContentViewCore(
|
| + containerView, internalAccessAdapter, nativeWebContents,
|
| + new AwPinchGestureStateListener(), mContentsClient.getContentViewClient(),
|
| + mZoomControls);
|
| mContentsClient.installWebContentsObserver(mContentViewCore);
|
|
|
| mSettings = new AwSettings(mContentViewCore.getContext(), nativeWebContents,
|
| @@ -576,10 +591,10 @@ public class AwContents {
|
| private void setNewWebContents(int newWebContentsPtr) {
|
| // When setting a new WebContents, we new up a ContentViewCore that will
|
| // wrap it and then swap it.
|
| - ContentViewCore newCore = new ContentViewCore(mContainerView.getContext());
|
| - newCore.initialize(mContainerView, mInternalAccessAdapter, newWebContentsPtr, null);
|
| - newCore.setContentViewClient(mContentsClient.getContentViewClient());
|
| - newCore.setZoomControlsDelegate(mZoomControls);
|
| + ContentViewCore newCore = createAndInitializeContentViewCore(
|
| + mContainerView, mInternalAccessAdapter, newWebContentsPtr,
|
| + new AwPinchGestureStateListener(), mContentsClient.getContentViewClient(),
|
| + mZoomControls);
|
| mContentsClient.installWebContentsObserver(newCore);
|
|
|
| // Now swap the Java side reference.
|
|
|