Search in sources :

Example 31 with LoadUrlParams

use of org.chromium.content_public.browser.LoadUrlParams in project AndroidChromium by JackyAndroid.

the class TabContextMenuItemDelegate method onOpenInOtherWindow.

@Override
public void onOpenInOtherWindow(String url, Referrer referrer) {
    TabDelegate tabDelegate = new TabDelegate(mTab.isIncognito());
    LoadUrlParams loadUrlParams = new LoadUrlParams(url);
    loadUrlParams.setReferrer(referrer);
    tabDelegate.createTabInOtherWindow(loadUrlParams, mTab.getActivity(), mTab.getParentId());
}
Also used : TabDelegate(org.chromium.chrome.browser.tabmodel.document.TabDelegate) LoadUrlParams(org.chromium.content_public.browser.LoadUrlParams)

Example 32 with LoadUrlParams

use of org.chromium.content_public.browser.LoadUrlParams in project AndroidChromium by JackyAndroid.

the class ToolbarManager method openHomepage.

@Override
public void openHomepage() {
    RecordUserAction.record("Home");
    Tab currentTab = mToolbarModel.getTab();
    if (currentTab == null)
        return;
    Context context = mToolbar.getContext();
    String homePageUrl = HomepageManager.getHomepageUri(context);
    if (TextUtils.isEmpty(homePageUrl)) {
        homePageUrl = UrlConstants.NTP_URL;
    }
    currentTab.loadUrl(new LoadUrlParams(homePageUrl, PageTransition.HOME_PAGE));
}
Also used : Context(android.content.Context) Tab(org.chromium.chrome.browser.tab.Tab) LoadUrlParams(org.chromium.content_public.browser.LoadUrlParams)

Example 33 with LoadUrlParams

use of org.chromium.content_public.browser.LoadUrlParams in project AndroidChromium by JackyAndroid.

the class FullScreenActivity method preInflationStartup.

@Override
public void preInflationStartup() {
    super.preInflationStartup();
    setTabCreators(createTabDelegate(false), createTabDelegate(true));
    setTabModelSelector(new SingleTabModelSelector(this, false, false) {

        @Override
        public Tab openNewTab(LoadUrlParams loadUrlParams, TabLaunchType type, Tab parent, boolean incognito) {
            getTabCreator(incognito).createNewTab(loadUrlParams, type, parent);
            return null;
        }
    });
}
Also used : Tab(org.chromium.chrome.browser.tab.Tab) LoadUrlParams(org.chromium.content_public.browser.LoadUrlParams) TabLaunchType(org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType) SingleTabModelSelector(org.chromium.chrome.browser.tabmodel.SingleTabModelSelector)

Example 34 with LoadUrlParams

use of org.chromium.content_public.browser.LoadUrlParams in project AndroidChromium by JackyAndroid.

the class WebApkActivity method onNewIntent.

@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    // We could bring a WebAPK hosted WebappActivity to foreground and navigate it to a
    // different URL. For example, WebAPK "foo" is launched and navigates to
    // "www.foo.com/foo". In Chrome, user clicks a link "www.foo.com/bar" in Google search
    // results. After clicking the link, WebAPK "foo" is brought to foreground, and
    // loads the page of "www.foo.com/bar" at the same time.
    // The extra {@link ShortcutHelper.EXTRA_URL} provides the URL that the WebAPK will
    // navigate to.
    String overrideUrl = intent.getStringExtra(ShortcutHelper.EXTRA_URL);
    if (overrideUrl != null && isInitialized() && !overrideUrl.equals(getActivityTab().getUrl())) {
        getActivityTab().loadUrl(new LoadUrlParams(overrideUrl, PageTransition.AUTO_TOPLEVEL));
    }
}
Also used : LoadUrlParams(org.chromium.content_public.browser.LoadUrlParams)

Example 35 with LoadUrlParams

use of org.chromium.content_public.browser.LoadUrlParams in project AndroidChromium by JackyAndroid.

the class WebappActivity method initializeUI.

private void initializeUI(Bundle savedInstanceState) {
    // We do not load URL when restoring from saved instance states.
    if (savedInstanceState == null && mWebappInfo.isInitialized()) {
        if (TextUtils.isEmpty(getActivityTab().getUrl())) {
            getActivityTab().loadUrl(new LoadUrlParams(mWebappInfo.uri().toString(), PageTransition.AUTO_TOPLEVEL));
        }
    } else {
        if (NetworkChangeNotifier.isOnline())
            getActivityTab().reloadIgnoringCache();
    }
    getActivityTab().addObserver(createTabObserver());
    getActivityTab().getTabWebContentsDelegateAndroid().setDisplayMode(WebDisplayMode.Standalone);
// TODO(dominickn): send the web app into fullscreen if mDisplayMode is
// WebDisplayMode.Fullscreen. See crbug.com/581522
}
Also used : LoadUrlParams(org.chromium.content_public.browser.LoadUrlParams)

Aggregations

LoadUrlParams (org.chromium.content_public.browser.LoadUrlParams)35 Tab (org.chromium.chrome.browser.tab.Tab)9 Intent (android.content.Intent)6 Referrer (org.chromium.content_public.common.Referrer)5 TabDelegate (org.chromium.chrome.browser.tabmodel.document.TabDelegate)4 PendingIntent (android.app.PendingIntent)3 CustomTabsIntent (android.support.customtabs.CustomTabsIntent)3 Context (android.content.Context)2 CustomTabsSessionToken (android.support.customtabs.CustomTabsSessionToken)2 AlertDialog (android.support.v7.app.AlertDialog)2 View (android.view.View)2 CalledByNative (org.chromium.base.annotations.CalledByNative)2 TabLaunchType (org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType)2 AsyncTabCreationParams (org.chromium.chrome.browser.tabmodel.document.AsyncTabCreationParams)2 DialogInterface (android.content.DialogInterface)1 OnClickListener (android.content.DialogInterface.OnClickListener)1 SharedPreferences (android.content.SharedPreferences)1 Bitmap (android.graphics.Bitmap)1 Uri (android.net.Uri)1 SparseIntArray (android.util.SparseIntArray)1