org.chromium.chrome.browser.favicon.FaviconHelper.FaviconImageCallback Java Examples

The following examples show how to use org.chromium.chrome.browser.favicon.FaviconHelper.FaviconImageCallback. 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: SnippetArticleViewHolder.java    From 365browser with Apache License 2.0 6 votes vote down vote up
private void fetchFaviconFromLocalCache(final URI snippetUri, final boolean fallbackToService,
        final long faviconFetchStartTimeMs) {
    mUiDelegate.getLocalFaviconImageForURL(
            getSnippetDomain(snippetUri), mPublisherFaviconSizePx, new FaviconImageCallback() {
                @Override
                public void onFaviconAvailable(Bitmap image, String iconUrl) {
                    if (image != null) {
                        setFaviconOnView(image);
                        recordFaviconFetchResult(fallbackToService
                                        ? FaviconFetchResult.SUCCESS_CACHED
                                        : FaviconFetchResult.SUCCESS_FETCHED,
                                faviconFetchStartTimeMs);
                    } else if (fallbackToService) {
                        if (!fetchFaviconFromService(snippetUri, faviconFetchStartTimeMs)) {
                            recordFaviconFetchResult(
                                    FaviconFetchResult.FAILURE, faviconFetchStartTimeMs);
                        }
                    }
                    // Else do nothing, we already have the placeholder set.
                }
            });
}
 
Example #2
Source File: SnippetArticleViewHolder.java    From delion with Apache License 2.0 5 votes vote down vote up
private void fetchFaviconFromLocalCache(final URI snippetUri, final boolean fallbackToService) {
    mNewTabPageManager.getLocalFaviconImageForURL(
            getSnippetDomain(snippetUri), mPublisherFaviconSizePx, new FaviconImageCallback() {
                @Override
                public void onFaviconAvailable(Bitmap image, String iconUrl) {
                    if (image == null && fallbackToService) {
                        fetchFaviconFromService(snippetUri);
                        return;
                    }
                    setFaviconOnView(image);
                }
            });
}
 
Example #3
Source File: SnippetArticleViewHolder.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
private void fetchFaviconFromLocalCache(final URI snippetUri, final boolean fallbackToService) {
    mNewTabPageManager.getLocalFaviconImageForURL(
            getSnippetDomain(snippetUri), mPublisherFaviconSizePx, new FaviconImageCallback() {
                @Override
                public void onFaviconAvailable(Bitmap image, String iconUrl) {
                    if (image == null && fallbackToService) {
                        fetchFaviconFromService(snippetUri);
                        return;
                    }
                    setFaviconOnView(image);
                }
            });
}
 
Example #4
Source File: SuggestionsUiDelegateImpl.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
public void getLocalFaviconImageForURL(
        String url, int size, FaviconImageCallback faviconCallback) {
    if (mIsDestroyed) return;
    getFaviconHelper().getLocalFaviconImageForURL(mProfile, url, size, faviconCallback);
}
 
Example #5
Source File: RecentTabsManager.java    From delion with Apache License 2.0 2 votes vote down vote up
/**
 * Fetches a favicon for snapshot document url which is returned via callback.
 *
 * @param url The url to fetch a favicon for.
 * @param size the desired favicon size.
 * @param faviconCallback the callback to be invoked when the favicon is available.
 *
 * @return may return false if we could not fetch the favicon.
 */
public boolean getLocalFaviconForUrl(String url, int size,
        FaviconImageCallback faviconCallback) {
    return mFaviconHelper.getLocalFaviconImageForURL(mProfile, url, size, faviconCallback);
}
 
Example #6
Source File: NewTabPageView.java    From delion with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the favicon image for a given URL.
 * @param url The URL of the site whose favicon is being requested.
 * @param size The desired size of the favicon in pixels.
 * @param faviconCallback The callback to be notified when the favicon is available.
 */
void getLocalFaviconImageForURL(
        String url, int size, FaviconImageCallback faviconCallback);
 
Example #7
Source File: RecentTabsManager.java    From AndroidChromium with Apache License 2.0 2 votes vote down vote up
/**
 * Fetches a favicon for snapshot document url which is returned via callback.
 *
 * @param url The url to fetch a favicon for.
 * @param size the desired favicon size.
 * @param faviconCallback the callback to be invoked when the favicon is available.
 *
 * @return may return false if we could not fetch the favicon.
 */
public boolean getLocalFaviconForUrl(String url, int size,
        FaviconImageCallback faviconCallback) {
    return mFaviconHelper.getLocalFaviconImageForURL(mProfile, url, size, faviconCallback);
}
 
Example #8
Source File: NewTabPageView.java    From AndroidChromium with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the favicon image for a given URL.
 * @param url The URL of the site whose favicon is being requested.
 * @param size The desired size of the favicon in pixels.
 * @param faviconCallback The callback to be notified when the favicon is available.
 */
void getLocalFaviconImageForURL(
        String url, int size, FaviconImageCallback faviconCallback);
 
Example #9
Source File: RecentTabsManager.java    From 365browser with Apache License 2.0 2 votes vote down vote up
/**
 * Fetches a favicon for snapshot document url which is returned via callback.
 *
 * @param url The url to fetch a favicon for.
 * @param size the desired favicon size.
 * @param faviconCallback the callback to be invoked when the favicon is available.
 *
 * @return may return false if we could not fetch the favicon.
 */
public boolean getLocalFaviconForUrl(String url, int size,
        FaviconImageCallback faviconCallback) {
    return mFaviconHelper.getLocalFaviconImageForURL(mProfile, url, size, faviconCallback);
}
 
Example #10
Source File: SuggestionsUiDelegate.java    From 365browser with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the favicon image for a given URL.
 * @param url The URL of the site whose favicon is being requested.
 * @param size The desired size of the favicon in pixels.
 * @param faviconCallback The callback to be notified when the favicon is available.
 */
void getLocalFaviconImageForURL(String url, int size, FaviconImageCallback faviconCallback);