Commit b0badeac authored by cblu's avatar cblu
Browse files

WebKit:

	Made the icon DB take a a path for built-in icons so that we only load them when necessary.

        * Misc.subproj/WebIconDatabase.m:
        (-[WebIconDatabase init]):
        (-[WebIconDatabase iconForSiteURL:withSize:]):
        (-[WebIconDatabase _hasIconForSiteURL:]):
        (-[WebIconDatabase _builtInIconsForHost:]):
        (-[WebIconDatabase _setBuiltInIconAtPath:forHost:]):
        * Misc.subproj/WebIconDatabasePrivate.h:
        * WebKit.pbproj/project.pbxproj:

WebBrowser:

	Added the built-in site icons to the Alexander.app package.

        * AppController.m:
        (-[AppController _installBuiltInIcons]):
        * Resources/SiteIcons/Icons.plist: Added.
        * Resources/SiteIcons/amazon.tiff: Added.
        * Resources/SiteIcons/apple.tiff: Added.
        * Resources/SiteIcons/cnet.tiff: Added.
        * Resources/SiteIcons/cnn.tiff: Added.
        * Resources/SiteIcons/ebay.tiff: Added.
        * Resources/SiteIcons/espn.tiff: Added.
        * Resources/SiteIcons/msn.tiff: Added.
        * Resources/SiteIcons/nyt.tiff: Added.
        * Resources/SiteIcons/pbskids.tiff: Added.
        * Resources/SiteIcons/yahoo.tiff: Added.
        * WebBrowser.pbproj/project.pbxproj:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1963 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 6e9d3709
