Search in sources :

Example 1 with NavigationEntry

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

the class NavigationPopup method initialize.

private void initialize() {
    ThreadUtils.assertOnUiThread();
    mInitialized = true;
    mFaviconHelper = new FaviconHelper();
    Set<String> requestedUrls = new HashSet<String>();
    for (int i = 0; i < mHistory.getEntryCount(); i++) {
        NavigationEntry entry = mHistory.getEntryAtIndex(i);
        if (entry.getFavicon() != null)
            continue;
        final String pageUrl = entry.getUrl();
        if (!requestedUrls.contains(pageUrl)) {
            FaviconImageCallback imageCallback = new FaviconImageCallback() {

                @Override
                public void onFaviconAvailable(Bitmap bitmap, String iconUrl) {
                    NavigationPopup.this.onFaviconAvailable(pageUrl, bitmap);
                }
            };
            mFaviconHelper.getLocalFaviconImageForURL(mProfile, pageUrl, mFaviconSize, imageCallback);
            requestedUrls.add(pageUrl);
        }
    }
    FaviconImageCallback historyImageCallback = new FaviconImageCallback() {

        @Override
        public void onFaviconAvailable(Bitmap bitmap, String iconUrl) {
            NavigationPopup.this.onFaviconAvailable(UrlConstants.HISTORY_URL, bitmap);
        }
    };
    mFaviconHelper.getLocalFaviconImageForURL(mProfile, UrlConstants.HISTORY_URL, mFaviconSize, historyImageCallback);
}
Also used : FaviconHelper(org.chromium.chrome.browser.favicon.FaviconHelper) FaviconImageCallback(org.chromium.chrome.browser.favicon.FaviconHelper.FaviconImageCallback) Bitmap(android.graphics.Bitmap) NavigationEntry(org.chromium.content_public.browser.NavigationEntry) HashSet(java.util.HashSet)

Example 2 with NavigationEntry

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

the class ExternalNavigationDelegateImpl method isSerpReferrer.

@Override
public boolean isSerpReferrer(String referrerUrl, Tab tab) {
    if (tab == null || tab.getWebContents() == null) {
        return false;
    }
    NavigationController nController = tab.getWebContents().getNavigationController();
    int index = nController.getLastCommittedEntryIndex();
    if (index == -1)
        return false;
    NavigationEntry entry = nController.getEntryAtIndex(index);
    if (entry == null)
        return false;
    return UrlUtilities.nativeIsGoogleSearchUrl(entry.getUrl());
}
Also used : NavigationController(org.chromium.content_public.browser.NavigationController) NavigationEntry(org.chromium.content_public.browser.NavigationEntry)

Example 3 with NavigationEntry

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

the class NavigationPopup method onItemClick.

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    NavigationEntry entry = (NavigationEntry) parent.getItemAtPosition(position);
    mNavigationController.goToNavigationIndex(entry.getIndex());
    dismiss();
}
Also used : NavigationEntry(org.chromium.content_public.browser.NavigationEntry)

Example 4 with NavigationEntry

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

the class ContextualSearchManager method getContentViewUrl.

/**
     * Gets the current loaded URL in a ContentViewCore.
     *
     * @param searchContentViewCore The given ContentViewCore.
     * @return The current loaded URL.
     */
private String getContentViewUrl(ContentViewCore searchContentViewCore) {
    // First, check the pending navigation entry, because there might be an navigation
    // not yet committed being processed. Otherwise, get the URL from the WebContents.
    NavigationEntry entry = searchContentViewCore.getWebContents().getNavigationController().getPendingEntry();
    String url = entry != null ? entry.getUrl() : searchContentViewCore.getWebContents().getUrl();
    return url;
}
Also used : NavigationEntry(org.chromium.content_public.browser.NavigationEntry)

Aggregations

NavigationEntry (org.chromium.content_public.browser.NavigationEntry)4 Bitmap (android.graphics.Bitmap)1 HashSet (java.util.HashSet)1 FaviconHelper (org.chromium.chrome.browser.favicon.FaviconHelper)1 FaviconImageCallback (org.chromium.chrome.browser.favicon.FaviconHelper.FaviconImageCallback)1 NavigationController (org.chromium.content_public.browser.NavigationController)1