• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java LoadUrlParams类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: loadUrlWithSanitization

import org.chromium.content.browser.LoadUrlParams; //导入依赖的package包/类
/**
 * Navigates this Tab's {@link ContentView} to a sanitized version of {@code url}.
 * @param url The potentially unsanitized URL to navigate to.
 * @param postData Optional data to be sent via POST.
 */
public void loadUrlWithSanitization(String url, byte[] postData) {
    if (url == null) return;

    // Sanitize the URL.
    url = nativeFixupUrl(mNativeTestShellTab, url);

    // Invalid URLs will just return empty.
    if (TextUtils.isEmpty(url)) return;

    ContentView contentView = getContentView();
    if (TextUtils.equals(url, contentView.getUrl())) {
        contentView.getContentViewCore().reload(true);
    } else {
        if (postData == null) {
            contentView.loadUrl(new LoadUrlParams(url));
        } else {
            contentView.loadUrl(LoadUrlParams.createLoadHttpPostParams(url, postData));
        }
    }
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:26,代码来源:TestShellTab.java


示例2: loadUrlOnUiThread

import org.chromium.content.browser.LoadUrlParams; //导入依赖的package包/类
private void loadUrlOnUiThread(final LoadUrlParams loadUrlParams) {
    // This is the last point that we can delay starting the Chromium backend up
    // and if the app has not caused us to bind the Chromium UI thread to a background thread
    // we now bind Chromium's notion of the UI thread to the app main thread.
    mFactory.startYourEngines(true);
    if (checkNeedsPost()) {
        // Disallowed in WebView API for apps targetting a new SDK
        assert mAppTargetSdkVersion < Build.VERSION_CODES.JELLY_BEAN_MR2;
        mRunQueue.addTask(new Runnable() {
            @Override
            public void run() {
                mAwContents.loadUrl(loadUrlParams);
            }
        });
        return;
    }
    mAwContents.loadUrl(loadUrlParams);
}
 
开发者ID:mogoweb,项目名称:chromium_webview,代码行数:19,代码来源:WebViewChromium.java


示例3: loadUrl

import org.chromium.content.browser.LoadUrlParams; //导入依赖的package包/类
/**
 * Loads an URL.  This will perform minimal amounts of sanitizing of the URL to attempt to
 * make it valid.
 *
 * @param url The URL to be loaded by the shell.
 */
public void loadUrl(String url) {
    if (url == null) return;

    if (TextUtils.equals(url, mContentView.getUrl())) {
        mContentView.getContentViewCore().reload(true);
    } else {
        LoadUrlParams params = new LoadUrlParams(sanitizeUrl(url));
        params.setCanLoadLocalResources(true);
        mContentView.loadUrl(params);
    }
    mUrlTextView.clearFocus();
    // TODO(aurimas): Remove this when crbug.com/174541 is fixed.
    mContentView.clearFocus();
    mContentView.requestFocus();
}
 
开发者ID:R4md4c,项目名称:cordova-android-chromium,代码行数:22,代码来源:Shell.java


示例4: onCreate

import org.chromium.content.browser.LoadUrlParams; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.testshell_activity);

    mAwTestContainerView = createAwTestContainerView();

    LinearLayout contentContainer = (LinearLayout) findViewById(R.id.content_container);
    mAwTestContainerView.setLayoutParams(new LinearLayout.LayoutParams(
            LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 1f));
    contentContainer.addView(mAwTestContainerView);
    mAwTestContainerView.requestFocus();

    initializeUrlField();
    initializeNavigationButtons();

    String startupUrl = getUrlFromIntent(getIntent());
    if (TextUtils.isEmpty(startupUrl)) {
        startupUrl = INITIAL_URL;
    }

    mAwTestContainerView.getAwContents().loadUrl(new LoadUrlParams(startupUrl));
    mUrlTextView.setText(startupUrl);
}
 
开发者ID:R4md4c,项目名称:cordova-android-chromium,代码行数:26,代码来源:AwShellActivity.java


示例5: loadUrl

import org.chromium.content.browser.LoadUrlParams; //导入依赖的package包/类
/**
 * Loads an URL.  This will perform minimal amounts of sanitizing of the URL to attempt to
 * make it valid.
 *
 * @param url The URL to be loaded by the shell.
 */
