Java Code Examples for org.chromium.chrome.browser.tab.Tab#getOriginalUrl()

The following examples show how to use org.chromium.chrome.browser.tab.Tab#getOriginalUrl() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CustomTabToolbar.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onLongClick(View v) {
    if (v == mCloseButton) {
        return showAccessibilityToast(v, getResources().getString(R.string.close_tab));
    } else if (v == mCustomActionButton) {
        return showAccessibilityToast(v, mCustomActionButton.getContentDescription());
    } else if (v == mTitleUrlContainer) {
        ClipboardManager clipboard = (ClipboardManager) getContext()
                .getSystemService(Context.CLIPBOARD_SERVICE);
        Tab tab = getCurrentTab();
        if (tab == null) return false;
        String url = tab.getOriginalUrl();
        ClipData clip = ClipData.newPlainText("url", url);
        clipboard.setPrimaryClip(clip);
        Toast.makeText(getContext(), R.string.url_copied, Toast.LENGTH_SHORT).show();
        return true;
    }
    return false;
}
 
Example 2
Source File: CustomTabToolbar.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onLongClick(View v) {
    if (v == mCloseButton) {
        return AccessibilityUtil.showAccessibilityToast(
                getContext(), v, getResources().getString(R.string.close_tab));
    } else if (v == mCustomActionButton) {
        return AccessibilityUtil.showAccessibilityToast(
                getContext(), v, mCustomActionButton.getContentDescription());
    } else if (v == mTitleUrlContainer) {
        ClipboardManager clipboard = (ClipboardManager) getContext()
                .getSystemService(Context.CLIPBOARD_SERVICE);
        Tab tab = getCurrentTab();
        if (tab == null) return false;
        String url = tab.getOriginalUrl();
        ClipData clip = ClipData.newPlainText("url", url);
        clipboard.setPrimaryClip(clip);
        Toast.makeText(getContext(), R.string.url_copied, Toast.LENGTH_SHORT).show();
        return true;
    }
    return false;
}
 
Example 3
Source File: OfflinePageUtils.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Reloads specified tab, which should allow to open an online version of the page.
 * @param tab The tab to be reloaded.
 */
public static void reload(Tab tab) {
    // If current page is an offline page, reload it with custom behavior defined in extra
    // header respected.
    LoadUrlParams params =
            new LoadUrlParams(tab.getOriginalUrl(), PageTransition.RELOAD);
    params.setVerbatimHeaders(getOfflinePageHeaderForReload(tab));
    tab.loadUrl(params);
}
 
Example 4
Source File: OfflinePageUtils.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Reloads specified tab, which should allow to open an online version of the page.
 * @param tab The tab to be reloaded.
 */
public static void reload(Tab tab) {
    // If current page is an offline page, reload it with custom behavior defined in extra
    // header respected.
    LoadUrlParams params =
            new LoadUrlParams(tab.getOriginalUrl(), PageTransition.RELOAD);
    params.setVerbatimHeaders(getOfflinePageHeaderForReload(tab));
    tab.loadUrl(params);
}