Bug 143687 Bring back site icons (favicons) in personal toolbar
patch by mozilla-bugs@nogin.org r=varga sr=alecf git-svn-id: svn://10.0.0.236/trunk@148209 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -110,6 +110,9 @@ pref("browser.urlbar.matchOnlyTyped", false);
|
||||
pref("browser.chrome.site_icons", true);
|
||||
pref("browser.chrome.favicons", false);
|
||||
|
||||
// 0 = never, 1 = when in cache, 2 = always
|
||||
pref("browser.chrome.load_toolbar_icons", 0);
|
||||
|
||||
pref("browser.chrome.toolbar_tips", true);
|
||||
// 0 = Pictures Only, 1 = Text Only, 2 = Pictures and Text
|
||||
pref("browser.chrome.toolbar_style", 2);
|
||||
|
||||
@@ -227,6 +227,8 @@
|
||||
<rule parent="hbox" iscontainer="true" isempty="true"
|
||||
rdf:type="http://home.netscape.com/NC-rdf#Folder">
|
||||
<toolbarbutton type="menu" editable="true" class="bookmark-item"
|
||||
image="rdf:http://home.netscape.com/NC-rdf#Icon"
|
||||
validate="never"
|
||||
rdf:type="http://home.netscape.com/NC-rdf#Folder"
|
||||
uri="rdf:*" label="rdf:http://home.netscape.com/NC-rdf#Name">
|
||||
<menupopup>
|
||||
@@ -236,6 +238,8 @@
|
||||
</rule>
|
||||
<rule parent="hbox" iscontainer="true">
|
||||
<toolbarbutton type="menu" class="bookmark-item" uri="rdf:*" editable="true"
|
||||
image="rdf:http://home.netscape.com/NC-rdf#Icon"
|
||||
validate="never"
|
||||
rdf:type="http://home.netscape.com/NC-rdf#Folder"
|
||||
label="rdf:http://home.netscape.com/NC-rdf#Name">
|
||||
<menupopup/>
|
||||
@@ -243,6 +247,8 @@
|
||||
</rule>
|
||||
<rule parent="hbox">
|
||||
<toolbarbutton class="bookmark-item" uri="rdf:*" editable="true"
|
||||
image="rdf:http://home.netscape.com/NC-rdf#Icon"
|
||||
validate="never"
|
||||
status="rdf:http://home.netscape.com/WEB-rdf#status"
|
||||
rdf:type="http://home.netscape.com/NC-rdf#Bookmark"
|
||||
statustext="rdf:http://home.netscape.com/NC-rdf#URL"
|
||||
@@ -262,6 +268,8 @@
|
||||
rdf:type="http://home.netscape.com/NC-rdf#Folder">
|
||||
<menupopup>
|
||||
<menu class="menu-iconic bookmark-item" uri="rdf:*"
|
||||
image="rdf:http://home.netscape.com/NC-rdf#Icon"
|
||||
validate="never"
|
||||
type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
|
||||
label="rdf:http://home.netscape.com/NC-rdf#Name">
|
||||
<menupopup>
|
||||
@@ -273,6 +281,8 @@
|
||||
<rule iscontainer="true">
|
||||
<menupopup>
|
||||
<menu class="menu-iconic bookmark-item" uri="rdf:*"
|
||||
image="rdf:http://home.netscape.com/NC-rdf#Icon"
|
||||
validate="never"
|
||||
label="rdf:http://home.netscape.com/NC-rdf#Name"
|
||||
type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type">
|
||||
<menupopup />
|
||||
@@ -287,6 +297,8 @@
|
||||
<rule>
|
||||
<menupopup>
|
||||
<menuitem class="menuitem-iconic bookmark-item" uri="rdf:*"
|
||||
src="rdf:http://home.netscape.com/NC-rdf#Icon"
|
||||
validate="never"
|
||||
label="rdf:http://home.netscape.com/NC-rdf#Name"
|
||||
status="rdf:http://home.netscape.com/WEB-rdf#status"/>
|
||||
</menupopup>
|
||||
|
||||
@@ -1744,8 +1744,14 @@ nsBookmarksService::Init()
|
||||
nsCOMPtr<nsIPref> prefServ(do_GetService(kPrefCID, &rv));
|
||||
if (NS_SUCCEEDED(rv) && (prefServ))
|
||||
{
|
||||
// get browser icon pref
|
||||
prefServ->GetBoolPref("browser.chrome.site_icons", &mBrowserIcons);
|
||||
// get browser icon prefs
|
||||
PRInt32 toolbarIcons = 0;
|
||||
prefServ->GetIntPref("browser.chrome.load_toolbar_icons", &toolbarIcons);
|
||||
if (toolbarIcons > 0) {
|
||||
prefServ->GetBoolPref("browser.chrome.site_icons", &mBrowserIcons);
|
||||
mAlwaysLoadIcons = (toolbarIcons > 1);
|
||||
} else
|
||||
mAlwaysLoadIcons = mBrowserIcons = PR_FALSE;
|
||||
|
||||
// determine what the name of the Personal Toolbar Folder is...
|
||||
// first from user preference, then string bundle, then hard-coded default
|
||||
@@ -4178,10 +4184,13 @@ nsBookmarksService::ProcessCachedBookmarkIcon(nsIRDFResource* aSource,
|
||||
}
|
||||
}
|
||||
|
||||
PRBool forceLoad = mAlwaysLoadIcons;
|
||||
|
||||
// if no internal icon reference, try and synthesize a URL
|
||||
if (path.IsEmpty())
|
||||
{
|
||||
const char *uri;
|
||||
forceLoad = PR_FALSE;
|
||||
if (NS_FAILED(rv = aSource->GetValueConst( &uri )))
|
||||
{
|
||||
return rv;
|
||||
@@ -4214,27 +4223,29 @@ nsBookmarksService::ProcessCachedBookmarkIcon(nsIRDFResource* aSource,
|
||||
path.Append("/favicon.ico");
|
||||
}
|
||||
|
||||
// only return favicon reference if its in the cache
|
||||
// (that is, never go out onto the net)
|
||||
if (!mCacheSession)
|
||||
{
|
||||
return NS_RDF_NO_VALUE;
|
||||
if (!forceLoad) {
|
||||
// only return favicon reference if its in the cache
|
||||
// (that is, never go out onto the net)
|
||||
if (!mCacheSession)
|
||||
{
|
||||
return NS_RDF_NO_VALUE;
|
||||
}
|
||||
nsCOMPtr<nsICacheEntryDescriptor> entry;
|
||||
rv = mCacheSession->OpenCacheEntry(path.get(), nsICache::ACCESS_READ,
|
||||
nsICache::NON_BLOCKING, getter_AddRefs(entry));
|
||||
if (NS_FAILED(rv) || (!entry))
|
||||
{
|
||||
return NS_RDF_NO_VALUE;
|
||||
}
|
||||
if (entry)
|
||||
{
|
||||
PRUint32 expTime;
|
||||
entry->GetExpirationTime(&expTime);
|
||||
if (expTime != PR_UINT32_MAX)
|
||||
entry->SetExpirationTime(PR_UINT32_MAX);
|
||||
}
|
||||
entry->Close();
|
||||
}
|
||||
nsCOMPtr<nsICacheEntryDescriptor> entry;
|
||||
rv = mCacheSession->OpenCacheEntry(path.get(), nsICache::ACCESS_READ,
|
||||
nsICache::NON_BLOCKING, getter_AddRefs(entry));
|
||||
if (NS_FAILED(rv) || (!entry))
|
||||
{
|
||||
return NS_RDF_NO_VALUE;
|
||||
}
|
||||
if (entry)
|
||||
{
|
||||
PRUint32 expTime;
|
||||
entry->GetExpirationTime(&expTime);
|
||||
if (expTime != PR_UINT32_MAX)
|
||||
entry->SetExpirationTime(PR_UINT32_MAX);
|
||||
}
|
||||
entry->Close();
|
||||
|
||||
// ok, have a cached icon entry, so return the URL's associated favicon
|
||||
nsAutoString litStr;
|
||||
|
||||
@@ -94,21 +94,22 @@ protected:
|
||||
PRInt32 mUpdateBatchNest;
|
||||
nsXPIDLString mPersonalToolbarName;
|
||||
nsXPIDLString mBookmarksRootName;
|
||||
PRBool mDirty;
|
||||
PRBool mBrowserIcons;
|
||||
PRBool busySchedule;
|
||||
PRPackedBool mDirty;
|
||||
PRPackedBool mBrowserIcons;
|
||||
PRPackedBool mAlwaysLoadIcons;
|
||||
PRPackedBool busySchedule;
|
||||
|
||||
// System Bookmark parsing
|
||||
#if defined(XP_WIN)
|
||||
#if defined(XP_MAC) || defined(XP_MACOSX)
|
||||
PRPackedBool mIEFavoritesAvailable;
|
||||
|
||||
nsresult ReadFavorites();
|
||||
#elif defined(XP_WIN)
|
||||
// @param aDirectory - Favorites Folder to import from.
|
||||
// @param aParentResource - Folder into which to place imported
|
||||
// Favorites.
|
||||
nsresult ParseFavoritesFolder(nsIFile* aDirectory,
|
||||
nsIRDFResource* aParentResource);
|
||||
#elif defined(XP_MAC) || defined(XP_MACOSX)
|
||||
PRBool mIEFavoritesAvailable;
|
||||
|
||||
nsresult ReadFavorites();
|
||||
#endif
|
||||
|
||||
#if defined(XP_WIN) || defined(XP_MAC) || defined(XP_MACOSX)
|
||||
|
||||
Reference in New Issue
Block a user