public void loadUrl(String url) {
    if (url == null) return;

    if (TextUtils.equals(url, mContentView.getUrl())) {
        mContentView.reload();
    } else {
        mContentView.loadUrl(new LoadUrlParams(sanitizeUrl(url)));
    }
    mUrlTextView.clearFocus();
    // TODO(aurimas): Remove this when crbug.com/174541 is fixed.
    mContentView.clearFocus();
    mContentView.requestFocus();
}
 
开发者ID:openresearch,项目名称:android-chromium-view,代码行数:20,代码来源:Shell.java


示例6: loadUrl

import org.chromium.content.browser.LoadUrlParams; //导入依赖的package包/类
/**
 * Loads an URL.  This will perform minimal amounts of sanitizing of the URL to attempt to
 * make it valid.
 *
 * @param url The URL to be loaded by the shell.
 */
public void loadUrl(String url) {
    if (url == null) return;

    if (TextUtils.equals(url, mContentView.getUrl())) {
        mContentView.getContentViewCore().reload(true);
    } else {
        mContentView.loadUrl(new LoadUrlParams(sanitizeUrl(url)));
    }
    mUrlTextView.clearFocus();
    // TODO(aurimas): Remove this when crbug.com/174541 is fixed.
    mContentView.clearFocus();
    mContentView.requestFocus();
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:20,代码来源:Shell.java


示例7: loadUrl

import org.chromium.content.browser.LoadUrlParams; //导入依赖的package包/类
@Override
public void loadUrl(final String url, Map<String, String> additionalHttpHeaders) {
    // TODO: We may actually want to do some sanity checks here (like filter about://chrome).

    // For backwards compatibility, apps targeting less than K will have JS URLs evaluated
    // directly and any result of the evaluation will not replace the current page content.
    // Matching Chrome behavior more closely; apps targetting >= K that load a JS URL will
    // have the result of that URL replace the content of the current page.
    final String JAVASCRIPT_SCHEME = "javascript:";
    if (mAppTargetSdkVersion < Build.VERSION_CODES.KITKAT &&
            url != null && url.startsWith(JAVASCRIPT_SCHEME)) {
        mFactory.startYourEngines(true);
        if (checkNeedsPost()) {
            mRunQueue.addTask(new Runnable() {
                @Override
                public void run() {
                    mAwContents.evaluateJavaScriptEvenIfNotYetNavigated(
                            url.substring(JAVASCRIPT_SCHEME.length()));
                }
            });
        } else {
            mAwContents.evaluateJavaScriptEvenIfNotYetNavigated(
                    url.substring(JAVASCRIPT_SCHEME.length()));
        }
        return;
    }

    LoadUrlParams params = new LoadUrlParams(url);
    if (additionalHttpHeaders != null) params.setExtraHeaders(additionalHttpHeaders);
    loadUrlOnUiThread(params);
}
 
开发者ID:mogoweb,项目名称:chromium_webview,代码行数:32,代码来源:WebViewChromium.java


示例8: postUrl

import org.chromium.content.browser.LoadUrlParams; //导入依赖的package包/类
@Override
public void postUrl(String url, byte[] postData) {
    LoadUrlParams params = LoadUrlParams.createLoadHttpPostParams(url, postData);
    Map<String,String> headers = new HashMap<String,String>();
    headers.put("Content-Type", "application/x-www-form-urlencoded");
    params.setExtraHeaders(headers);
    loadUrlOnUiThread(params);
}
 
开发者ID:mogoweb,项目名称:chromium_webview,代码行数:9,代码来源:WebViewChromium.java


示例9: loadUrl

import org.chromium.content.browser.LoadUrlParams; //导入依赖的package包/类
public void loadUrl(String url) {
    mStartupUrl = url;
    if (url.startsWith("javascript:")) {
        this.getContentView().evaluateJavaScript(url);
    } else {
        this.getContentView().loadUrl(new LoadUrlParams(url));
    }
}
 
开发者ID:R4md4c,项目名称:cordova-android-chromium,代码行数:9,代码来源:CordovaChromiumView.java


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


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


示例12: loadData

import org.chromium.content.browser.LoadUrlParams; //导入依赖的package包/类
@Override
public void loadData(String data, String mimeType, String encoding) {
    loadUrlOnUiThread(LoadUrlParams.createLoadDataParams(
            fixupData(data), fixupMimeType(mimeType), isBase64Encoded(encoding)));
}
 
开发者ID:mogoweb,项目名称:chromium_webview,代码行数:6,代码来源:WebViewChromium.java


示例13: loadDataWithBaseURL

import org.chromium.content.browser.LoadUrlParams; //导入依赖的package包/类
@Override
public void loadDataWithBaseURL(String baseUrl, String data, String mimeType, String encoding,
        String historyUrl) {
    data = fixupData(data);
    mimeType = fixupMimeType(mimeType);
    LoadUrlParams loadUrlParams;
    baseUrl = fixupBase(baseUrl);
    historyUrl = fixupHistory(historyUrl);

    if (baseUrl.startsWith("data:")) {
        // For backwards compatibility with WebViewClassic, we use the value of |encoding|
        // as the charset, as long as it's not "base64".
        boolean isBase64 = isBase64Encoded(encoding);
        loadUrlParams = LoadUrlParams.createLoadDataParamsWithBaseUrl(
                data, mimeType, isBase64, baseUrl, historyUrl, isBase64 ? null : encoding);
    } else {
        // When loading data with a non-data: base URL, the classic WebView would effectively
        // "dump" that string of data into the WebView without going through regular URL
        // loading steps such as decoding URL-encoded entities. We achieve this same behavior by
        // base64 encoding the data that is passed here and then loading that as a data: URL.
        try {
            loadUrlParams = LoadUrlParams.createLoadDataParamsWithBaseUrl(
                    Base64.encodeToString(data.getBytes("utf-8"), Base64.DEFAULT), mimeType,
                    true, baseUrl, historyUrl, "utf-8");
        } catch (java.io.UnsupportedEncodingException e) {
            Log.wtf(TAG, "Unable to load data string " + data, e);
            return;
        }
    }
    loadUrlOnUiThread(loadUrlParams);

    // Data url's with a base url will be resolved in Blink, and not cause an onPageStarted
    // event to be sent. Sending the callback directly from here.
    final String finalBaseUrl = loadUrlParams.getBaseUrl();
    ThreadUtils.postOnUiThread(new Runnable() {
        @Override
        public void run() {
            mContentsClientAdapter.onPageStarted(finalBaseUrl);
        }
    });
}
 
开发者ID:mogoweb,项目名称:chromium_webview,代码行数:42,代码来源:WebViewChromium.java


示例14: loadDataWithBaseURL

import org.chromium.content.browser.LoadUrlParams; //导入依赖的package包/类
/**
 * Loads the given data into this WebView, using baseUrl as the base URL for
 * the content. The base URL is used both to resolve relative URLs and when
 * applying JavaScript's same origin policy. The historyUrl is used for the
 * history entry.
 * <p>
 * Note that content specified in this way can access local device files
 * (via 'file' scheme URLs) only if baseUrl specifies a scheme other than
 * 'http', 'https', 'ftp', 'ftps', 'about' or 'javascript'.
 * <p>
 * If the base URL uses the data scheme, this method is equivalent to
 * calling {@link #loadData(String,String,String) loadData()} and the
 * historyUrl is ignored.
 *
 * @param baseUrl the URL to use as the page's base URL. If null defaults to
 *                'about:blank'.
 * @param data a String of data in the given encoding
 * @param mimeType the MIMEType of the data, e.g. 'text/html'. If null,
 *                 defaults to 'text/html'.
 * @param encoding the encoding of the data
 * @param historyUrl the URL to use as the history entry. If null defaults
 *                   to 'about:blank'.
 */
public void loadDataWithBaseURL(String baseUrl, String data,
        String mimeType, String encoding, String historyUrl) {
    LoadUrlParams loadUrlParams =
            LoadUrlParams.createLoadDataParamsWithBaseUrl(data, mimeType,
                    encoding.equals("base64"), baseUrl, historyUrl);
    checkThread();
    if (DebugFlags.TRACE_API) Log.d(LOGTAG, "loadDataWithBaseURL=" + baseUrl);
    mProvider.loadDataWithBaseURL(baseUrl, data, mimeType, encoding, historyUrl);
}
 
开发者ID:mogoweb,项目名称:chromium_webview,代码行数:33,代码来源:WebView.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ClientException类代码示例发布时间:2022-05-22
下一篇:
Java WorkgroupInvitation类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap