diff --git a/mozilla/camino/resources/application/all-camino.js b/mozilla/camino/resources/application/all-camino.js index d020699d754..41900b53002 100644 --- a/mozilla/camino/resources/application/all-camino.js +++ b/mozilla/camino/resources/application/all-camino.js @@ -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); diff --git a/mozilla/camino/src/bookmarks/Bookmark.mm b/mozilla/camino/src/bookmarks/Bookmark.mm index 88bd5b92a26..1148f8a7597 100644 --- a/mozilla/camino/src/bookmarks/Bookmark.mm +++ b/mozilla/camino/src/bookmarks/Bookmark.mm @@ -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]; + } } } diff --git a/mozilla/camino/src/bookmarks/BookmarkManager.h b/mozilla/camino/src/bookmarks/BookmarkManager.h index a43ad189aa5..3f811b039f5 100644 --- a/mozilla/camino/src/bookmarks/BookmarkManager.h +++ b/mozilla/camino/src/bookmarks/BookmarkManager.h @@ -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; diff --git a/mozilla/camino/src/bookmarks/BookmarkManager.mm b/mozilla/camino/src/bookmarks/BookmarkManager.mm index 9b680de0c40..e6147b13bc0 100644 --- a/mozilla/camino/src/bookmarks/BookmarkManager.mm +++ b/mozilla/camino/src/bookmarks/BookmarkManager.mm @@ -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. diff --git a/mozilla/camino/src/browser/BrowserWrapper.mm b/mozilla/camino/src/browser/BrowserWrapper.mm index af6dc4670a2..d7e12e4b805 100644 --- a/mozilla/camino/src/browser/BrowserWrapper.mm +++ b/mozilla/camino/src/browser/BrowserWrapper.mm @@ -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]; diff --git a/mozilla/camino/src/history/HistoryItem.mm b/mozilla/camino/src/history/HistoryItem.mm index 29849c35a8d..a15dcd4d3ab 100644 --- a/mozilla/camino/src/history/HistoryItem.mm +++ b/mozilla/camino/src/history/HistoryItem.mm @@ -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) {