mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-16 13:56:29 +00:00
Bug 1054268 - Show search icon in about:home (r=margaret)
This commit is contained in:
parent
a3bb1a6f7c
commit
0cddedc732
@ -55,8 +55,6 @@ public class AboutPages {
|
||||
}
|
||||
|
||||
private static final String[] DEFAULT_ICON_PAGES = new String[] {
|
||||
HOME,
|
||||
|
||||
ADDONS,
|
||||
CONFIG,
|
||||
DOWNLOADS,
|
||||
@ -72,12 +70,17 @@ public class AboutPages {
|
||||
return DEFAULT_ICON_PAGES;
|
||||
}
|
||||
|
||||
public static boolean isDefaultIconPage(final String url) {
|
||||
public static boolean isBuiltinIconPage(final String url) {
|
||||
if (url == null ||
|
||||
!url.startsWith("about:")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// about:home uses a separate search built-in icon.
|
||||
if (isAboutHome(url)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO: it'd be quicker to not compare the "about:" part every time.
|
||||
for (int i = 0; i < DEFAULT_ICON_PAGES.length; ++i) {
|
||||
if (DEFAULT_ICON_PAGES[i].equals(url)) {
|
||||
|
@ -831,7 +831,7 @@ public class Tabs implements GeckoEventListener {
|
||||
}
|
||||
|
||||
// TODO: surely we could just fetch *any* cached icon?
|
||||
if (AboutPages.isDefaultIconPage(url)) {
|
||||
if (AboutPages.isBuiltinIconPage(url)) {
|
||||
Log.d(LOGTAG, "Setting about: tab favicon inline.");
|
||||
added.updateFavicon(getAboutPageFavicon(url));
|
||||
}
|
||||
|
@ -40,6 +40,9 @@ public class Favicons {
|
||||
// A magic URL representing the app's own favicon, used for about: pages.
|
||||
private static final String BUILT_IN_FAVICON_URL = "about:favicon";
|
||||
|
||||
// A magic URL representing the app's search favicon, used for about:home.
|
||||
private static final String BUILT_IN_SEARCH_URL = "about:search";
|
||||
|
||||
// Size of the favicon bitmap cache, in bytes (Counting payload only).
|
||||
public static final int FAVICON_CACHE_SIZE_BYTES = 512 * 1024;
|
||||
|
||||
@ -407,6 +410,10 @@ public class Favicons {
|
||||
loadBrandingBitmap(context, "favicon32.png"));
|
||||
|
||||
putFaviconsInMemCache(BUILT_IN_FAVICON_URL, toInsert.iterator(), true);
|
||||
|
||||
pageURLMappings.putWithoutEviction(AboutPages.HOME, BUILT_IN_SEARCH_URL);
|
||||
List<Bitmap> searchIcons = Arrays.asList(BitmapFactory.decodeResource(res, R.drawable.ab_search));
|
||||
putFaviconsInMemCache(BUILT_IN_SEARCH_URL, searchIcons.iterator(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user