Backout 042b44652822 (bug 715258) for breaking robocop & others on a CLOSED TREE
@ -573,6 +573,8 @@ RES_DRAWABLE_BASE = \
|
||||
res/drawable/validation_arrow.png \
|
||||
res/drawable/validation_arrow_inverted.png \
|
||||
res/drawable/validation_bg.9.png \
|
||||
res/drawable/bookmarkdefaults_favicon_support.png \
|
||||
res/drawable/bookmarkdefaults_favicon_addons.png \
|
||||
res/drawable/handle_end.png \
|
||||
res/drawable/handle_middle.png \
|
||||
res/drawable/handle_start.png \
|
||||
|
@ -41,7 +41,6 @@ import org.mozilla.gecko.db.DBUtils;
|
||||
import org.mozilla.gecko.ProfileMigrator;
|
||||
import org.mozilla.gecko.sync.Utils;
|
||||
import org.mozilla.gecko.util.GeckoBackgroundThread;
|
||||
import org.mozilla.gecko.util.GeckoJarReader;
|
||||
|
||||
import android.app.SearchManager;
|
||||
import android.content.ContentProvider;
|
||||
@ -61,7 +60,6 @@ import android.database.sqlite.SQLiteOpenHelper;
|
||||
import android.database.sqlite.SQLiteQueryBuilder;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
@ -1020,72 +1018,31 @@ public class BrowserProvider extends ContentProvider {
|
||||
}
|
||||
|
||||
private void setDefaultFavicon(SQLiteDatabase db, String name, String url) {
|
||||
ByteArrayOutputStream stream = getDefaultFaviconFromPath(db, name, url);
|
||||
if (stream == null) {
|
||||
stream = getDefaultFaviconFromDrawable(db, name, url);
|
||||
}
|
||||
if (stream != null) {
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(Favicons.DATA, stream.toByteArray());
|
||||
values.put(Favicons.PAGE_URL, url);
|
||||
insertFavicon(db, values);
|
||||
}
|
||||
}
|
||||
|
||||
private ByteArrayOutputStream getDefaultFaviconFromPath(SQLiteDatabase db, String name, String url) {
|
||||
ByteArrayOutputStream stream = null;
|
||||
Class stringClass = R.string.class;
|
||||
try {
|
||||
// Look for a drawable with the id R.drawable.bookmarkdefaults_favicon_*
|
||||
Field faviconField = stringClass.getField(name.replace("_title_", "_favicon_"));
|
||||
if (faviconField == null)
|
||||
return null;
|
||||
int faviconId = faviconField.getInt(null);
|
||||
String path = mContext.getString(faviconId);
|
||||
|
||||
String apkPath = mContext.getPackageResourcePath();
|
||||
File apkFile = new File(apkPath);
|
||||
BitmapDrawable bitmapDrawable = GeckoJarReader.getBitmapDrawable(mContext.getResources(),
|
||||
"jar:jar:" + apkFile.toURI() + "!/omni.ja!/" + path);
|
||||
if (bitmapDrawable == null) {
|
||||
return null;
|
||||
}
|
||||
Bitmap bitmap = bitmapDrawable.getBitmap();
|
||||
if (bitmap == null) {
|
||||
return null;
|
||||
}
|
||||
stream = new ByteArrayOutputStream();
|
||||
bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
|
||||
} catch (java.lang.IllegalAccessException ex) {
|
||||
Log.e(LOGTAG, "[Path] Can't create favicon " + name, ex);
|
||||
} catch (java.lang.NoSuchFieldException ex) {
|
||||
// if there is no such field, create the bookmark without a favicon
|
||||
Log.d(LOGTAG, "[Path] Can't create favicon " + name);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
private ByteArrayOutputStream getDefaultFaviconFromDrawable(SQLiteDatabase db, String name, String url) {
|
||||
Class<?> drawablesClass = R.drawable.class;
|
||||
ByteArrayOutputStream stream = null;
|
||||
try {
|
||||
// Look for a drawable with the id R.drawable.bookmarkdefaults_favicon_*
|
||||
Field faviconField = drawablesClass.getField(name.replace("_title_", "_favicon_"));
|
||||
if (faviconField == null)
|
||||
return null;
|
||||
return;
|
||||
|
||||
int faviconId = faviconField.getInt(null);
|
||||
Bitmap bitmap = BitmapFactory.decodeResource(mContext.getResources(), faviconId);
|
||||
stream = new ByteArrayOutputStream();
|
||||
bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
|
||||
} catch (java.lang.IllegalAccessException ex) {
|
||||
Log.e(LOGTAG, "[Drawable] Can't create favicon " + name, ex);
|
||||
Log.e(LOGTAG, "Can't create favicon " + name, ex);
|
||||
} catch (java.lang.NoSuchFieldException ex) {
|
||||
// if there is no such field, create the bookmark without a favicon
|
||||
Log.d(LOGTAG, "[Drawable] Can't create favicon " + name);
|
||||
Log.d(LOGTAG, "Can't create favicon " + name);
|
||||
}
|
||||
|
||||
return stream;
|
||||
if (stream != null) {
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(Favicons.DATA, stream.toByteArray());
|
||||
values.put(Favicons.PAGE_URL, url);
|
||||
insertFavicon(db, values);
|
||||
}
|
||||
}
|
||||
|
||||
private void createOrUpdateAllSpecialFolders(SQLiteDatabase db) {
|
||||
|
@ -209,14 +209,12 @@
|
||||
profile/bookmarks.inc. Don't expose the URLs to L10N. -->
|
||||
<string name="bookmarkdefaults_title_aboutfirefox">@bookmarks_aboutBrowser@</string>
|
||||
<string name="bookmarkdefaults_url_aboutfirefox">about:firefox</string>
|
||||
<string name="bookmarkdefaults_favicon_aboutfirefox">chrome/chrome/content/branding/favicon64.png</string>
|
||||
|
||||
<string name="bookmarkdefaults_title_addons">@bookmarks_addons@</string>
|
||||
<string name="bookmarkdefaults_url_addons">https://addons.mozilla.org/@AB_CD@/android/</string>
|
||||
|
||||
<string name="bookmarkdefaults_title_support">@bookmarks_support@</string>
|
||||
<string name="bookmarkdefaults_url_support">http://support.mozilla.org/@AB_CD@/mobile</string>
|
||||
<string name="bookmarkdefaults_favicon_abouthome">chrome/chrome/content/branding/favicon64.png</string>
|
||||
|
||||
<string name="bookmarkdefaults_title_abouthome">@bookmarks_aboutHome@</string>
|
||||
<string name="bookmarkdefaults_url_abouthome">about:home</string>
|
||||
|
@ -1,3 +1,4 @@
|
||||
mobile/android/branding/aurora/content/logo.png
|
||||
mobile/android/branding/aurora/content/favicon32.png
|
||||
mobile/android/branding/aurora/content/bookmarkdefaults_favicon_aboutfirefox.png
|
||||
mobile/android/branding/aurora/content/mdpi/widget_icon.png
|
||||
|
After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 7.8 KiB |
@ -8,4 +8,3 @@ chrome.jar:
|
||||
content/branding/logoWordmark.png (logoWordmark.png)
|
||||
content/branding/logo.png (logo.png)
|
||||
content/branding/favicon32.png (favicon32.png)
|
||||
content/branding/favicon64.png (favicon64.png)
|
||||
|
@ -1,3 +1,4 @@
|
||||
mobile/android/branding/beta/content/logo.png
|
||||
mobile/android/branding/beta/content/favicon32.png
|
||||
mobile/android/branding/beta/content/bookmarkdefaults_favicon_aboutfirefox.png
|
||||
mobile/android/branding/beta/content/mdpi/widget_icon.png
|
||||
|
After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 8.1 KiB |
@ -8,4 +8,3 @@ chrome.jar:
|
||||
content/branding/logoWordmark.png (logoWordmark.png)
|
||||
content/branding/logo.png (logo.png)
|
||||
content/branding/favicon32.png (favicon32.png)
|
||||
content/branding/favicon64.png (favicon64.png)
|
||||
|
@ -1,3 +1,4 @@
|
||||
mobile/android/branding/nightly/content/logo.png
|
||||
mobile/android/branding/nightly/content/favicon32.png
|
||||
mobile/android/branding/nightly/content/bookmarkdefaults_favicon_aboutfirefox.png
|
||||
mobile/android/branding/nightly/content/mdpi/widget_icon.png
|
||||
|
After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 7.5 KiB |
@ -8,4 +8,3 @@ chrome.jar:
|
||||
content/branding/logoWordmark.png (logoWordmark.png)
|
||||
content/branding/logo.png (logo.png)
|
||||
content/branding/favicon32.png (favicon32.png)
|
||||
content/branding/favicon64.png (favicon64.png)
|
||||
|
@ -1,3 +1,4 @@
|
||||
mobile/android/branding/official/content/logo.png
|
||||
mobile/android/branding/official/content/favicon32.png
|
||||
mobile/android/branding/official/content/bookmarkdefaults_favicon_aboutfirefox.png
|
||||
mobile/android/branding/official/content/mdpi/widget_icon.png
|
||||
|
After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 8.1 KiB |
@ -8,4 +8,3 @@ chrome.jar:
|
||||
content/branding/logoWordmark.png (logoWordmark.png)
|
||||
content/branding/logo.png (logo.png)
|
||||
content/branding/favicon32.png (favicon32.png)
|
||||
content/branding/favicon64.png (favicon64.png)
|
||||
|
@ -1,3 +1,4 @@
|
||||
mobile/android/branding/unofficial/content/favicon32.png
|
||||
mobile/android/branding/unofficial/content/logo.png
|
||||
mobile/android/branding/unofficial/content/bookmarkdefaults_favicon_aboutfirefox.png
|
||||
mobile/android/branding/unofficial/content/mdpi/widget_icon.png
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 7.1 KiB |
@ -8,4 +8,3 @@ chrome.jar:
|
||||
content/branding/logoWordmark.png (logoWordmark.png)
|
||||
content/branding/logo.png (logo.png)
|
||||
content/branding/favicon32.png (favicon32.png)
|
||||
content/branding/favicon64.png (favicon64.png)
|
||||
|
@ -18,7 +18,7 @@
|
||||
<meta name="viewport" content="width=480; initial-scale=.6667; user-scalable=no"/>
|
||||
<title>&aboutPage.title;</title>
|
||||
<link rel="stylesheet" href="chrome://browser/skin/aboutPage.css" type="text/css"/>
|
||||
<link rel="icon" type="image/png" sizes="64x64" href="chrome://branding/content/favicon64.png" />
|
||||
<link rel="icon" type="image/png" href="chrome://branding/content/favicon32.png" />
|
||||
</head>
|
||||
|
||||
<body dir="&locale.dir;">
|
||||
|
@ -18,7 +18,7 @@
|
||||
<head>
|
||||
<title>&aboutAddons.title2;</title>
|
||||
<meta name="viewport" content="width=480; initial-scale=.6667; user-scalable=0" />
|
||||
<link rel="icon" type="image/png" sizes="64x64" href="chrome://branding/content/favicon64.png" />
|
||||
<link rel="icon" type="image/png" href="chrome://branding/content/favicon32.png" />
|
||||
<link rel="stylesheet" href="chrome://browser/skin/aboutAddons.css" type="text/css"/>
|
||||
<style>
|
||||
.hide-on-enable,
|
||||
|
@ -21,7 +21,7 @@
|
||||
<head>
|
||||
<title>&aboutApps.title2;</title>
|
||||
<meta name="viewport" content="width=480; initial-scale=.6667; user-scalable=0" />
|
||||
<link rel="icon" type="image/png" sizes="64x64" href="chrome://branding/content/favicon64.png" />
|
||||
<link rel="icon" type="image/png" href="chrome://branding/content/favicon32.png" />
|
||||
<link rel="stylesheet" type="text/css" href="chrome://browser/skin/aboutApps.css" media="all" />
|
||||
<script type="text/javascript;version=1.8" src="chrome://browser/content/aboutApps.js"></script>
|
||||
</head>
|
||||
|
@ -27,7 +27,7 @@
|
||||
should be updated. If this page starts using a different favicon
|
||||
than neterrorm nsFaviconService->SetAndLoadFaviconForPage
|
||||
should be updated to ignore this one as well. -->
|
||||
<link rel="icon" type="image/png" id="favicon" sizes="64x64" href="chrome://global/skin/icons/warning-64.png"/>
|
||||
<link rel="icon" type="image/png" id="favicon" href="chrome://global/skin/icons/warning-16.png"/>
|
||||
|
||||
<script type="application/javascript"><![CDATA[
|
||||
// Error url MUST be formatted like this:
|
||||
|
@ -19,7 +19,7 @@
|
||||
<head>
|
||||
<title>&aboutDownloads.title;</title>
|
||||
<meta name="viewport" content="width=480; initial-scale=.6667; user-scalable=0" />
|
||||
<link rel="icon" type="image/png" sizes="64x64" href="chrome://branding/content/favicon64.png" />
|
||||
<link rel="icon" type="image/png" href="chrome://branding/content/favicon32.png" />
|
||||
<link rel="stylesheet" href="chrome://browser/skin/aboutDownloads.css" type="text/css"/>
|
||||
</head>
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
<title>&pageTitle;</title>
|
||||
<meta name="viewport" content="width=device-width; user-scalable=0" />
|
||||
<link rel="stylesheet" href="chrome://browser/skin/aboutFeedback.css" type="text/css"/>
|
||||
<link rel="icon" type="image/png" sizes="64x64" href="chrome://branding/content/favicon64.png" />
|
||||
<link rel="icon" type="image/png" href="chrome://branding/content/favicon32.png" />
|
||||
</head>
|
||||
|
||||
<body dir="&locale.dir;" onload="init();" onunload="uninit();">
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<link rel="icon" type="image/png" sizes="64x64" href="chrome://branding/content/favicon64.png" />
|
||||
<link rel="icon" type="image/png" href="chrome://branding/content/favicon32.png" />
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width; user-scalable=false" />
|
||||
<link rel="stylesheet" href="chrome://global/skin/netError.css" type="text/css" media="all" />
|
||||
<link rel="icon" type="image/png" id="favicon" sizes="64x64" href="chrome://global/skin/icons/blacklist_large.png"/>
|
||||
<link rel="icon" type="image/png" id="favicon" href="chrome://global/skin/icons/blacklist_favicon.png"/>
|
||||
|
||||
<script type="application/javascript"><![CDATA[
|
||||
// Error url MUST be formatted like this:
|
||||
|
@ -24,7 +24,7 @@
|
||||
<link rel="stylesheet" href="chrome://global/skin/netError.css" type="text/css" media="all" />
|
||||
<!-- If the location of the favicon is changed here, the FAVICON_ERRORPAGE_URL symbol in
|
||||
toolkit/components/places/src/nsFaviconService.h should be updated. -->
|
||||
<link rel="icon" type="image/png" id="favicon" sizes="64x64" href="chrome://global/skin/icons/warning-64.png"/>
|
||||
<link rel="icon" type="image/png" id="favicon" href="chrome://global/skin/icons/warning-16.png"/>
|
||||
|
||||
<script type="application/javascript"><![CDATA[
|
||||
// Error url MUST be formatted like this:
|
||||
|