org.chromium.chrome.browser.favicon.FaviconHelper Java Examples
The following examples show how to use
org.chromium.chrome.browser.favicon.FaviconHelper.
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: PaymentRequestImpl.java From delion with Apache License 2.0 | 5 votes |
/** * Builds the PaymentRequest service implementation. * * @param webContents The web contents that have invoked the PaymentRequest API. */ public PaymentRequestImpl(WebContents webContents) { if (webContents == null) return; ContentViewCore contentViewCore = ContentViewCore.fromWebContents(webContents); if (contentViewCore == null) return; WindowAndroid window = contentViewCore.getWindowAndroid(); if (window == null) return; mContext = window.getActivity().get(); if (mContext == null) return; mMerchantName = webContents.getTitle(); // The feature is available only in secure context, so it's OK to not show HTTPS. mOrigin = UrlUtilities.formatUrlForSecurityDisplay(webContents.getVisibleUrl(), false); final FaviconHelper faviconHelper = new FaviconHelper(); float scale = mContext.getResources().getDisplayMetrics().density; faviconHelper.getLocalFaviconImageForURL(Profile.getLastUsedProfile(), webContents.getVisibleUrl(), (int) (FAVICON_SIZE_DP * scale + 0.5f), new FaviconHelper.FaviconImageCallback() { @Override public void onFaviconAvailable(Bitmap bitmap, String iconUrl) { faviconHelper.destroy(); if (bitmap == null) return; if (mUI == null) { mFavicon = bitmap; return; } mUI.setTitleBitmap(bitmap); } }); mApps = PaymentAppFactory.create(webContents); }
Example #2
Source File: ActivityTabTaskDescriptionHelper.java From delion with Apache License 2.0 | 5 votes |
private void refreshSelectedTab() { Tab tab = mTabModelSelector.getCurrentTab(); if (mCurrentTab == tab) return; if (mCurrentTab != null) mCurrentTab.removeObserver(mTabObserver); mCurrentTab = tab; if (mCurrentTab != null) { mCurrentTab.addObserver(mTabObserver); final String currentUrl = mCurrentTab.getUrl(); mFaviconHelper.getLocalFaviconImageForURL( mCurrentTab.getProfile(), mCurrentTab.getUrl(), 0, new FaviconHelper.FaviconImageCallback() { @Override public void onFaviconAvailable(Bitmap image, String iconUrl) { if (mCurrentTab == null || !TextUtils.equals(currentUrl, mCurrentTab.getUrl())) { return; } updateFavicon(image); } }); } updateTaskDescription(); }
Example #3
Source File: WebsitePreference.java From delion with Apache License 2.0 | 5 votes |
@Override protected void onBindView(View view) { super.onBindView(view); TextView usageText = (TextView) view.findViewById(R.id.usage_text); usageText.setVisibility(View.GONE); if (mCategory.showStorageSites()) { long totalUsage = mSite.getTotalUsage(); if (totalUsage > 0) { usageText.setText(Formatter.formatShortFileSize(getContext(), totalUsage)); usageText.setTextSize(TEXT_SIZE_SP); usageText.setVisibility(View.VISIBLE); } } if (!mFaviconFetched) { // Start the favicon fetching. Will respond in onFaviconAvailable. mFaviconHelper = new FaviconHelper(); if (!mFaviconHelper.getLocalFaviconImageForURL( Profile.getLastUsedProfile(), faviconUrl(), mFaviconSizePx, this)) { onFaviconAvailable(null, null); } mFaviconFetched = true; } float density = getContext().getResources().getDisplayMetrics().density; int iconPadding = Math.round(FAVICON_PADDING_DP * density); View iconView = view.findViewById(android.R.id.icon); iconView.setPadding(iconPadding, iconPadding, iconPadding, iconPadding); }
Example #4
Source File: ActivityTabTaskDescriptionHelper.java From AndroidChromium with Apache License 2.0 | 5 votes |
private void refreshSelectedTab() { Tab tab = mTabModelSelector.getCurrentTab(); if (mCurrentTab == tab) return; if (mCurrentTab != null) mCurrentTab.removeObserver(mTabObserver); mCurrentTab = tab; if (mCurrentTab != null) { mCurrentTab.addObserver(mTabObserver); final String currentUrl = mCurrentTab.getUrl(); mFaviconHelper.getLocalFaviconImageForURL( mCurrentTab.getProfile(), mCurrentTab.getUrl(), 0, new FaviconHelper.FaviconImageCallback() { @Override public void onFaviconAvailable(Bitmap image, String iconUrl) { if (mCurrentTab == null || !TextUtils.equals(currentUrl, mCurrentTab.getUrl())) { return; } updateFavicon(image); } }); } updateTaskDescription(); }
Example #5
Source File: WebsitePreference.java From AndroidChromium with Apache License 2.0 | 5 votes |
@Override protected void onBindView(View view) { super.onBindView(view); TextView usageText = (TextView) view.findViewById(R.id.usage_text); usageText.setVisibility(View.GONE); if (mCategory.showStorageSites()) { long totalUsage = mSite.getTotalUsage(); if (totalUsage > 0) { usageText.setText(Formatter.formatShortFileSize(getContext(), totalUsage)); usageText.setTextSize(TEXT_SIZE_SP); usageText.setVisibility(View.VISIBLE); } } if (!mFaviconFetched) { // Start the favicon fetching. Will respond in onFaviconAvailable. mFaviconHelper = new FaviconHelper(); if (!mFaviconHelper.getLocalFaviconImageForURL( Profile.getLastUsedProfile(), faviconUrl(), mFaviconSizePx, this)) { onFaviconAvailable(null, null); } mFaviconFetched = true; } float density = getContext().getResources().getDisplayMetrics().density; int iconPadding = Math.round(FAVICON_PADDING_DP * density); View iconView = view.findViewById(android.R.id.icon); iconView.setPadding(iconPadding, iconPadding, iconPadding, iconPadding); }
Example #6
Source File: ActivityTabTaskDescriptionHelper.java From 365browser with Apache License 2.0 | 5 votes |
private void refreshSelectedTab() { Tab tab = mTabModelSelector.getCurrentTab(); if (mCurrentTab == tab) return; if (mCurrentTab != null) mCurrentTab.removeObserver(mTabObserver); mCurrentTab = tab; if (mCurrentTab != null) { mCurrentTab.addObserver(mTabObserver); final String currentUrl = mCurrentTab.getUrl(); mFaviconHelper.getLocalFaviconImageForURL( mCurrentTab.getProfile(), mCurrentTab.getUrl(), 0, new FaviconHelper.FaviconImageCallback() { @Override public void onFaviconAvailable(Bitmap image, String iconUrl) { if (mCurrentTab == null || !TextUtils.equals(currentUrl, mCurrentTab.getUrl())) { return; } updateFavicon(image); } }); } updateTaskDescription(); }
Example #7
Source File: RecentTabsManager.java From 365browser with Apache License 2.0 | 5 votes |
/** * Create an RecentTabsManager to be used with RecentTabsPage and RecentTabsRowAdapter. * * @param tab The Tab that is showing this recent tabs page. * @param profile Profile that is associated with the current session. * @param context the Android context this manager will work in. */ public RecentTabsManager(Tab tab, Profile profile, Context context) { mProfile = profile; mTab = tab; mForeignSessionHelper = new ForeignSessionHelper(profile); mPrefs = new RecentTabsPagePrefs(profile); mFaviconHelper = new FaviconHelper(); mRecentlyClosedTabManager = sRecentlyClosedTabManagerForTests != null ? sRecentlyClosedTabManagerForTests : new RecentlyClosedBridge(profile); mSignInManager = SigninManager.get(context); mContext = context; mRecentlyClosedTabManager.setTabsUpdatedRunnable(new Runnable() { @Override public void run() { updateRecentlyClosedTabs(); postUpdate(); } }); updateRecentlyClosedTabs(); registerForForeignSessionUpdates(); updateForeignSessions(); mForeignSessionHelper.triggerSessionSync(); registerForSignInAndSyncNotifications(); InvalidationController.get(mContext).onRecentTabsPageOpened(); }
Example #8
Source File: WebsitePreference.java From 365browser with Apache License 2.0 | 5 votes |
@Override protected void onBindView(View view) { super.onBindView(view); TextView usageText = (TextView) view.findViewById(R.id.usage_text); usageText.setVisibility(View.GONE); if (mCategory.showStorageSites()) { long totalUsage = mSite.getTotalUsage(); if (totalUsage > 0) { usageText.setText(Formatter.formatShortFileSize(getContext(), totalUsage)); usageText.setTextSize(TEXT_SIZE_SP); usageText.setVisibility(View.VISIBLE); } } if (!mFaviconFetched) { // Start the favicon fetching. Will respond in onFaviconAvailable. mFaviconHelper = new FaviconHelper(); if (!mFaviconHelper.getLocalFaviconImageForURL( Profile.getLastUsedProfile(), faviconUrl(), mFaviconSizePx, this)) { onFaviconAvailable(null, null); } mFaviconFetched = true; } float density = getContext().getResources().getDisplayMetrics().density; int iconPadding = Math.round(FAVICON_PADDING_DP * density); View iconView = view.findViewById(android.R.id.icon); iconView.setPadding(iconPadding, iconPadding, iconPadding, iconPadding); }
Example #9
Source File: RecentTabsManager.java From delion with Apache License 2.0 | 4 votes |
private static FaviconHelper buildFaviconHelper() { return new FaviconHelper(); }
Example #10
Source File: RecentTabsManager.java From AndroidChromium with Apache License 2.0 | 4 votes |
private static FaviconHelper buildFaviconHelper() { return new FaviconHelper(); }
Example #11
Source File: SuggestionsUiDelegateImpl.java From 365browser with Apache License 2.0 | 4 votes |
/** * Utility method to lazily create the {@link FaviconHelper}, and avoid unnecessary native * calls in tests. */ private FaviconHelper getFaviconHelper() { assert !mIsDestroyed; if (mFaviconHelper == null) mFaviconHelper = new FaviconHelper(); return mFaviconHelper; }