Java源码示例:org.chromium.ui.base.ViewAndroidDelegate

示例1
private ContentViewCore createContentViewCore(WebContents webContents) {
    ContentViewCore cvc = new ContentViewCore(mThemedApplicationContext, PRODUCT_VERSION);
    ContentView cv = ContentView.createContentView(mThemedApplicationContext, cvc);
    cv.setContentDescription(mThemedApplicationContext.getResources().getString(
            R.string.accessibility_content_view));
    cvc.initialize(ViewAndroidDelegate.createBasicDelegate(cv), cv, webContents,
            getWindowAndroid());
    ChromeActionModeCallback actionModeCallback = new ChromeActionModeCallback(
            mThemedApplicationContext, this, cvc.getActionModeCallbackHelper());
    cvc.setActionModeCallback(actionModeCallback);
    return cvc;
}
 
示例2
@CalledByNative
private static AutofillPopupBridge create(long nativeAutofillPopupViewAndroid,
        WindowAndroid windowAndroid, ViewAndroidDelegate viewAndroidDelegate) {
    return new AutofillPopupBridge(
            nativeAutofillPopupViewAndroid, windowAndroid, viewAndroidDelegate);
}
 
示例3
/**
 *
 * @param viewDelegate Delegate to add/remove anchor views.
 * @param internalDispatcher Handles dispatching all hidden or super methods to the
 *                           containerView.
 * @param webContents A WebContents instance to connect to.
 * @param windowAndroid An instance of the WindowAndroid.
 */
// Perform important post-construction set up of the ContentViewCore.
// We do not require the containing view in the constructor to allow embedders to create a
// ContentViewCore without having fully created its containing view. The containing view
// is a vital component of the ContentViewCore, so embedders must exercise caution in what
// they do with the ContentViewCore before calling initialize().
// We supply the nativeWebContents pointer here rather than in the constructor to allow us
// to set the private browsing mode at a later point for the WebView implementation.
// Note that the caller remains the owner of the nativeWebContents and is responsible for
// deleting it after destroying the ContentViewCore.
public void initialize(ViewAndroidDelegate viewDelegate,
        InternalAccessDelegate internalDispatcher, WebContents webContents,
        WindowAndroid windowAndroid) {
    mViewAndroidDelegate = viewDelegate;
    setContainerView(viewDelegate.getContainerView());
    long windowNativePointer = windowAndroid.getNativePointer();
    assert windowNativePointer != 0;

    final float dipScale = windowAndroid.getDisplay().getDipScale();

    mRenderCoordinates.reset();
    mRenderCoordinates.setDeviceScaleFactor(dipScale, windowAndroid.getContext());

    mNativeContentViewCore = nativeInit(webContents, mViewAndroidDelegate, windowNativePointer,
            dipScale, mRetainedJavaScriptObjects);
    mWebContents = nativeGetWebContentsAndroid(mNativeContentViewCore);

    setContainerViewInternals(internalDispatcher);

    initPopupZoomer(mContext);
    mImeAdapter = new ImeAdapter(
            mWebContents, mContainerView, new InputMethodManagerWrapper(mContext));
    mImeAdapter.addEventObserver(this);

    mSelectionPopupController = new SelectionPopupController(
            mContext, windowAndroid, webContents, mContainerView, mRenderCoordinates);
    mSelectionPopupController.setCallback(ActionModeCallbackHelper.EMPTY_CALLBACK);
    mSelectionPopupController.setContainerView(mContainerView);

    mWebContentsObserver = new ContentViewWebContentsObserver(this);

    mShouldRequestUnbufferedDispatch = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP
            && ContentFeatureList.isEnabled(ContentFeatureList.REQUEST_UNBUFFERED_DISPATCH);
}
 
示例4
private native long nativeInit(WebContents webContents, ViewAndroidDelegate viewAndroidDelegate,
long windowAndroidPtr, float dipScale, HashSet<Object> retainedObjectSet);
 
示例5
/**
 * A convenience method for the constructor to be invoked from the native counterpart.
 * @param nativePopup The pointer to the native counterpart.
 * @param windowAndroid The browser window.
 * @param containerViewDelegate Interface to acquire and release anchors.
 */
@CalledByNative
private static PasswordGenerationPopupBridge create(long nativePopup,
        WindowAndroid windowAndroid, ViewAndroidDelegate viewAndroidDelegate) {
    return new PasswordGenerationPopupBridge(nativePopup, windowAndroid, viewAndroidDelegate);
}