Fix bug 181649: make sure that site icons are not loaded if the (hidden) "browser.chrome.favicons" pref is set to false.

git-svn-id: svn://10.0.0.236/trunk@182153 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
smfr%smfr.org
2005-10-13 02:23:05 +00:00
parent 4a4c4ae638
commit 80fa308c2c
6 changed files with 33 additions and 26 deletions

View File

@@ -61,7 +61,6 @@ pref("chimera.log_js_to_console", false);
pref("general.useragent.vendor", "Camino");
pref("general.useragent.vendorSub", "1.0+");
pref("browser.chrome.site_icons", true);
pref("browser.chrome.favicons", true);
pref("browser.urlbar.autocomplete.enabled", true);

View File

@@ -209,11 +209,13 @@ NSString* const URLLoadSuccessKey = @"url_bool";
NSImage* siteIcon = [[SiteIconProvider sharedFavoriteIconProvider] favoriteIconForPage:[self url]];
if (siteIcon)
[self setIcon:siteIcon];
else
else if ([[BookmarkManager sharedBookmarkManager] showSiteIcons])
{
[[SiteIconProvider sharedFavoriteIconProvider] fetchFavoriteIconForPage:[self url]
withIconLocation:nil
allowNetwork:NO
notifyingClient:self];
}
}
}

View File

@@ -72,6 +72,7 @@ extern NSString* const kBookmarksMenuFolderIdentifier;
BookmarkFolder* mLastUsedFolder;
BOOL mBookmarksLoaded;
BOOL mShowSiteIcons;
}
// Class Methods & shutdown stuff
@@ -83,6 +84,8 @@ extern NSString* const kBookmarksMenuFolderIdentifier;
- (BOOL)bookmarksLoaded;
- (BOOL)showSiteIcons;
+ (NSArray*)serializableArrayWithBookmarkItems:(NSArray*)bmArray;
+ (NSArray*)bookmarkItemsFromSerializableArray:(NSArray*)bmArray;

View File

@@ -197,10 +197,11 @@ static NSString* const kWriteBookmarkNotification = @"write_bms";
{
if ((self = [super init]))
{
mBookmarkURLMap = [[NSMutableDictionary alloc] initWithCapacity:50];
mBookmarkFaviconURLMap = [[NSMutableDictionary alloc] initWithCapacity:50];
mBookmarkURLMap = [[NSMutableDictionary alloc] initWithCapacity:50];
mBookmarkFaviconURLMap = [[NSMutableDictionary alloc] initWithCapacity:50];
mBookmarksLoaded = NO;
mBookmarksLoaded = NO;
mShowSiteIcons = [[PreferenceManager sharedInstance] getBooleanPref:"browser.chrome.favicons" withSuccess:NULL];
}
return self;
@@ -375,6 +376,10 @@ static NSString* const kWriteBookmarkNotification = @"write_bms";
return mBookmarksLoaded;
}
- (BOOL)showSiteIcons
{
return mShowSiteIcons;
}
//
// smart collections, as of now, are Rendezvous, Address Book, Top 10 List.

View File

@@ -498,17 +498,14 @@ static NSString* const kOfflineNotificationName = @"offlineModeChanged";
- (void)onLocationChange:(NSString*)urlSpec isNewPage:(BOOL)newPage requestSucceeded:(BOOL)requestOK
{
BOOL useSiteIcons = [[PreferenceManager sharedInstance] getBooleanPref:"browser.chrome.favicons" withSuccess:NULL];
if (newPage)
{
NSString* faviconURI = [SiteIconProvider defaultFaviconLocationStringFromURI:urlSpec];
if (requestOK && useSiteIcons && [faviconURI length] > 0)
if (requestOK && [faviconURI length] > 0)
{
SiteIconProvider* faviconProvider = [SiteIconProvider sharedFavoriteIconProvider];
// if the favicon uri has changed, fire off favicon load. When it completes, our
// imageLoadedNotification selector gets called.
// if the favicon uri has changed, do the favicon load
if (![faviconURI isEqualToString:mSiteIconURI])
{
// first get a cached image for this site, if we have one. we'll go ahead
@@ -522,13 +519,17 @@ static NSString* const kOfflineNotificationName = @"offlineModeChanged";
// immediately update the site icon (to the cached one, or the default)
[self updateSiteIconImage:cachedImage withURI:cachedImageURI loadError:NO];
// note that this is the only time we hit the network for site icons.
// note also that we may get a site icon from a link element later,
// which will replace any we get from the default location.
[faviconProvider fetchFavoriteIconForPage:urlSpec
withIconLocation:nil
allowNetwork:YES
notifyingClient:self];
if ([[PreferenceManager sharedInstance] getBooleanPref:"browser.chrome.favicons" withSuccess:NULL])
{
// note that this is the only time we hit the network for site icons.
// note also that we may get a site icon from a link element later,
// which will replace any we get from the default location.
// when this completes, our imageLoadedNotification: will get called.
[faviconProvider fetchFavoriteIconForPage:urlSpec
withIconLocation:nil
allowNetwork:YES
notifyingClient:self];
}
}
}
else
@@ -925,7 +926,7 @@ static NSString* const kOfflineNotificationName = @"offlineModeChanged";
}
// called when [[SiteIconProvider sharedFavoriteIconProvider] loadFavoriteIcon] completes
// called when [[SiteIconProvider sharedFavoriteIconProvider] fetchFavoriteIconForPage:...] completes
- (void)imageLoadedNotification:(NSNotification*)notification
{
NSDictionary* userInfo = [notification userInfo];

View File

@@ -594,19 +594,16 @@ enum
if (mSiteIcon)
return mSiteIcon;
if ([mDataSource showSiteIcons])
NSImage* siteIcon = [[SiteIconProvider sharedFavoriteIconProvider] favoriteIconForPage:[self url]];
if (siteIcon)
{
NSImage* siteIcon = [[SiteIconProvider sharedFavoriteIconProvider] favoriteIconForPage:[self url]];
if (siteIcon)
{
[self setSiteIcon:siteIcon];
return mSiteIcon;
}
[self setSiteIcon:siteIcon];
return mSiteIcon;
}
// firing off site icon loads here interferes with history submenu display
// (maybe a slew of Carbon or other events causes events to get lost?)
if (inAllowLoad)
if (inAllowLoad && [mDataSource showSiteIcons])
{
if (!mAttemptedIconLoad)
{