2002-09-04 Chris Blumenberg <cblu@apple.com>
Made the icon DB take a a path for built-in icons so that we only load them when necessary.
* Misc.subproj/WebIconDatabase.m:
(-[WebIconDatabase init]):
(-[WebIconDatabase iconForSiteURL:withSize:]):
(-[WebIconDatabase _hasIconForSiteURL:]):
(-[WebIconDatabase _builtInIconsForHost:]):
(-[WebIconDatabase _setBuiltInIconAtPath:forHost:]):
* Misc.subproj/WebIconDatabasePrivate.h:
* WebKit.pbproj/project.pbxproj:
2002-09-04 Darin Adler <darin@apple.com>
Fix unused variable warnings for deployment builds.
......
2002-09-04 Chris Blumenberg <cblu@apple.com>
Made the icon DB take a a path for built-in icons so that we only load them when necessary.
* Misc.subproj/WebIconDatabase.m:
(-[WebIconDatabase init]):
(-[WebIconDatabase iconForSiteURL:withSize:]):
(-[WebIconDatabase _hasIconForSiteURL:]):
(-[WebIconDatabase _builtInIconsForHost:]):
(-[WebIconDatabase _setBuiltInIconAtPath:forHost:]):
* Misc.subproj/WebIconDatabasePrivate.h:
* WebKit.pbproj/project.pbxproj:
2002-09-04 Darin Adler <darin@apple.com>
Fix unused variable warnings for deployment builds.
......
......@@ -34,7 +34,7 @@ - (void)_loadIconDictionaries;
- (void)_updateFileDatabase;
- (NSMutableArray *)_iconsForIconURL:(NSURL *)iconURL;
- (NSImage *)_iconForFileURL:(NSURL *)fileURL withSize:(NSSize)size;
- (NSMutableArray *)_builtItIconsForHost:(NSString *)host;
- (NSMutableArray *)_builtInIconsForHost:(NSString *)host;
- (void)_retainIconForIconURL:(NSURL *)iconURL;
- (void)_releaseIconForIconURL:(NSURL *)iconURL;
- (void)_retainFutureIconForSiteURL:(NSURL *)siteURL;
......@@ -74,7 +74,8 @@ + (WebIconDatabase *)sharedIconDatabase
_private->iconURLToIcons = [[NSMutableDictionary dictionary] retain];
_private->iconURLToRetainCount = [[NSMutableDictionary dictionary] retain];
_private->futureSiteURLToRetainCount = [[NSMutableDictionary dictionary] retain];
_private->hostToBuiltItIcons = [[NSMutableDictionary dictionary] retain];
_private->hostToBuiltInIcons = [[NSMutableDictionary dictionary] retain];
_private->hostToBuiltInIconPath = [[NSMutableDictionary dictionary] retain];
_private->iconsToEraseWithURLs = [[NSMutableSet set] retain];
_private->iconsToSaveWithURLs = [[NSMutableSet set] retain];
......@@ -103,7 +104,7 @@ - (NSImage *)iconForSiteURL:(NSURL *)siteURL withSize:(NSSize)size
return [self _iconForFileURL:siteURL withSize:size];
}
NSMutableArray *icons = [self _builtItIconsForHost:[siteURL host]];
NSMutableArray *icons = [self _builtInIconsForHost:[siteURL host]];
if(!icons){
NSURL *iconURL = [_private->siteURLToIconURL objectForKey:siteURL];
......@@ -327,7 +328,7 @@ - (BOOL)_hasIconForSiteURL:(NSURL *)siteURL
{
if([siteURL isFileURL]){
return YES;
}else if([self _builtItIconsForHost:[siteURL host]]){
}else if([_private->hostToBuiltInIconPath objectForKey:[siteURL host]]){
return YES;
}else if([_private->siteURLToIconURL objectForKey:siteURL]){
return YES;
......@@ -395,13 +396,14 @@ - (NSImage *)_iconForFileURL:(NSURL *)fileURL withSize:(NSSize)size
}
}
- (NSMutableArray *)_builtItIconsForHost:(NSString *)host
- (NSMutableArray *)_builtInIconsForHost:(NSString *)host
{
NSArray *hostParts = [host componentsSeparatedByString:@"."];
NSMutableString *truncatedHost = [NSMutableString string];
NSString *hostPart, *path;
NSMutableArray *icons;
BOOL firstPart = YES;
NSString *hostPart;
NSImage *icon;
NSEnumerator *enumerator = [hostParts reverseObjectEnumerator];
while ((hostPart = [enumerator nextObject]) != nil) {
......@@ -410,9 +412,20 @@ - (NSMutableArray *)_builtItIconsForHost:(NSString *)host
firstPart = NO;
}else{
[truncatedHost insertString:[NSString stringWithFormat:@"%@.", hostPart] atIndex:0];
icons = [_private->hostToBuiltItIcons objectForKey:truncatedHost];
if(icons){
return icons;
path = [_private->hostToBuiltInIconPath objectForKey:truncatedHost];
if(path){
icons = [_private->hostToBuiltInIcons objectForKey:truncatedHost];
if(!icons){
icon = [[NSImage alloc] initWithContentsOfFile:path];
if(icon){
icons = [NSMutableArray arrayWithObject:icon];
[_private->hostToBuiltInIcons setObject:icons forKey:host];
[icon release];
}
}
if(icons){
return icons;
}
}
}
}
......@@ -470,16 +483,16 @@ - (void)_setIconURL:(NSURL *)iconURL forSiteURL:(NSURL *)siteURL
[self _updateFileDatabase];
}
- (void)_setBuiltInIcon:(NSImage *)icon forHost:(NSString *)host
- (void)_setBuiltInIconAtPath:(NSString *)path forHost:(NSString *)host
{
if(!icon || !host){
if(!path || !host){
return;
}
[_private->hostToBuiltInIconPath setObject:path forKey:host];
NSMutableSet *siteURLs = [_private->hostToSiteURLs objectForKey:host];
NSURL *siteURL;
[_private->hostToBuiltItIcons setObject:[NSMutableArray arrayWithObject:icon] forKey:host];
if(siteURLs){
NSEnumerator *enumerator = [siteURLs objectEnumerator];
......
......@@ -22,7 +22,8 @@
NSMutableDictionary *siteURLToIconURL;
NSMutableDictionary *futureSiteURLToRetainCount;
NSMutableDictionary *hostToSiteURLs;
NSMutableDictionary *hostToBuiltItIcons;
NSMutableDictionary *hostToBuiltInIcons;
NSMutableDictionary *hostToBuiltInIconPath;
NSMutableSet *iconsOnDiskWithURLs;
NSMutableSet *iconsToEraseWithURLs;
......@@ -50,7 +51,7 @@
// Called by WebDataSource to bind a web site URL to a icon URL and icon image.
- (void)_setIconURL:(NSURL *)iconURL forSiteURL:(NSURL *)siteURL;
- (void)_setBuiltInIcon:(NSImage *)icon forHost:(NSString *)host;
- (void)_setBuiltInIconAtPath:(NSString *)path forHost:(NSString *)host;
- (BOOL)_hasIconForSiteURL:(NSURL *)siteURL;
......
......@@ -72,7 +72,6 @@
F58C8A07025BD3BC018635CA,
F531DDFF02F0C36F018635CA,
);
hasScannedForEncodings = 1;
isa = PBXProject;
knownRegions = (
English,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment