Bug 1054268 - Show search icon in about:home (r=margaret)

This commit is contained in:
Lucas Rocha 2014-08-15 18:23:20 +01:00
Родитель 01cf8d0857
Коммит 5f9b815b9f
3 изменённых файлов: 14 добавлений и 4 удалений

Просмотреть файл

@ -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);
}
/**