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

The following examples show how to use org.chromium.chrome.browser.tab.Tab#getProfile() . 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: UrlBar.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Emphasize components of the URL for readability.
 */
public void emphasizeUrl() {
    Editable url = getText();
    if (OmniboxUrlEmphasizer.hasEmphasisSpans(url) || hasFocus()) {
        return;
    }

    if (url.length() < 1) {
        return;
    }

    Tab currentTab = mUrlBarDelegate.getCurrentTab();
    if (currentTab == null || currentTab.getProfile() == null) return;

    boolean isInternalPage = false;
    try {
        String tabUrl = currentTab.getUrl();
        isInternalPage = UrlUtilities.isInternalScheme(new URI(tabUrl));
    } catch (URISyntaxException e) {
        // Ignore as this only is for applying color
    }

    OmniboxUrlEmphasizer.emphasizeUrl(url, getResources(), currentTab.getProfile(),
            currentTab.getSecurityLevel(), isInternalPage,
            mUseDarkColors, mUrlBarDelegate.shouldEmphasizeHttpsScheme());
}
 
Example 2
Source File: UrlBar.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Emphasize the TLD and second domain of the URL.
 */
public void emphasizeUrl() {
    Editable url = getText();
    if (OmniboxUrlEmphasizer.hasEmphasisSpans(url) || hasFocus()) {
        return;
    }

    if (url.length() < 1) {
        return;
    }

    // We retrieve the domain and registry from the full URL (the url bar shows a simplified
    // version of the URL).
    Tab currentTab = mUrlBarDelegate.getCurrentTab();
    if (currentTab == null || currentTab.getProfile() == null) return;

    boolean isInternalPage = false;
    try {
        String tabUrl = currentTab.getUrl();
        isInternalPage = UrlUtilities.isInternalScheme(new URI(tabUrl));
    } catch (URISyntaxException e) {
        // Ignore as this only is for applying color
    }

    OmniboxUrlEmphasizer.emphasizeUrl(url, getResources(), currentTab.getProfile(),
            currentTab.getSecurityLevel(), isInternalPage,
            mUseDarkColors, mUrlBarDelegate.shouldEmphasizeHttpsScheme());
}
 
Example 3
Source File: ToolbarTablet.java    From delion with Apache License 2.0 5 votes vote down vote up
private void displayNavigationPopup(boolean isForward, View anchorView) {
    Tab tab = getToolbarDataProvider().getTab();
    if (tab == null || tab.getWebContents() == null) return;
    mNavigationPopup = new NavigationPopup(tab.getProfile(), getContext(),
            tab.getWebContents().getNavigationController(), isForward);

    mNavigationPopup.setAnchorView(anchorView);

    int menuWidth = getResources().getDimensionPixelSize(R.dimen.menu_width);
    mNavigationPopup.setWidth(menuWidth);

    if (mNavigationPopup.shouldBeShown()) mNavigationPopup.show();
}
 
Example 4
Source File: DownloadUtils.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Trigger the download of an Offline Page.
 * @param context Context to pull resources from.
 */
public static void downloadOfflinePage(Context context, Tab tab) {
    final OfflinePageDownloadBridge bridge = new OfflinePageDownloadBridge(tab.getProfile());
    bridge.startDownload(tab);
    bridge.destroy();
    DownloadUtils.recordDownloadPageMetrics(tab);
}
 
Example 5
Source File: UrlBar.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Emphasize the TLD and second domain of the URL.
 */
public void emphasizeUrl() {
    Editable url = getText();
    if (OmniboxUrlEmphasizer.hasEmphasisSpans(url) || hasFocus()) {
        return;
    }

    if (url.length() < 1) {
        return;
    }

    // We retrieve the domain and registry from the full URL (the url bar shows a simplified
    // version of the URL).
    Tab currentTab = mUrlBarDelegate.getCurrentTab();
    if (currentTab == null || currentTab.getProfile() == null) return;

    boolean isInternalPage = false;
    try {
        String tabUrl = currentTab.getUrl();
        isInternalPage = UrlUtilities.isInternalScheme(new URI(tabUrl));
    } catch (URISyntaxException e) {
        // Ignore as this only is for applying color
    }

    OmniboxUrlEmphasizer.emphasizeUrl(url, getResources(), currentTab.getProfile(),
            currentTab.getSecurityLevel(), isInternalPage,
            mUseDarkColors, mUrlBarDelegate.shouldEmphasizeHttpsScheme());
}
 
Example 6
Source File: ToolbarTablet.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
private void displayNavigationPopup(boolean isForward, View anchorView) {
    Tab tab = getToolbarDataProvider().getTab();
    if (tab == null || tab.getWebContents() == null) return;
    mNavigationPopup = new NavigationPopup(tab.getProfile(), getContext(),
            tab.getWebContents().getNavigationController(), isForward);

    mNavigationPopup.setAnchorView(anchorView);

    int menuWidth = getResources().getDimensionPixelSize(R.dimen.menu_width);
    mNavigationPopup.setWidth(menuWidth);

    if (mNavigationPopup.shouldBeShown()) mNavigationPopup.show();
}
 
Example 7
Source File: ToolbarTablet.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private void displayNavigationPopup(boolean isForward, View anchorView) {
    Tab tab = getToolbarDataProvider().getTab();
    if (tab == null || tab.getWebContents() == null) return;
    mNavigationPopup = new NavigationPopup(tab.getProfile(), getContext(),
            tab.getWebContents().getNavigationController(), isForward);

    mNavigationPopup.setAnchorView(anchorView);

    int menuWidth = getResources().getDimensionPixelSize(R.dimen.menu_width);
    mNavigationPopup.setWidth(menuWidth);

    if (mNavigationPopup.shouldBeShown()) mNavigationPopup.show();
}
 
Example 8
Source File: NativePageFactory.java    From delion with Apache License 2.0 4 votes vote down vote up
protected NativePage buildRecentTabsPage(Activity activity, Tab tab) {
    RecentTabsManager recentTabsManager =
            new RecentTabsManager(tab, tab.getProfile(), activity);
    return new RecentTabsPage(activity, recentTabsManager);
}
 
Example 9
Source File: NativePageFactory.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
protected NativePage buildRecentTabsPage(Activity activity, Tab tab) {
    RecentTabsManager recentTabsManager =
            new RecentTabsManager(tab, tab.getProfile(), activity);
    return new RecentTabsPage(activity, recentTabsManager);
}
 
Example 10
Source File: NativePageFactory.java    From 365browser with Apache License 2.0 4 votes vote down vote up
protected NativePage buildRecentTabsPage(ChromeActivity activity, Tab tab) {
    RecentTabsManager recentTabsManager =
            new RecentTabsManager(tab, tab.getProfile(), activity);
    return new RecentTabsPage(activity, recentTabsManager);
}
 
Example 11
Source File: LogoDelegateImpl.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * Construct a new {@link LogoDelegateImpl}.
 * @param tab The tab showing the logo view.
 * @param logoView The view that shows the search provider logo.
 */
public LogoDelegateImpl(Tab tab, LogoView logoView) {
    mTab = tab;
    mLogoView = logoView;
    mLogoBridge = new LogoBridge(tab.getProfile());
}