Java Code Examples for org.chromium.chrome.browser.ntp.NativePageFactory#isNativePageUrl()

The following examples show how to use org.chromium.chrome.browser.ntp.NativePageFactory#isNativePageUrl() . 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: ToolbarManager.java    From delion with Apache License 2.0 6 votes vote down vote up
private void updateCurrentTabDisplayStatus() {
    Tab tab = mToolbarModel.getTab();
    mLocationBar.setUrlToPageUrl();

    updateTabLoadingState(true);

    if (tab == null) {
        finishLoadProgress(false);
        return;
    }

    mLoadProgressSimulator.cancel();

    if (tab.isLoading()) {
        if (NativePageFactory.isNativePageUrl(tab.getUrl(), tab.isIncognito())) {
            finishLoadProgress(false);
        } else {
            startLoadProgress();
            updateLoadProgress(tab.getProgress());
        }
    } else {
        finishLoadProgress(false);
    }
}
 
Example 2
Source File: LocationBarLayout.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
@Override
public void revertChanges() {
    if (!mUrlHasFocus) {
        setUrlToPageUrl();
    } else {
        Tab tab = mToolbarDataProvider.getTab();
        if (NativePageFactory.isNativePageUrl(tab.getUrl(), tab.isIncognito())) {
            setUrlBarText("", null);
        } else {
            setUrlBarText(
                    mToolbarDataProvider.getText(), getCurrentTabUrl());
            selectAll();
        }
        hideSuggestions();
        UiUtils.hideKeyboard(mUrlBar);
    }
}
 
Example 3
Source File: ToolbarManager.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
private void updateCurrentTabDisplayStatus() {
    Tab tab = mToolbarModel.getTab();
    mLocationBar.setUrlToPageUrl();

    updateTabLoadingState(true);

    if (tab == null) {
        finishLoadProgress(false);
        return;
    }

    mLoadProgressSimulator.cancel();

    if (tab.isLoading()) {
        if (NativePageFactory.isNativePageUrl(tab.getUrl(), tab.isIncognito())) {
            finishLoadProgress(false);
        } else {
            startLoadProgress();
            updateLoadProgress(tab.getProgress());
        }
    } else {
        finishLoadProgress(false);
    }
}
 
Example 4
Source File: LocationBarLayout.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@Override
public void revertChanges() {
    if (!mUrlHasFocus) {
        setUrlToPageUrl();
    } else {
        Tab tab = mToolbarDataProvider.getTab();
        if (NativePageFactory.isNativePageUrl(tab.getUrl(), tab.isIncognito())) {
            setUrlBarText("", null);
        } else {
            setUrlBarText(
                    mToolbarDataProvider.getText(), getCurrentTabUrl());
            selectAll();
        }
        hideSuggestions();
        UiUtils.hideKeyboard(mUrlBar);
    }
}
 
Example 5
Source File: ToolbarManager.java    From 365browser with Apache License 2.0 6 votes vote down vote up
private void updateCurrentTabDisplayStatus() {
    Tab tab = mToolbarModel.getTab();
    mLocationBar.setUrlToPageUrl();

    updateTabLoadingState(true);

    if (tab == null) {
        finishLoadProgress(false);
        return;
    }

    mLoadProgressSimulator.cancel();

    if (tab.isLoading()) {
        if (NativePageFactory.isNativePageUrl(tab.getUrl(), tab.isIncognito())) {
            finishLoadProgress(false);
        } else {
            startLoadProgress();
            updateLoadProgress(tab.getProgress());
        }
    } else {
        finishLoadProgress(false);
    }
}
 
Example 6
Source File: LocationBarLayout.java    From delion with Apache License 2.0 5 votes vote down vote up
@Override
public void revertChanges() {
    if (!mUrlHasFocus) {
        setUrlToPageUrl();
    } else {
        Tab tab = mToolbarDataProvider.getTab();
        if (NativePageFactory.isNativePageUrl(tab.getUrl(), tab.isIncognito())) {
            mUrlBar.setUrl("", null);
        } else {
            mUrlBar.setUrl(
                    mToolbarDataProvider.getText(), getOnlineUrlFromTab());
        }
    }
}
 
