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


Java WindowAndroid类代码示例

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


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

示例1: ContentView

import org.chromium.ui.WindowAndroid; //导入依赖的package包/类
protected ContentView(Context context, int nativeWebContents, WindowAndroid windowAndroid,
        AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    if (getScrollBarStyle() == View.SCROLLBARS_INSIDE_OVERLAY) {
        setHorizontalScrollBarEnabled(false);
        setVerticalScrollBarEnabled(false);
    }

    setFocusable(true);
    setFocusableInTouchMode(true);

    mContentViewCore = new ContentViewCore(context);
    mContentViewCore.initialize(this, this, nativeWebContents, windowAndroid,
            Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN ?
            ContentViewCore.INPUT_EVENTS_DELIVERED_AT_VSYNC :
            ContentViewCore.INPUT_EVENTS_DELIVERED_IMMEDIATELY);
}
 
开发者ID:openresearch,项目名称:android-chromium-view,代码行数:19,代码来源:ContentView.java

示例2: create

import org.chromium.ui.WindowAndroid; //导入依赖的package包/类
@CalledByNative
private static AutofillDialogControllerAndroid create(
        final int nativeAutofillDialogControllerAndroid,
        final WindowAndroid windowAndroid,
        final boolean requestFullBillingAddress, final boolean requestShippingAddress,
        final boolean requestPhoneNumbers,
        final boolean incognitoMode,
        final boolean initialChoiceIsAutofill, final String initialWalletAccountName,
        final String initialBillingGuid, final String initialShippingGuid,
        final String initialCreditCardGuid,
        final String merchantDomain) {
    return new AutofillDialogControllerAndroid(
            nativeAutofillDialogControllerAndroid, windowAndroid,
            requestFullBillingAddress, requestShippingAddress, requestPhoneNumbers,
            incognitoMode,
            initialChoiceIsAutofill, initialWalletAccountName,
            initialBillingGuid, initialShippingGuid,
            initialCreditCardGuid,
            merchantDomain);
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:21,代码来源:AutofillDialogControllerAndroid.java

示例3: createAndInitializeContentViewCore

import org.chromium.ui.WindowAndroid; //导入依赖的package包/类
private static ContentViewCore createAndInitializeContentViewCore(ViewGroup containerView,
        InternalAccessDelegate internalDispatcher, int nativeWebContents,
        ContentViewCore.GestureStateListener pinchGestureStateListener,
        ContentViewClient contentViewClient,
        ContentViewCore.ZoomControlsDelegate zoomControlsDelegate) {
  Context context = containerView.getContext();
  ContentViewCore contentViewCore = new ContentViewCore(context);
  // 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,
          context instanceof Activity ?
                  new ActivityWindowAndroid((Activity) context) : new WindowAndroid(context),
            ContentViewCore.INPUT_EVENTS_DELIVERED_IMMEDIATELY);
  contentViewCore.setGestureStateListener(pinchGestureStateListener);
  contentViewCore.setContentViewClient(contentViewClient);
  contentViewCore.setZoomControlsDelegate(zoomControlsDelegate);
  return contentViewCore;
}
 
开发者ID:R4md4c,项目名称:cordova-android-chromium,代码行数:19,代码来源:AwContents.java

示例4: TestShellTab

import org.chromium.ui.WindowAndroid; //导入依赖的package包/类
/**
 * @param context  The Context the view is running in.
 * @param url      The URL to start this tab with.
 * @param window   The WindowAndroid should represent this tab.
 */
