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