Example 7
Source File: ToolbarManager.java    From delion with Apache License 2.0 5 votes vote down vote up
private void updateLoadProgress(int progress) {
    // If it's a native page, progress bar is already hidden or being hidden, so don't update
    // the value.
    // TODO(kkimlabs): Investigate back/forward navigation with native page & web content and
    //                 figure out the correct progress bar presentation.
    Tab tab = mToolbarModel.getTab();
    if (NativePageFactory.isNativePageUrl(tab.getUrl(), tab.isIncognito())) return;

    progress = Math.max(progress, MINIMUM_LOAD_PROGRESS);
    mToolbar.setLoadProgress(progress / 100f);
    if (progress == 100) finishLoadProgress(true);
}
 
Example 8
Source File: ToolbarManager.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
private void updateLoadProgress(int progress) {
    // If it's a native page, progress bar is already hidden or being hidden, so don't update
    // the value.
    // TODO(kkimlabs): Investigate back/forward navigation with native page & web content and
    //                 figure out the correct progress bar presentation.
    Tab tab = mToolbarModel.getTab();
    if (NativePageFactory.isNativePageUrl(tab.getUrl(), tab.isIncognito())) return;

    progress = Math.max(progress, MINIMUM_LOAD_PROGRESS);
    mToolbar.setLoadProgress(progress / 100f);
    if (progress == 100) finishLoadProgress(true);
}
 
Example 9
Source File: ToolbarManager.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private void updateLoadProgress(int progress) {
    // If it's a native page, progress bar is already hidden or being hidden, so don't update
    // the value.
    // TODO(kkimlabs): Investigate back/forward navigation with native page & web content and
    //                 figure out the correct progress bar presentation.
    Tab tab = mToolbarModel.getTab();
    if (tab == null || NativePageFactory.isNativePageUrl(tab.getUrl(), tab.isIncognito())) {
        return;
    }

    progress = Math.max(progress, MINIMUM_LOAD_PROGRESS);
    mToolbar.setLoadProgress(progress / 100f);
    if (progress == 100) finishLoadProgress(true);
}
 
