use of org.chromium.content.browser.ContentViewCore in project chromeview by pwnall.
the class AwContents method createAndInitializeContentViewCore.
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;
}
use of org.chromium.content.browser.ContentViewCore in project chromeview by pwnall.
the class AwContents method setNewWebContents.
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 = createAndInitializeContentViewCore(mContainerView, mInternalAccessAdapter, newWebContentsPtr, new AwPinchGestureStateListener(), mContentsClient.getContentViewClient(), mZoomControls);
mContentsClient.installWebContentsObserver(newCore);
// Now swap the Java side reference.
mContentViewCore.destroy();
mContentViewCore = newCore;
// Now rewire native side to use the new WebContents.
nativeSetWebContents(mNativeAwContents, newWebContentsPtr);
nativeSetIoThreadClient(mNativeAwContents, mIoThreadClient);
nativeSetInterceptNavigationDelegate(mNativeAwContents, mInterceptNavigationDelegate);
// This will also apply settings to the new WebContents.
mSettings.setWebContents(newWebContentsPtr);
// Finally poke the new ContentViewCore with the size of the container view and show it.
if (mContainerView.getWidth() != 0 || mContainerView.getHeight() != 0) {
mContentViewCore.onSizeChanged(mContainerView.getWidth(), mContainerView.getHeight(), 0, 0);
}
nativeDidInitializeContentViewCore(mNativeAwContents, mContentViewCore.getNativeContentViewCore());
if (mContainerView.getVisibility() == View.VISIBLE) {
// The popup window was hidden when we prompted the embedder to display
// it, so show it again now we have a container.
mContentViewCore.onShow();
}
}
Aggregations