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);
}
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());
}
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();
}
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;
}
Aggregations