Example 10
Source File: LocationBarLayout.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * Sets the displayed URL to be the URL of the page currently showing.
 *
 * <p>The URL is converted to the most user friendly format (removing HTTP:// for example).
 *
 * <p>If the current tab is null, the URL text will be cleared.
 */
@Override
public void setUrlToPageUrl() {
    String url = getOnlineUrlFromTab();

    // If the URL is currently focused, do not replace the text they have entered with the URL.
    // Once they stop editing the URL, the current tab's URL will automatically be filled in.
    if (mUrlBar.hasFocus()) {
        if (mUrlFocusedWithoutAnimations && !NewTabPage.isNTPUrl(url)) {
            // If we did not run the focus animations, then the user has not typed any text.
            // So, clear the focus and accept whatever URL the page is currently attempting to
            // display.
            setUrlBarFocus(false);
        } else {
            return;
        }
    }

    if (getCurrentTab() == null) {
        setUrlBarText("", null);
        return;
    }

    // Profile may be null if switching to a tab that has not yet been initialized.
    Profile profile = getCurrentTab().getProfile();
    if (profile != null) mOmniboxPrerender.clear(profile);

    mOriginalUrl = url;

    if (NativePageFactory.isNativePageUrl(url, getCurrentTab().isIncognito())
            || NewTabPage.isNTPUrl(url)) {
        // Don't show anything for Chrome URLs.
        setUrlBarText(null, "");
        return;
    }

    if (setUrlBarText(url, mToolbarDataProvider.getText())) {
        mUrlBar.deEmphasizeUrl();
        emphasizeUrl();
    }
    updateCustomSelectionActionModeCallback();
}
 
Example 11
Source File: Tab.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * @return Whether the tab is ready to display or it should be faded in as it loads.
 */
public boolean shouldStall() {
    return (isFrozen() || needsReload())
            && !NativePageFactory.isNativePageUrl(getUrl(), isIncognito());
}
 
Example 12
Source File: LocationBarLayout.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * Sets the displayed URL to be the URL of the page currently showing.
 *
 * <p>The URL is converted to the most user friendly format (removing HTTP:// for example).
 *
 * <p>If the current tab is null, the URL text will be cleared.
 */
@Override
public void setUrlToPageUrl() {
    String url = getCurrentTabUrl();

    // If the URL is currently focused, do not replace the text they have entered with the URL.
    // Once they stop editing the URL, the current tab's URL will automatically be filled in.
    if (mUrlBar.hasFocus()) {
        if (mUrlFocusedWithoutAnimations && !NewTabPage.isNTPUrl(url)) {
            // If we did not run the focus animations, then the user has not typed any text.
            // So, clear the focus and accept whatever URL the page is currently attempting to
            // display.
            setUrlBarFocus(false);
        } else {
            return;
        }
    }

    if (getCurrentTab() == null) {
        setUrlBarText("", null);
        return;
    }

    // Profile may be null if switching to a tab that has not yet been initialized.
    Profile profile = getCurrentTab().getProfile();
    if (profile != null) mOmniboxPrerender.clear(profile);

    mOriginalUrl = url;

    if (NativePageFactory.isNativePageUrl(url, getCurrentTab().isIncognito())
            || NewTabPage.isNTPUrl(url)) {
        // Don't show anything for Chrome URLs.
        setUrlBarText(null, "");
        return;
    }

    if (setUrlBarText(url, mToolbarDataProvider.getText())) {
        mUrlBar.deEmphasizeUrl();
        emphasizeUrl();
    }
    updateCustomSelectionActionModeCallback();
}
 
Example 13
Source File: Tab.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * @return Whether the tab is ready to display or it should be faded in as it loads.
 */
public boolean shouldStall() {
    return (isFrozen() || needsReload())
            && !NativePageFactory.isNativePageUrl(getUrl(), isIncognito());
}
 
Example 14
Source File: LocationBarLayout.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * Sets the displayed URL to be the URL of the page currently showing.
 *
 * <p>The URL is converted to the most user friendly format (removing HTTP:// for example).
 *
 * <p>If the current tab is null, the URL text will be cleared.
 */
@Override
public void setUrlToPageUrl() {
    String url = getCurrentTabUrl();

    // If the URL is currently focused, do not replace the text they have entered with the URL.
    // Once they stop editing the URL, the current tab's URL will automatically be filled in.
    if (mUrlBar.hasFocus()) {
        if ((mUrlFocusedWithoutAnimations && !NewTabPage.isNTPUrl(url))
                || (mBottomSheet != null && mBottomSheet.isShowingNewTab())) {
            // If we did not run the focus animations, then the user has not typed any text.
            // So, clear the focus and accept whatever URL the page is currently attempting to
            // display. If the NTP is showing, the current page's URL should not be displayed.
            setUrlBarFocus(false);
        } else {
            return;
        }
    }

    if (getCurrentTab() == null) {
        setUrlBarText("", null);
        return;
    }

    // Profile may be null if switching to a tab that has not yet been initialized.
    Profile profile = getCurrentTab().getProfile();
    if (profile != null) mOmniboxPrerender.clear(profile);

    mOriginalUrl = url;

    if (NativePageFactory.isNativePageUrl(url, getCurrentTab().isIncognito())
            || NewTabPage.isNTPUrl(url)) {
        // Don't show anything for Chrome URLs.
        setUrlBarText(null, "");
        return;
    }

    if (setUrlBarText(url, mToolbarDataProvider.getText())) {
        mUrlBar.deEmphasizeUrl();
        emphasizeUrl();
    }
}
 
Example 15
Source File: Tab.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * @return Whether the tab is ready to display or it should be faded in as it loads.
 */
public boolean shouldStall() {
    return (isFrozen() || needsReload())
            && !NativePageFactory.isNativePageUrl(getUrl(), isIncognito());
}