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


Java LoadUrlParams.getLoadUrlType方法代码示例

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


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

示例1: loadUrl

import org.chromium.content.browser.LoadUrlParams; //导入方法依赖的package包/类
/**
 * Load url without fixing up the url string. Consumers of ContentView are responsible for
 * ensuring the URL passed in is properly formatted (i.e. the scheme has been added if left
 * off during user input).
 *
 * @param pararms Parameters for this load.
 */
public void loadUrl(LoadUrlParams params) {
    if (params.getLoadUrlType() == LoadUrlParams.LOAD_TYPE_DATA &&
        !params.isBaseUrlDataScheme()) {
        // This allows data URLs with a non-data base URL access to file:///android_asset/ and
        // file:///android_res/ URLs. If AwSettings.getAllowFileAccess permits, it will also
        // allow access to file:// URLs (subject to OS level permission checks).
        params.setCanLoadLocalResources(true);
    }

    // If we are reloading the same url, then set transition type as reload.
    if (params.getUrl() != null &&
        params.getUrl().equals(mContentViewCore.getUrl()) &&
        params.getTransitionType() == PageTransitionTypes.PAGE_TRANSITION_LINK) {
        params.setTransitionType(PageTransitionTypes.PAGE_TRANSITION_RELOAD);
    }
    params.setTransitionType(
            params.getTransitionType() | PageTransitionTypes.PAGE_TRANSITION_FROM_API);

    // For WebView, always use the user agent override, which is set
    // every time the user agent in AwSettings is modified.
    params.setOverrideUserAgent(LoadUrlParams.UA_OVERRIDE_TRUE);

    mContentViewCore.loadUrl(params);

    suppressInterceptionForThisNavigation();

    // The behavior of WebViewClassic uses the populateVisitedLinks callback in WebKit.
    // Chromium does not use this use code path and the best emulation of this behavior to call
    // request visited links once on the first URL load of the WebView.
    if (!mHasRequestedVisitedHistoryFromClient) {
      mHasRequestedVisitedHistoryFromClient = true;
      requestVisitedHistoryFromClient();
    }
}
 
开发者ID:R4md4c,项目名称:cordova-android-chromium,代码行数:42,代码来源:AwContents.java

示例2: loadUrl

import org.chromium.content.browser.LoadUrlParams; //导入方法依赖的package包/类
/**
 * Load url without fixing up the url string. Consumers of ContentView are responsible for
 * ensuring the URL passed in is properly formatted (i.e. the scheme has been added if left
 * off during user input).
 *
 * @param params Parameters for this load.
 */
public void loadUrl(LoadUrlParams params) {
    if (params.getLoadUrlType() == LoadUrlParams.LOAD_TYPE_DATA &&
            !params.isBaseUrlDataScheme()) {
        // This allows data URLs with a non-data base URL access to file:///android_asset/ and
        // file:///android_res/ URLs. If AwSettings.getAllowFileAccess permits, it will also
        // allow access to file:// URLs (subject to OS level permission checks).
        params.setCanLoadLocalResources(true);
    }

    // If we are reloading the same url, then set transition type as reload.
    if (params.getUrl() != null &&
            params.getUrl().equals(mContentViewCore.getUrl()) &&
            params.getTransitionType() == PageTransitionTypes.PAGE_TRANSITION_LINK) {
            params.setTransitionType(PageTransitionTypes.PAGE_TRANSITION_RELOAD);
    }
    params.setTransitionType(
            params.getTransitionType() | PageTransitionTypes.PAGE_TRANSITION_FROM_API);

    // For WebView, always use the user agent override, which is set
    // every time the user agent in AwSettings is modified.
    params.setOverrideUserAgent(LoadUrlParams.UA_OVERRIDE_TRUE);

    // We don't pass extra headers to the content layer, as WebViewClassic
    // was adding them in a very narrow set of conditions. See http://crbug.com/306873
    if (mNativeAwContents != 0) {
        nativeSetExtraHeadersForUrl(
                mNativeAwContents, params.getUrl(), params.getExtraHttpRequestHeadersString());
    }
    params.setExtraHeaders(new HashMap<String, String>());

    mContentViewCore.loadUrl(params);

    // The behavior of WebViewClassic uses the populateVisitedLinks callback in WebKit.
    // Chromium does not use this use code path and the best emulation of this behavior to call
    // request visited links once on the first URL load of the WebView.
    if (!mHasRequestedVisitedHistoryFromClient) {
        mHasRequestedVisitedHistoryFromClient = true;
        requestVisitedHistoryFromClient();
    }

    if (params.getLoadUrlType() == LoadUrlParams.LOAD_TYPE_DATA &&
            params.getBaseUrl() != null) {
        // Data loads with a base url will be resolved in Blink, and not cause an onPageStarted
        // event to be sent. Sending the callback directly from here.
        mContentsClient.getCallbackHelper().postOnPageStarted(params.getBaseUrl());
    }
}
 
开发者ID:mogoweb,项目名称:chromium_webview,代码行数:55,代码来源:AwContents.java


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