use of org.chromium.content_public.browser.LoadUrlParams in project AndroidChromium by JackyAndroid.
the class ContextualSearchManager method openResolvedSearchUrlInNewTab.
@Override
public void openResolvedSearchUrlInNewTab() {
if (mSearchRequest != null && mSearchRequest.getSearchUrlForPromotion() != null) {
TabModelSelector tabModelSelector = mActivity.getTabModelSelector();
tabModelSelector.openNewTab(new LoadUrlParams(mSearchRequest.getSearchUrlForPromotion()), TabLaunchType.FROM_LINK, tabModelSelector.getCurrentTab(), tabModelSelector.isIncognitoSelected());
}
}
use of org.chromium.content_public.browser.LoadUrlParams in project AndroidChromium by JackyAndroid.
the class RecentTabsManager method openHistoryPage.
/**
* Opens the history page.
*/
public void openHistoryPage() {
if (mIsDestroyed)
return;
mTab.loadUrl(new LoadUrlParams(UrlConstants.HISTORY_URL));
StartupMetrics.getInstance().recordOpenedHistory();
}
use of org.chromium.content_public.browser.LoadUrlParams in project AndroidChromium by JackyAndroid.
the class CustomTabActivity method loadUrlInTab.
/**
* Loads the current tab with the given load params while taking client
* referrer and extra headers into account.
*/
private void loadUrlInTab(final Tab tab, final LoadUrlParams params, long timeStamp) {
Intent intent = getIntent();
String url = getUrlToLoad();
if (mHasPrerendered && UrlUtilities.urlsFragmentsDiffer(mPrerenderedUrl, url)) {
mHasPrerendered = false;
LoadUrlParams temporaryParams = new LoadUrlParams(mPrerenderedUrl);
IntentHandler.addReferrerAndHeaders(temporaryParams, intent, this);
tab.loadUrl(temporaryParams);
params.setShouldReplaceCurrentEntry(true);
}
IntentHandler.addReferrerAndHeaders(params, intent, this);
if (params.getReferrer() == null) {
params.setReferrer(CustomTabsConnection.getInstance(getApplication()).getReferrerForSession(mSession));
}
// See ChromeTabCreator#getTransitionType(). This marks the navigation chain as starting
// from an external intent (unless otherwise specified by an extra in the intent).
params.setTransitionType(IntentHandler.getTransitionTypeFromIntent(this, intent, PageTransition.LINK | PageTransition.FROM_API));
mTabObserver.trackNextPageLoadFromTimestamp(timeStamp);
tab.loadUrl(params);
}
use of org.chromium.content_public.browser.LoadUrlParams in project AndroidChromium by JackyAndroid.
the class DataUseTabUIManager method startDataUseDialog.
/**
* Shows a dialog with the option to cancel the navigation or continue. Also allows the user to
* opt out of seeing this dialog again.
*
* @param activity Current activity.
* @param tab The tab loading the url.
* @param url URL that is pending.
* @param pageTransitionType The type of transition. see
* {@link org.chromium.content.browser.PageTransition} for valid values.
* @param referrerUrl URL for the referrer.
*/
private static void startDataUseDialog(final Activity activity, final Tab tab, final String url, final int pageTransitionType, final String referrerUrl) {
View dataUseDialogView = View.inflate(activity, R.layout.data_use_dialog, null);
final TextView textView = (TextView) dataUseDialogView.findViewById(R.id.data_use_message);
textView.setText(getDataUseUIString(DataUseUIMessage.DATA_USE_TRACKING_ENDED_MESSAGE));
final CheckBox checkBox = (CheckBox) dataUseDialogView.findViewById(R.id.data_use_checkbox);
checkBox.setText(getDataUseUIString(DataUseUIMessage.DATA_USE_TRACKING_ENDED_CHECKBOX_MESSAGE));
View learnMore = dataUseDialogView.findViewById(R.id.learn_more);
learnMore.setOnClickListener(new android.view.View.OnClickListener() {
@Override
public void onClick(View v) {
EmbedContentViewActivity.show(activity, getDataUseUIString(DataUseUIMessage.DATA_USE_LEARN_MORE_TITLE), getDataUseUIString(DataUseUIMessage.DATA_USE_LEARN_MORE_LINK_URL));
recordDataUseUIAction(DataUsageUIAction.DIALOG_LEARN_MORE_CLICKED);
}
});
new AlertDialog.Builder(activity, R.style.AlertDialogTheme).setTitle(getDataUseUIString(DataUseUIMessage.DATA_USE_TRACKING_ENDED_TITLE)).setView(dataUseDialogView).setPositiveButton(getDataUseUIString(DataUseUIMessage.DATA_USE_TRACKING_ENDED_CONTINUE), new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
setOptedOutOfDataUseDialog(activity, checkBox.isChecked());
LoadUrlParams loadUrlParams = new LoadUrlParams(url, pageTransitionType);
if (!TextUtils.isEmpty(referrerUrl)) {
Referrer referrer = new Referrer(referrerUrl, Referrer.REFERRER_POLICY_ALWAYS);
loadUrlParams.setReferrer(referrer);
}
tab.loadUrl(loadUrlParams);
recordDataUseUIAction(DataUsageUIAction.DIALOG_CONTINUE_CLICKED);
userClickedContinueOnDialogBox(tab);
}
}).setNegativeButton(R.string.cancel, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
setOptedOutOfDataUseDialog(activity, checkBox.isChecked());
recordDataUseUIAction(DataUsageUIAction.DIALOG_CANCEL_CLICKED);
}
}).show();
recordDataUseUIAction(DataUsageUIAction.DIALOG_SHOWN);
}
use of org.chromium.content_public.browser.LoadUrlParams in project AndroidChromium by JackyAndroid.
the class CustomTabActivity method preInflationStartup.
@Override
public void preInflationStartup() {
super.preInflationStartup();
mIntentDataProvider = new CustomTabIntentDataProvider(getIntent(), this);
mSession = mIntentDataProvider.getSession();
supportRequestWindowFeature(Window.FEATURE_ACTION_MODE_OVERLAY);
mHasPrerender = !TextUtils.isEmpty(CustomTabsConnection.getInstance(getApplication()).getPrerenderedUrl(mSession));
if (getSavedInstanceState() == null && CustomTabsConnection.hasWarmUpBeenFinished(getApplication())) {
mMainTab = createMainTab();
loadUrlInTab(mMainTab, new LoadUrlParams(getUrlToLoad()), IntentHandler.getTimestampFromIntent(getIntent()));
mHasCreatedTabEarly = true;
}
}
Aggregations