Search in sources :

Example 31 with ContentViewCore

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;
}
Also used : ContentViewCore(org.chromium.content.browser.ContentViewCore)

Example 32 with 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();
    }
}
Also used : ContentViewCore(org.chromium.content.browser.ContentViewCore)

Aggregations

ContentViewCore (org.chromium.content.browser.ContentViewCore)32 View (android.view.View)5 Tab (org.chromium.chrome.browser.tab.Tab)4 WindowAndroid (org.chromium.ui.base.WindowAndroid)4 ViewGroup (android.view.ViewGroup)3 ContentView (org.chromium.content.browser.ContentView)3 Paint (android.graphics.Paint)2 FrameLayout (android.widget.FrameLayout)2 CalledByNative (org.chromium.base.annotations.CalledByNative)2 LayoutTab (org.chromium.chrome.browser.compositor.layouts.components.LayoutTab)2 StackLayout (org.chromium.chrome.browser.compositor.layouts.phone.StackLayout)2 WebContents (org.chromium.content_public.browser.WebContents)2 SuppressLint (android.annotation.SuppressLint)1 Activity (android.app.Activity)1 Nullable (android.support.annotation.Nullable)1 CoordinatorLayout (android.support.design.widget.CoordinatorLayout)1 MotionEvent (android.view.MotionEvent)1 SurfaceView (android.view.SurfaceView)1 OnLayoutChangeListener (android.view.View.OnLayoutChangeListener)1 LayoutParams (android.view.ViewGroup.LayoutParams)1