public TestShellTab(Context context, String url, WindowAndroid window) {
    super(false, context, window);
    initialize();
    initContentView();
    loadUrlWithSanitization(url);
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:12,代码来源:TestShellTab.java

示例5: showJavascriptAppModalDialog

import org.chromium.ui.WindowAndroid; //导入依赖的package包/类
@CalledByNative
void showJavascriptAppModalDialog(WindowAndroid window, int nativeDialogPointer) {
    assert window != null;
    Context context = window.getContext();

    // Cache the native dialog pointer so that we can use it to return the response.
    mNativeDialogPointer = nativeDialogPointer;

    LayoutInflater inflater =
            (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    ViewGroup layout = (ViewGroup) inflater.inflate(R.layout.js_modal_dialog, null);
    mSuppressCheckBox = (CheckBox) layout.findViewById(R.id.suppress_js_modal_dialogs);
    mPrompTextView = (TextView) layout.findViewById(R.id.js_modal_dialog_prompt);

    prepare(layout);

    AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context)
            .setView(layout)
            .setTitle(mTitle)
            .setMessage(mMessage)
            .setOnCancelListener(new DialogInterface.OnCancelListener() {
                @Override
                public void onCancel(DialogInterface dialog) {
                    cancel(false);
                }
            });
    if (hasPositiveButton()) {
        dialogBuilder.setPositiveButton(getPositiveButtonText(), this);
    }
    if (hasNegativeButton()) {
        dialogBuilder.setNegativeButton(getNegativeButtonText(), this);
    }

    mDialog = dialogBuilder.create();
    mDialog.setCanceledOnTouchOutside(false);
    mDialog.show();
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:39,代码来源:JavascriptAppModalDialog.java

示例6: TabBase

import org.chromium.ui.WindowAndroid; //导入依赖的package包/类
/**
 * Creates an instance of a {@link TabBase}.
 * @param id        The id this tab should be identified with.
 * @param incognito Whether or not this tab is incognito.
 * @param context   An instance of a {@link Context}.
 * @param window    An instance of a {@link WindowAndroid}.
 */
public TabBase(int id, boolean incognito, Context context, WindowAndroid window) {
    // We need a valid Activity Context to build the ContentView with.
    assert context == null || context instanceof Activity;

    mId = generateValidId(id);
    mIncognito = incognito;
    // TODO(dtrainor): Only store application context here.
    mContext = context;
    mApplicationContext = context != null ? context.getApplicationContext() : null;
    mWindowAndroid = window;
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:19,代码来源:TabBase.java

示例7: setWindow

import org.chromium.ui.WindowAndroid; //导入依赖的package包/类
/**
 * @param window The window used to generate all shells.
 */
public void setWindow(WindowAndroid window) {
    mWindow = window;
}
 
开发者ID:openresearch,项目名称:android-chromium-view,代码行数:7,代码来源:ShellManager.java

示例8: getWindow

import org.chromium.ui.WindowAndroid; //导入依赖的package包/类
/**
 * @return The window used to generate all shells.
 */
public WindowAndroid getWindow() {
    return mWindow;
}
 
开发者ID:openresearch,项目名称:android-chromium-view,代码行数:7,代码来源:ShellManager.java

示例9: onCreate

import org.chromium.ui.WindowAndroid; //导入依赖的package包/类
@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Initializing the command line must occur before loading the library.
    if (!CommandLine.isInitialized()) {
        CommandLine.initFromFile(COMMAND_LINE_FILE);
        String[] commandLineParams = getCommandLineParamsFromIntent(getIntent());
        if (commandLineParams != null) {
            CommandLine.getInstance().appendSwitchesAndArguments(commandLineParams);
        }
    }
    waitForDebuggerIfNeeded();

    DeviceUtils.addDeviceSpecificUserAgentSwitch(this);
    try {
        LibraryLoader.ensureInitialized();
    } catch (ProcessInitException e) {
        Log.e(TAG, "ContentView initialization failed.", e);
        finish();
        return;
    }

    setContentView(R.layout.content_shell_activity);
    mShellManager = (ShellManager) findViewById(R.id.shell_container);
    mWindowAndroid = new WindowAndroid(this);
    mWindowAndroid.restoreInstanceState(savedInstanceState);
    mShellManager.setWindow(mWindowAndroid);

    String startupUrl = getUrlFromIntent(getIntent());
    if (!TextUtils.isEmpty(startupUrl)) {
        mShellManager.setStartupUrl(Shell.sanitizeUrl(startupUrl));
    }

    if (CommandLine.getInstance().hasSwitch(CommandLine.DUMP_RENDER_TREE)) {
        if(BrowserStartupController.get(this).startBrowserProcessesSync(
               BrowserStartupController.MAX_RENDERERS_LIMIT)) {
            finishInitialization(savedInstanceState);
        } else {
            initializationFailed();
        }
    } else {
        BrowserStartupController.get(this).startBrowserProcessesAsync(
                new BrowserStartupController.StartupCallback() {
            @Override
            public void onSuccess(boolean alreadyStarted) {
                finishInitialization(savedInstanceState);
            }

            @Override
            public void onFailure() {
                initializationFailed();
            }
        });
    }
}
 
开发者ID:openresearch,项目名称:android-chromium-view,代码行数:57,代码来源:ContentShellActivity.java

示例10: setWindow

import org.chromium.ui.WindowAndroid; //导入依赖的package包/类
/**
 * @param window The owning window for this shell.
 */
public void setWindow(WindowAndroid window) {
    mWindow = window;
}
 
开发者ID:openresearch,项目名称:android-chromium-view,代码行数:7,代码来源:Shell.java

示例11: JellyBeanContentView

import org.chromium.ui.WindowAndroid; //导入依赖的package包/类
JellyBeanContentView(Context context, int nativeWebContents, WindowAndroid windowAndroid,
        AttributeSet attrs, int defStyle) {
    super(context, nativeWebContents, windowAndroid, attrs, defStyle);
}
 
开发者ID:openresearch,项目名称:android-chromium-view,代码行数:5,代码来源:JellyBeanContentView.java

示例12: 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

示例13: selectFile

import org.chromium.ui.WindowAndroid; //导入依赖的package包/类
/**
 * Creates and starts an intent based on the passed fileTypes and capture value.
 * @param fileTypes MIME types requested (i.e. "image/*")
 * @param capture The capture value as described in http://www.w3.org/TR/html-media-capture/
 * @param window The WindowAndroid that can show intents
 */
@CalledByNative
private void selectFile(String[] fileTypes, boolean capture, WindowAndroid window) {
    mFileTypes = new ArrayList<String>(Arrays.asList(fileTypes));
    mCapture = capture;

    Intent chooser = new Intent(Intent.ACTION_CHOOSER);
    Intent camera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    mCameraOutputUri = Uri.fromFile(getFileForImageCapture());
    camera.putExtra(MediaStore.EXTRA_OUTPUT, mCameraOutputUri);
    Intent camcorder = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
    Intent soundRecorder = new Intent(
            MediaStore.Audio.Media.RECORD_SOUND_ACTION);

    // Quick check - if the |capture| parameter is set and |fileTypes| has the appropriate MIME
    // type, we should just launch the appropriate intent. Otherwise build up a chooser based on
    // the accept type and then display that to the user.
    if (captureCamera()) {
        if (window.showIntent(camera, this, R.string.low_memory_error)) return;
    } else if (captureCamcorder()) {
        if (window.showIntent(camcorder, this, R.string.low_memory_error)) return;
    } else if (captureMicrophone()) {
        if (window.showIntent(soundRecorder, this, R.string.low_memory_error)) return;
    }

    Intent getContentIntent = new Intent(Intent.ACTION_GET_CONTENT);
    getContentIntent.addCategory(Intent.CATEGORY_OPENABLE);
    ArrayList<Intent> extraIntents = new ArrayList<Intent>();
    if (!noSpecificType()) {
        // Create a chooser based on the accept type that was specified in the webpage. Note
        // that if the web page specified multiple accept types, we will have built a generic
        // chooser above.
        if (shouldShowImageTypes()) {
            extraIntents.add(camera);
            getContentIntent.setType(ALL_IMAGE_TYPES);
        } else if (shouldShowVideoTypes()) {
            extraIntents.add(camcorder);
            getContentIntent.setType(ALL_VIDEO_TYPES);
        } else if (shouldShowAudioTypes()) {
            extraIntents.add(soundRecorder);
            getContentIntent.setType(ALL_AUDIO_TYPES);
        }
    }

    if (extraIntents.isEmpty()) {
        // We couldn't resolve an accept type, so fallback to a generic chooser.
        getContentIntent.setType(ANY_TYPES);
        extraIntents.add(camera);
        extraIntents.add(camcorder);
        extraIntents.add(soundRecorder);
    }

    chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS,
            extraIntents.toArray(new Intent[] { }));

    chooser.putExtra(Intent.EXTRA_INTENT, getContentIntent);

    if (!window.showIntent(chooser, this, R.string.low_memory_error)) {
        onFileNotSelected();
    }
}
 
开发者ID:openresearch,项目名称:android-chromium-view,代码行数:67,代码来源:SelectFileDialog.java

示例14: onIntentCompleted

import org.chromium.ui.WindowAndroid; //导入依赖的package包/类
/**
 * Callback method to handle the intent results and pass on the path to the native
 * SelectFileDialog.
 * @param window The window that has access to the application activity.
 * @param resultCode The result code whether the intent returned successfully.
 * @param contentResolver The content resolver used to extract the path of the selected file.
 * @param results The results of the requested intent.
 */
@Override
public void onIntentCompleted(WindowAndroid window, int resultCode,
        ContentResolver contentResolver, Intent results) {
    if (resultCode != Activity.RESULT_OK) {
        onFileNotSelected();
        return;
    }
    boolean success = false;
    if (results == null) {
        // If we have a successful return but no data, then assume this is the camera returning
        // the photo that we requested.
        nativeOnFileSelected(mNativeSelectFileDialog, mCameraOutputUri.getPath());
        success = true;

        // Broadcast to the media scanner that there's a new photo on the device so it will
        // show up right away in the gallery (rather than waiting until the next time the media
        // scanner runs).
        window.sendBroadcast(new Intent(
                Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, mCameraOutputUri));
    } else {
        // We get back a content:// URI from the system if the user picked a file from the
        // gallery. The ContentView has functionality that will convert that content:// URI to
        // a file path on disk that Chromium understands.
        Cursor c = contentResolver.query(results.getData(),
                new String[] { MediaStore.MediaColumns.DATA }, null, null, null);
        if (c != null) {
            if (c.getCount() == 1) {
                c.moveToFirst();
                String path = c.getString(0);
                if (path != null) {
                    // Not all providers support the MediaStore.DATA column. For example,
                    // Gallery3D (com.android.gallery3d.provider) does not support it for
                    // Picasa Web Album images.
                    nativeOnFileSelected(mNativeSelectFileDialog, path);
                    success = true;
                }
            }
            c.close();
        }
    }
    if (!success) {
        onFileNotSelected();
        window.showError(R.string.opening_file_error);
    }
}
 
开发者ID:openresearch,项目名称:android-chromium-view,代码行数:54,代码来源:SelectFileDialog.java

示例15: ViewAndroid

import org.chromium.ui.WindowAndroid; //导入依赖的package包/类
/**
 * Constructs a View object.
 */
public ViewAndroid(WindowAndroid nativeWindow, ViewAndroidDelegate viewAndroidDelegate) {
    mWindowAndroid = nativeWindow;
    mViewAndroidDelegate = viewAndroidDelegate;
    mNativeViewAndroid = nativeInit(mWindowAndroid.getNativePointer());
}
 
开发者ID:openresearch,项目名称:android-chromium-view,代码行数:9,代码来源:ViewAndroid.java


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