当前位置: 首页>>代码示例>>Java>>正文


Java WindowAndroid.getNativePointer方法代码示例

本文整理汇总了Java中org.chromium.ui.WindowAndroid.getNativePointer方法的典型用法代码示例。如果您正苦于以下问题:Java WindowAndroid.getNativePointer方法的具体用法?Java WindowAndroid.getNativePointer怎么用?Java WindowAndroid.getNativePointer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.chromium.ui.WindowAndroid的用法示例。


在下文中一共展示了WindowAndroid.getNativePointer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initialize

import org.chromium.ui.WindowAndroid; //导入方法依赖的package包/类
/**
 *
 * @param containerView The view that will act as a container for all views created by this.
 * @param internalDispatcher Handles dispatching all hidden or super methods to the
 *                           containerView.
 * @param nativeWebContents A pointer to the native web contents.
 * @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(ViewGroup containerView, InternalAccessDelegate internalDispatcher,
        int nativeWebContents, WindowAndroid windowAndroid,
        int inputEventDeliveryMode) {
    // Check whether to use hardware acceleration. This is a bit hacky, and
    // only works if the Context is actually an Activity (as it is in the
    // Chrome application).
    //
    // What we're doing here is checking whether the app has *requested*
    // hardware acceleration by setting the appropriate flags. This does not
    // necessarily mean we're going to *get* hardware acceleration -- that's
    // up to the Android framework.
    //
    // TODO(husky): Once the native code has been updated so that the
    // HW acceleration flag can be set dynamically (Grace is doing this),
    // move this check into onAttachedToWindow(), where we can test for
    // HW support directly.
    mHardwareAccelerated = hasHardwareAcceleration(mContext);

    mContainerView = containerView;

    int windowNativePointer = windowAndroid != null ? windowAndroid.getNativePointer() : 0;

    int viewAndroidNativePointer = 0;
    if (windowNativePointer != 0) {
        mViewAndroid = new ViewAndroid(windowAndroid, getViewAndroidDelegate());
        viewAndroidNativePointer = mViewAndroid.getNativePointer();
    }

    mNativeContentViewCore = nativeInit(mHardwareAccelerated,
            nativeWebContents, viewAndroidNativePointer, windowNativePointer);
    mContentSettings = new ContentSettings(this, mNativeContentViewCore);
    initializeContainerView(internalDispatcher, inputEventDeliveryMode);

    mAccessibilityInjector = AccessibilityInjector.newInstance(this);

    String contentDescription = "Web View";
    if (R.string.accessibility_content_view == 0) {
        Log.w(TAG, "Setting contentDescription to 'Web View' as no value was specified.");
    } else {
        contentDescription = mContext.getResources().getString(
                R.string.accessibility_content_view);
    }
    mContainerView.setContentDescription(contentDescription);
    mWebContentsObserver = new WebContentsObserverAndroid(this) {
        @Override
        public void didStartLoading(String url) {
            hidePopupDialog();
            resetGestureDetectors();
        }
    };

    mPid = nativeGetCurrentRenderProcessId(mNativeContentViewCore);
}
 
开发者ID:openresearch,项目名称:android-chromium-view,代码行数:71,代码来源:ContentViewCore.java

示例2: initialize

import org.chromium.ui.WindowAndroid; //导入方法依赖的package包/类
/**
 *
 * @param containerView The view that will act as a container for all views created by this.
 * @param internalDispatcher Handles dispatching all hidden or super methods to the
 *                           containerView.
 * @param nativeWebContents A pointer to the native web contents.
 * @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(ViewGroup containerView, InternalAccessDelegate internalDispatcher,
        int nativeWebContents, WindowAndroid windowAndroid,
        int inputEventDeliveryMode) {
    // Check whether to use hardware acceleration. This is a bit hacky, and
    // only works if the Context is actually an Activity (as it is in the
    // Chrome application).
    //
    // What we're doing here is checking whether the app has *requested*
    // hardware acceleration by setting the appropriate flags. This does not
    // necessarily mean we're going to *get* hardware acceleration -- that's
    // up to the Android framework.
    //
    // TODO(husky): Once the native code has been updated so that the
    // HW acceleration flag can be set dynamically (Grace is doing this),
    // move this check into onAttachedToWindow(), where we can test for
    // HW support directly.
    mHardwareAccelerated = hasHardwareAcceleration(mContext);

    mContainerView = containerView;
    mPositionObserver = new ViewPositionObserver(mContainerView);
    mPositionListener = new PositionObserver.Listener() {
        @Override
        public void onPositionChanged(int x, int y) {
            if (isSelectionHandleShowing() || isInsertionHandleShowing()) {
                temporarilyHideTextHandles();
            }
        }
    };

    int windowNativePointer = windowAndroid != null ? windowAndroid.getNativePointer() : 0;

    int viewAndroidNativePointer = 0;
    if (windowNativePointer != 0) {
        mViewAndroid = new ViewAndroid(windowAndroid, getViewAndroidDelegate());
        viewAndroidNativePointer = mViewAndroid.getNativePointer();
    }

    mNativeContentViewCore = nativeInit(mHardwareAccelerated,
            nativeWebContents, viewAndroidNativePointer, windowNativePointer);
    mContentSettings = new ContentSettings(this, mNativeContentViewCore);
    initializeContainerView(internalDispatcher, inputEventDeliveryMode);

    mAccessibilityInjector = AccessibilityInjector.newInstance(this);

    String contentDescription = "Web View";
    if (R.string.accessibility_content_view == 0) {
        Log.w(TAG, "Setting contentDescription to 'Web View' as no value was specified.");
    } else {
        contentDescription = mContext.getResources().getString(
                R.string.accessibility_content_view);
    }
    mContainerView.setContentDescription(contentDescription);
    mWebContentsObserver = new WebContentsObserverAndroid(this) {
        @Override
        public void didStartLoading(String url) {
            hidePopupDialog();
            resetGestureDetectors();
        }
    };

    sendOrientationChangeEvent();
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:80,代码来源:ContentViewCore.java


注:本文中的org.chromium.ui.WindowAndroid.getNativePointer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。