[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

cblu cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:53:26 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 37d6ff6afe4445a7309182a31db2d791a30ba00a
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Oct 24 00:44:53 2002 +0000

    WebCore:
    
    	Change for plug-in package API changes.
    
            * kwq/KWQKConfigBase.mm:
            (KConfig::readEntry):
            * kwq/WebCoreBridge.h: added didAddSubview, called when a render_frame's view is added as a subview of the main view.
            * kwq/WebCoreViewFactory.h: added didAddSubview
    
    WebKit:
    
    	Changed the plug-in package API to return key enumerators instead dictionaries.
    
            * Plugins.subproj/WebBasePluginPackage.h:
            * Plugins.subproj/WebBasePluginPackage.m:
            (-[WebBasePluginPackage initWithPath:]):
            (-[WebBasePluginPackage load]):
            (-[WebBasePluginPackage unload]):
            (-[WebBasePluginPackage dealloc]):
            (-[WebBasePluginPackage extensionEnumerator]):
            (-[WebBasePluginPackage MIMETypeEnumerator]):
            (-[WebBasePluginPackage descriptionForMIMEType:]):
            (-[WebBasePluginPackage MIMETypeForExtension:]):
            (-[WebBasePluginPackage extensionsForMIMEType:]):
            (-[WebBasePluginPackage setName:]):
            (-[WebBasePluginPackage setPath:]):
            (-[WebBasePluginPackage setFilename:]):
            (-[WebBasePluginPackage setPluginDescription:]):
            (-[WebBasePluginPackage setMIMEToDescriptionDictionary:]):
            (-[WebBasePluginPackage setMIMEToExtensionsDictionary:]):
            * Plugins.subproj/WebNetscapePluginPackage.h:
            * Plugins.subproj/WebNetscapePluginPackage.m:
            (-[WebNetscapePluginPackage getPluginInfo]):
            (-[WebNetscapePluginPackage pathByResolvingSymlinksAndAliasesInPath:]):
            (-[WebNetscapePluginPackage initWithPath:]):
            (-[WebNetscapePluginPackage executableType]):
            * Plugins.subproj/WebPluginController.h:
            * Plugins.subproj/WebPluginController.m:
            (-[WebPluginController didAddSubview:]):
            * Plugins.subproj/WebPluginDatabase.h:
            * Plugins.subproj/WebPluginDatabase.m:
            (-[WebPluginDatabase pluginForKey:withEnumeratorSelector:]):
            (-[WebPluginDatabase pluginForMIMEType:]):
            (-[WebPluginDatabase pluginForExtension:]):
            (-[WebPluginDatabase MIMETypes]):
            (-[WebPluginDatabase init]):
            * WebCoreSupport.subproj/WebBridge.m:
            (-[WebBridge viewForPluginWithURL:attributes:baseURL:serviceType:]):
            (-[WebBridge viewForJavaAppletWithFrame:attributes:baseURL:]):
            (-[WebBridge didAddSubview:]): new
            * WebView.subproj/WebFramePrivate.h:
            * WebView.subproj/WebFramePrivate.m:
            (-[WebFrame _didAddSubview:]): new
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2441 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index b21619e..eaca298 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,12 @@
+2002-10-23  Chris Blumenberg  <cblu at apple.com>
+
+	Change for plug-in package API changes.
+
+        * kwq/KWQKConfigBase.mm:
+        (KConfig::readEntry):
+        * kwq/WebCoreBridge.h: added didAddSubview, called when a render_frame's view is added as a subview of the main view.
+        * kwq/WebCoreViewFactory.h: added didAddSubview
+
 2002-10-23  Darin Adler  <darin at apple.com>
 
 	- finished up the job of moving the file button to WebKit
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index b21619e..eaca298 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,12 @@
+2002-10-23  Chris Blumenberg  <cblu at apple.com>
+
+	Change for plug-in package API changes.
+
+        * kwq/KWQKConfigBase.mm:
+        (KConfig::readEntry):
+        * kwq/WebCoreBridge.h: added didAddSubview, called when a render_frame's view is added as a subview of the main view.
+        * kwq/WebCoreViewFactory.h: added didAddSubview
+
 2002-10-23  Darin Adler  <darin at apple.com>
 
 	- finished up the job of moving the file button to WebKit
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index b21619e..eaca298 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,12 @@
+2002-10-23  Chris Blumenberg  <cblu at apple.com>
+
+	Change for plug-in package API changes.
+
+        * kwq/KWQKConfigBase.mm:
+        (KConfig::readEntry):
+        * kwq/WebCoreBridge.h: added didAddSubview, called when a render_frame's view is added as a subview of the main view.
+        * kwq/WebCoreViewFactory.h: added didAddSubview
+
 2002-10-23  Darin Adler  <darin at apple.com>
 
 	- finished up the job of moving the file button to WebKit
diff --git a/WebCore/kwq/KWQKConfigBase.mm b/WebCore/kwq/KWQKConfigBase.mm
index bfe6395..98b7c0f 100644
--- a/WebCore/kwq/KWQKConfigBase.mm
+++ b/WebCore/kwq/KWQKConfigBase.mm
@@ -76,27 +76,26 @@ QString KConfig::readEntry(const char *pKey, const QString& aDefault) const
         } else if (strcmp(pKey, "description") == 0) {
             return QString::fromNSString([plugin pluginDescription]);
         } else if (strcmp(pKey, "mime") == 0) {
-            NSDictionary *MIMEToExtensions =  [plugin MIMEToExtensionsDictionary];
-            NSDictionary *MIMEToDescription = [plugin MIMEToDescriptionDictionary];
-            NSArray *MIMETypes = [MIMEToExtensions allKeys], *extensions;
+            NSEnumerator *MIMETypeEnumerator = [plugin MIMETypeEnumerator], *extensionEnumerator;
+            NSMutableString *MIMEString = [NSMutableString string];
             NSString *MIME, *extension;
-            NSMutableString *bigMimeString = [NSMutableString string];
+            NSArray *extensions;
             
-            for (uint i = 0; i < [MIMETypes count]; i++) {
-                MIME = [MIMETypes objectAtIndex:i];
-                [bigMimeString appendFormat:@"%@:", MIME]; // mime type
+            while ((MIME = [MIMETypeEnumerator nextObject]) != nil) {
+                [MIMEString appendFormat:@"%@:", MIME];
 
-                extensions = [MIMEToExtensions objectForKey:MIME];
-                for (uint n = 0; n < [extensions count]; n++) {
-                    extension = [extensions objectAtIndex:n];
-                    [bigMimeString appendString:extension]; // mime's extension
-                    if(n < [extensions count] - 1){
-                        [bigMimeString appendString:@","];
-                    }
+                extensions = [plugin extensionsForMIMEType:MIME];
+                extensionEnumerator = [extensions objectEnumerator];
+                
+                while ((extension = [extensionEnumerator nextObject]) != nil) {
+                    [MIMEString appendFormat:@"%@,", extension];
                 }
-                [bigMimeString appendFormat:@":%@;", [MIMEToDescription objectForKey:MIME]]; // mime's description
+                // Delete the last ",".
+                [MIMEString deleteCharactersInRange:NSMakeRange([MIMEString length]-1, 1)];
+                [MIMEString appendFormat:@":%@;", [plugin descriptionForMIMEType:MIME]];
             }
-            return QString::fromNSString(bigMimeString);
+
+            return QString::fromNSString(MIMEString);
         }
     }
     
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index 56fe5c1..fadffb6 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -230,6 +230,8 @@ enum FrameBorderStyle {
 - (NSView *)viewForPluginWithURL:(NSURL *)URL attributes:(NSArray *)attributesArray baseURL:(NSURL *)baseURL serviceType:(NSString *)serviceType;
 - (NSView *)viewForJavaAppletWithFrame:(NSRect)frame attributes:(NSDictionary *)attributes baseURL:(NSURL *)baseURL;
 
+- (void)didAddSubview:(NSView *)view;
+
 @end
 
 // This interface definition allows those who hold a WebCoreBridge * to call all the methods
diff --git a/WebCore/kwq/WebCoreViewFactory.h b/WebCore/kwq/WebCoreViewFactory.h
index dfe155c..c1344cd 100644
--- a/WebCore/kwq/WebCoreViewFactory.h
+++ b/WebCore/kwq/WebCoreViewFactory.h
@@ -55,8 +55,9 @@
 - (NSString *)name;
 - (NSString *)filename;
 - (NSString *)pluginDescription;
-- (NSDictionary *)MIMEToExtensionsDictionary;
-- (NSDictionary *)MIMEToDescriptionDictionary;
+- (NSEnumerator *)MIMETypeEnumerator;
+- (NSString *)descriptionForMIMEType:(NSString *)MIMEType;
+- (NSArray *)extensionsForMIMEType:(NSString *)MIMEType;
 @end
 
 @protocol WebCoreFileButton <NSObject>
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 4df4355..70081cd 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,48 @@
+2002-10-23  Chris Blumenberg  <cblu at apple.com>
+
+	Changed the plug-in package API to return key enumerators instead dictionaries.
+
+        * Plugins.subproj/WebBasePluginPackage.h:
+        * Plugins.subproj/WebBasePluginPackage.m:
+        (-[WebBasePluginPackage initWithPath:]):
+        (-[WebBasePluginPackage load]):
+        (-[WebBasePluginPackage unload]):
+        (-[WebBasePluginPackage dealloc]):
+        (-[WebBasePluginPackage extensionEnumerator]):
+        (-[WebBasePluginPackage MIMETypeEnumerator]):
+        (-[WebBasePluginPackage descriptionForMIMEType:]):
+        (-[WebBasePluginPackage MIMETypeForExtension:]):
+        (-[WebBasePluginPackage extensionsForMIMEType:]):
+        (-[WebBasePluginPackage setName:]):
+        (-[WebBasePluginPackage setPath:]):
+        (-[WebBasePluginPackage setFilename:]):
+        (-[WebBasePluginPackage setPluginDescription:]):
+        (-[WebBasePluginPackage setMIMEToDescriptionDictionary:]):
+        (-[WebBasePluginPackage setMIMEToExtensionsDictionary:]):
+        * Plugins.subproj/WebNetscapePluginPackage.h:
+        * Plugins.subproj/WebNetscapePluginPackage.m:
+        (-[WebNetscapePluginPackage getPluginInfo]):
+        (-[WebNetscapePluginPackage pathByResolvingSymlinksAndAliasesInPath:]):
+        (-[WebNetscapePluginPackage initWithPath:]):
+        (-[WebNetscapePluginPackage executableType]):
+        * Plugins.subproj/WebPluginController.h:
+        * Plugins.subproj/WebPluginController.m:
+        (-[WebPluginController didAddSubview:]):
+        * Plugins.subproj/WebPluginDatabase.h:
+        * Plugins.subproj/WebPluginDatabase.m:
+        (-[WebPluginDatabase pluginForKey:withEnumeratorSelector:]):
+        (-[WebPluginDatabase pluginForMIMEType:]):
+        (-[WebPluginDatabase pluginForExtension:]):
+        (-[WebPluginDatabase MIMETypes]):
+        (-[WebPluginDatabase init]):
+        * WebCoreSupport.subproj/WebBridge.m:
+        (-[WebBridge viewForPluginWithURL:attributes:baseURL:serviceType:]):
+        (-[WebBridge viewForJavaAppletWithFrame:attributes:baseURL:]):
+        (-[WebBridge didAddSubview:]): new
+        * WebView.subproj/WebFramePrivate.h:
+        * WebView.subproj/WebFramePrivate.m:
+        (-[WebFrame _didAddSubview:]): new 
+
 2002-10-23  Darin Adler  <darin at apple.com>
 
 	- finished up the job of moving the file button here from WebCore.
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 4df4355..70081cd 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,48 @@
+2002-10-23  Chris Blumenberg  <cblu at apple.com>
+
+	Changed the plug-in package API to return key enumerators instead dictionaries.
+
+        * Plugins.subproj/WebBasePluginPackage.h:
+        * Plugins.subproj/WebBasePluginPackage.m:
+        (-[WebBasePluginPackage initWithPath:]):
+        (-[WebBasePluginPackage load]):
+        (-[WebBasePluginPackage unload]):
+        (-[WebBasePluginPackage dealloc]):
+        (-[WebBasePluginPackage extensionEnumerator]):
+        (-[WebBasePluginPackage MIMETypeEnumerator]):
+        (-[WebBasePluginPackage descriptionForMIMEType:]):
+        (-[WebBasePluginPackage MIMETypeForExtension:]):
+        (-[WebBasePluginPackage extensionsForMIMEType:]):
+        (-[WebBasePluginPackage setName:]):
+        (-[WebBasePluginPackage setPath:]):
+        (-[WebBasePluginPackage setFilename:]):
+        (-[WebBasePluginPackage setPluginDescription:]):
+        (-[WebBasePluginPackage setMIMEToDescriptionDictionary:]):
+        (-[WebBasePluginPackage setMIMEToExtensionsDictionary:]):
+        * Plugins.subproj/WebNetscapePluginPackage.h:
+        * Plugins.subproj/WebNetscapePluginPackage.m:
+        (-[WebNetscapePluginPackage getPluginInfo]):
+        (-[WebNetscapePluginPackage pathByResolvingSymlinksAndAliasesInPath:]):
+        (-[WebNetscapePluginPackage initWithPath:]):
+        (-[WebNetscapePluginPackage executableType]):
+        * Plugins.subproj/WebPluginController.h:
+        * Plugins.subproj/WebPluginController.m:
+        (-[WebPluginController didAddSubview:]):
+        * Plugins.subproj/WebPluginDatabase.h:
+        * Plugins.subproj/WebPluginDatabase.m:
+        (-[WebPluginDatabase pluginForKey:withEnumeratorSelector:]):
+        (-[WebPluginDatabase pluginForMIMEType:]):
+        (-[WebPluginDatabase pluginForExtension:]):
+        (-[WebPluginDatabase MIMETypes]):
+        (-[WebPluginDatabase init]):
+        * WebCoreSupport.subproj/WebBridge.m:
+        (-[WebBridge viewForPluginWithURL:attributes:baseURL:serviceType:]):
+        (-[WebBridge viewForJavaAppletWithFrame:attributes:baseURL:]):
+        (-[WebBridge didAddSubview:]): new
+        * WebView.subproj/WebFramePrivate.h:
+        * WebView.subproj/WebFramePrivate.m:
+        (-[WebFrame _didAddSubview:]): new 
+
 2002-10-23  Darin Adler  <darin at apple.com>
 
 	- finished up the job of moving the file button here from WebCore.
diff --git a/WebKit/Plugins.subproj/WebBasePluginPackage.h b/WebKit/Plugins.subproj/WebBasePluginPackage.h
index f5259ab..21ec56a 100644
--- a/WebKit/Plugins.subproj/WebBasePluginPackage.h
+++ b/WebKit/Plugins.subproj/WebBasePluginPackage.h
@@ -12,26 +12,39 @@
 
 @interface WebBasePluginPackage : NSObject <WebCorePluginInfo>
 {
-    NSMutableDictionary *MIMEToExtensions;
-    NSMutableDictionary *extensionToMIME;
-    NSMutableDictionary *MIMEToDescription;
-
     NSString *name;
     NSString *path;
     NSString *filename;
     NSString *pluginDescription;
+
+    NSDictionary *MIMEToDescription;
+    NSDictionary *MIMEToExtensions;
+    NSMutableDictionary *extensionToMIME;
 }
 
 + (WebBasePluginPackage *)pluginWithPath:(NSString *)pluginPath;
 
 - initWithPath:(NSString *)pluginPath;
 
+- (BOOL)load;
+- (void)unload;
+
 - (NSString *)name;
 - (NSString *)path;
 - (NSString *)filename;
 - (NSString *)pluginDescription;
-- (NSDictionary *)extensionToMIMEDictionary;
-- (NSDictionary *)MIMEToExtensionsDictionary;
-- (NSDictionary *)MIMEToDescriptionDictionary;
+
+- (NSEnumerator *)extensionEnumerator;
+- (NSEnumerator *)MIMETypeEnumerator;
+- (NSString *)descriptionForMIMEType:(NSString *)MIMEType;
+- (NSString *)MIMETypeForExtension:(NSString *)extension;
+- (NSArray *)extensionsForMIMEType:(NSString *)MIMEType;
+
+- (void)setName:(NSString *)theName;
+- (void)setPath:(NSString *)thePath;
+- (void)setFilename:(NSString *)theFilename;
+- (void)setPluginDescription:(NSString *)description;
+- (void)setMIMEToDescriptionDictionary:(NSDictionary *)MIMEToDescriptionDictionary;
+- (void)setMIMEToExtensionsDictionary:(NSDictionary *)MIMEToExtensionsDictionary;
 
 @end
diff --git a/WebKit/Plugins.subproj/WebBasePluginPackage.m b/WebKit/Plugins.subproj/WebBasePluginPackage.m
index 3455673..e0ce7b9 100644
--- a/WebKit/Plugins.subproj/WebBasePluginPackage.m
+++ b/WebKit/Plugins.subproj/WebBasePluginPackage.m
@@ -26,9 +26,33 @@
 - initWithPath:(NSString *)pluginPath
 {
     [super init];
+    extensionToMIME = [[NSMutableDictionary dictionary] retain];
     return self;
 }
 
+- (BOOL)load
+{
+    return YES;
+}
+
+- (void)unload
+{
+}
+
+- (void)dealloc
+{
+    [name release];
+    [path release];
+    [filename release];
+    [pluginDescription release];
+
+    [MIMEToDescription release];
+    [MIMEToExtensions release];
+    [extensionToMIME removeAllObjects];
+    [extensionToMIME release];
+}
+
+
 - (NSString *)name{
     return name;
 }
@@ -46,19 +70,83 @@
     return pluginDescription;
 }
 
-- (NSDictionary *)extensionToMIMEDictionary
+- (NSEnumerator *)extensionEnumerator
+{
+    return [extensionToMIME keyEnumerator];
+}
+
+- (NSEnumerator *)MIMETypeEnumerator
+{
+    return [MIMEToExtensions keyEnumerator];
+}
+
+- (NSString *)descriptionForMIMEType:(NSString *)MIMEType
+{
+    return [MIMEToDescription objectForKey:MIMEType];
+}
+
+- (NSString *)MIMETypeForExtension:(NSString *)extension
 {
-    return extensionToMIME;
+    return [extensionToMIME objectForKey:extension];
 }
 
-- (NSDictionary *)MIMEToExtensionsDictionary
+- (NSArray *)extensionsForMIMEType:(NSString *)MIMEType
 {
-    return MIMEToExtensions;
+    return [MIMEToExtensions objectForKey:MIMEType];
 }
 
-- (NSDictionary *)MIMEToDescriptionDictionary
+- (void)setName:(NSString *)theName
 {
-    return MIMEToDescription;
+    [name release];
+    name = [theName retain];
+}
+
+- (void)setPath:(NSString *)thePath
+{
+    [path release];
+    path = [thePath retain];
+}
+
+- (void)setFilename:(NSString *)theFilename
+{
+    [filename release];
+    filename = [theFilename retain];
+}
+
+- (void)setPluginDescription:(NSString *)description
+{
+    [pluginDescription release];
+    pluginDescription = [description retain];
+}
+
+- (void)setMIMEToDescriptionDictionary:(NSDictionary *)MIMEToDescriptionDictionary
+{
+    [MIMEToDescription release];
+    MIMEToDescription = [MIMEToDescriptionDictionary retain];
+}
+
+- (void)setMIMEToExtensionsDictionary:(NSDictionary *)MIMEToExtensionsDictionary
+{
+    [MIMEToExtensions release];
+    MIMEToExtensions = [MIMEToExtensionsDictionary retain];
+
+    // Reverse the mapping
+    [extensionToMIME removeAllObjects];
+
+    NSEnumerator *MIMEEnumerator = [MIMEToExtensions keyEnumerator], *extensionEnumerator;
+    NSString *MIME, *extension;
+    NSArray *extensions;
+    
+    while ((MIME = [MIMEEnumerator nextObject]) != nil) {
+        extensions = [MIMEToExtensions objectForKey:MIME];
+        extensionEnumerator = [extensions objectEnumerator];
+
+        while ((extension = [extensionEnumerator nextObject]) != nil) {
+            if(![extension isEqualToString:@""]){
+                [extensionToMIME setObject:MIME forKey:extension];
+            }
+        }
+    }
 }
 
 - (NSString *)description
diff --git a/WebKit/Plugins.subproj/WebNetscapePluginPackage.h b/WebKit/Plugins.subproj/WebNetscapePluginPackage.h
index 66f2602..a6e381f 100644
--- a/WebKit/Plugins.subproj/WebNetscapePluginPackage.h
+++ b/WebKit/Plugins.subproj/WebNetscapePluginPackage.h
@@ -10,6 +10,10 @@
 #import <WebKit/npapi.h>
 #import <WebKit/WebBasePluginPackage.h>
 
+typedef enum {
+    WebCFMExecutableType,
+    WebMachOExecutableType
+}WebExecutableType;
 
 @interface WebNetscapePluginPackage : WebBasePluginPackage
 {
@@ -45,8 +49,7 @@
     NPP_ShutdownProcPtr NPP_Shutdown;
 }
 
-- (BOOL)load;
-- (void)unload;
+- (WebExecutableType)executableType;
 
 - (NPP_NewProcPtr)NPP_New;
 - (NPP_DestroyProcPtr)NPP_Destroy;
diff --git a/WebKit/Plugins.subproj/WebNetscapePluginPackage.m b/WebKit/Plugins.subproj/WebNetscapePluginPackage.m
index bd460a8..5cf0447 100644
--- a/WebKit/Plugins.subproj/WebNetscapePluginPackage.m
+++ b/WebKit/Plugins.subproj/WebNetscapePluginPackage.m
@@ -66,14 +66,13 @@ TransitionVector tVectorForFunctionPointer(FunctionPointer);
         return NO;
     }
 
-    NSString *MIME, *extension, *extensionsList, *description;
+    NSString *MIME, *extensionsList, *description;
     NSArray *extensions;
     NSRange r;
     uint i;
     
-    MIMEToExtensions = [[NSMutableDictionary dictionary] retain];
-    MIMEToDescription = [[NSMutableDictionary dictionary] retain];
-    extensionToMIME = [[NSMutableDictionary dictionary] retain];
+    NSMutableDictionary *MIMEToExtensionsDictionary = [NSMutableDictionary dictionary];
+    NSMutableDictionary *MIMEToDescriptionDictionary = [NSMutableDictionary dictionary];
 
     for(i=1; 1; i+=2){
         MIME = [self stringForStringListID:128 andIndex:i];
@@ -90,46 +89,42 @@ TransitionVector tVectorForFunctionPointer(FunctionPointer);
         extensionsList = [self stringForStringListID:128 andIndex:i+1];
         if(extensionsList){
             extensions = [extensionsList componentsSeparatedByString:@","];
-            
-            [MIMEToExtensions setObject:extensions forKey:MIME];
-            
-            // Reverse the mapping
-            NSEnumerator *enumerator = [extensions objectEnumerator];
-            while ((extension = [enumerator nextObject]) != nil) {
-                [extensionToMIME setObject:MIME forKey:extension];
-            }
+            [MIMEToExtensionsDictionary setObject:extensions forKey:MIME];
         }else{
             // DRM and WMP claim MIMEs without extensions. Use a @"" extension in this case.
-            [MIMEToExtensions setObject:[NSArray arrayWithObject:@""] forKey:MIME];
+            [MIMEToExtensionsDictionary setObject:[NSArray arrayWithObject:@""] forKey:MIME];
         }
         
-        description = [self stringForStringListID:127 andIndex:[MIMEToExtensions count]];
+        description = [self stringForStringListID:127 andIndex:[MIMEToExtensionsDictionary count]];
         if(description){
-            [MIMEToDescription setObject:description forKey:MIME];
+            [MIMEToDescriptionDictionary setObject:description forKey:MIME];
         }else{
-            [MIMEToDescription setObject:@"" forKey:MIME];
+            [MIMEToDescriptionDictionary setObject:@"" forKey:MIME];
         }
     }
+
+    [self setMIMEToDescriptionDictionary:MIMEToDescriptionDictionary];
+    [self setMIMEToExtensionsDictionary:MIMEToExtensionsDictionary];
     
-    pluginDescription = [self stringForStringListID:126 andIndex:1];
-    if(!pluginDescription){
-        pluginDescription = filename;
+    description = [self stringForStringListID:126 andIndex:1];
+    if(!description){
+        description = filename;
     }
+    [self setPluginDescription:description];
+    
     
-    name = [self stringForStringListID:126 andIndex:2];
-    if(!name){
-        name = filename;
+    NSString *theName = [self stringForStringListID:126 andIndex:2];
+    if(!theName){
+        theName = filename;
     }
-
-    [pluginDescription retain];
-    [name retain];
+    [self setName:theName];
     
     [self closeResourceFile:resRef];
     
     return YES;
 }
 
-- (NSString *)stringByResolvingSymlinksAndAliasesInPath:(NSString *)thePath
+- (NSString *)pathByResolvingSymlinksAndAliasesInPath:(NSString *)thePath
 {
     NSString *newPath = [thePath stringByResolvingSymlinksInPath];
 
@@ -161,11 +156,13 @@ TransitionVector tVectorForFunctionPointer(FunctionPointer);
 {
     [super initWithPath:pluginPath];
     
-    path = [self stringByResolvingSymlinksAndAliasesInPath:pluginPath];
-    filename = [path lastPathComponent];
+    NSString *thePath = [self pathByResolvingSymlinksAndAliasesInPath:pluginPath];
+    
+    [self setPath:thePath];
+    [self setFilename:[thePath lastPathComponent]];
     
-    NSFileManager *fileManager = [NSFileManager defaultManager];;
-    NSDictionary *fileInfo = [fileManager fileAttributesAtPath:path traverseLink:YES];
+    NSFileManager *fileManager = [NSFileManager defaultManager];
+    NSDictionary *fileInfo = [fileManager fileAttributesAtPath:thePath traverseLink:YES];
     UInt32 type;
 
     // single-file plug-in with resource fork
@@ -177,10 +174,7 @@ TransitionVector tVectorForFunctionPointer(FunctionPointer);
 #endif
     // bundle
     }else if([[fileInfo objectForKey:@"NSFileType"] isEqualToString:@"NSFileTypeDirectory"]){
-        CFURLRef pluginURL = CFURLCreateWithFileSystemPath(NULL, (CFStringRef)path, kCFURLPOSIXPathStyle, TRUE);
-        bundle = CFBundleCreate(NULL, pluginURL);
-        CFRelease(pluginURL);
-        
+        bundle = CFBundleCreate(NULL, (CFURLRef)[NSURL fileURLWithPath:thePath]);        
         CFBundleGetPackageInfo(bundle, &type, NULL);
 
         // Check if the executable is mach-o or CFM
@@ -189,6 +183,7 @@ TransitionVector tVectorForFunctionPointer(FunctionPointer);
         [executableURL release];
         
         NSData *data = [executableFile readDataOfLength:8];
+        [executableFile closeFile];
         if(!memcmp([data bytes], "Joy!peff", 8)){
             isCFM = TRUE;
 #ifndef __ppc__
@@ -197,7 +192,6 @@ TransitionVector tVectorForFunctionPointer(FunctionPointer);
         }else{
             isCFM = FALSE;
         }
-        [executableFile closeFile];
         
         isBundle = YES;
     }else{
@@ -211,13 +205,19 @@ TransitionVector tVectorForFunctionPointer(FunctionPointer);
     }else{
         return nil;
     }
-    
-    [filename retain];
-    [path retain];
 
     return self;
 }
 
+- (WebExecutableType)executableType
+{
+    if(isCFM){
+        return WebCFMExecutableType;
+    }else{
+        return WebMachOExecutableType;
+    }
+}
+
 - (BOOL)load
 {    
     getEntryPointsFuncPtr NP_GetEntryPoints = NULL;
diff --git a/WebKit/Plugins.subproj/WebPluginController.h b/WebKit/Plugins.subproj/WebPluginController.h
index 1f6aabd..dd218c8 100644
--- a/WebKit/Plugins.subproj/WebPluginController.h
+++ b/WebKit/Plugins.subproj/WebPluginController.h
@@ -25,4 +25,6 @@
 
 - (void)addPluginView:(NSView <WebPlugin> *)view;
 
+- (void)didAddSubview:(NSView <WebPlugin> *)view;
+
 @end
diff --git a/WebKit/Plugins.subproj/WebPluginController.m b/WebKit/Plugins.subproj/WebPluginController.m
index e49ade5..c696b49 100644
--- a/WebKit/Plugins.subproj/WebPluginController.m
+++ b/WebKit/Plugins.subproj/WebPluginController.m
@@ -42,6 +42,11 @@
     [view pluginInitialize];
 }
 
+- (void)didAddSubview:(NSView <WebPlugin> *)view
+{
+    [view pluginStart];
+}
+
 - (void)showURL:(NSURL *)URL inFrame:(NSString *)target
 {
     if(!URL || !target){
diff --git a/WebKit/Plugins.subproj/WebPluginDatabase.h b/WebKit/Plugins.subproj/WebPluginDatabase.h
index 427d920..0fb0e1b 100644
--- a/WebKit/Plugins.subproj/WebPluginDatabase.h
+++ b/WebKit/Plugins.subproj/WebPluginDatabase.h
@@ -13,9 +13,12 @@
 }
 
 + (WebPluginDatabase *)installedPlugins;
+
+// Plug-ins are returned in this order: New plug-in (WBPL), Mach-O Netscape, CFM Netscape
 - (WebBasePluginPackage *)pluginForMIMEType:(NSString *)mimeType;
 - (WebBasePluginPackage *)pluginForExtension:(NSString *)extension;
 - (WebBasePluginPackage *)pluginForFilename:(NSString *)filename;
+
 - (NSArray *)plugins;
 
 @end
diff --git a/WebKit/Plugins.subproj/WebPluginDatabase.m b/WebKit/Plugins.subproj/WebPluginDatabase.m
index 8514941..f1c8680 100644
--- a/WebKit/Plugins.subproj/WebPluginDatabase.m
+++ b/WebKit/Plugins.subproj/WebPluginDatabase.m
@@ -3,12 +3,15 @@
 	Copyright (c) 2002, Apple, Inc. All rights reserved.
 */
 
+
 #import <WebKit/WebBasePluginPackage.h>
 #import <WebKit/WebDataSource.h>
 #import <WebKit/WebKitLogging.h>
 #import <WebKit/WebNetscapePluginDocumentView.h>
-#import <WebKit/WebPluginDatabase.h>
+#import <WebKit/WebNetscapePluginPackage.h>
 #import <WebKit/WebNetscapePluginRepresentation.h>
+#import <WebKit/WebPluginDatabase.h>
+#import <WebKit/WebPluginPackage.h>
 #import <WebKit/WebView.h>
 #import <WebKit/WebViewPrivate.h>
 
@@ -25,33 +28,50 @@ static WebPluginDatabase *database = nil;
     return database;
 }
 
-// The first plugin with the specified mime type is returned.
-- (WebBasePluginPackage *)pluginForMIMEType:(NSString *)MIME
+- (WebBasePluginPackage *)pluginForKey:(NSString *)key withEnumeratorSelector:(SEL)enumeratorSelector
 {
-    WebBasePluginPackage *plugin;
+    WebBasePluginPackage *plugin, *CFMPlugin=nil, *machoPlugin=nil;
     uint i;
-    
-    for(i=0; i<[plugins count]; i++){      
+
+    for(i=0; i<[plugins count]; i++){
         plugin = [plugins objectAtIndex:i];
-        if([[plugin MIMEToExtensionsDictionary] objectForKey:MIME]){
-            return plugin;
+        if([[[plugin performSelector:enumeratorSelector] allObjects] containsObject:key]){
+            if([plugin isKindOfClass:[WebPluginPackage class]]){
+                // It's the new kind of plug-in. Return it immediately.
+                return plugin;
+            }else if([plugin isKindOfClass:[WebNetscapePluginPackage class]]){
+                WebExecutableType executableType = [(WebNetscapePluginPackage *)plugin executableType];
+
+                if(executableType == WebCFMExecutableType){
+                    CFMPlugin = plugin;
+                }else if(executableType == WebMachOExecutableType){
+                    machoPlugin = plugin;
+                }else{
+                    [NSException raise:NSInternalInconsistencyException
+                                format:@"Unknown executable type for plugin"];
+                }
+            }else{
+                [NSException raise:NSInternalInconsistencyException
+                            format:@"Unknown plugin class: %@", [plugin className]];
+            }
         }
     }
-    return nil;
+
+    if(machoPlugin){
+        return machoPlugin;
+    }else{
+        return CFMPlugin;
+    }
 }
 
-- (WebBasePluginPackage *)pluginForExtension:(NSString *)extension
+- (WebBasePluginPackage *)pluginForMIMEType:(NSString *)MIMEType
 {
-    WebBasePluginPackage *plugin;
-    uint i;
+    return [self pluginForKey:MIMEType withEnumeratorSelector:@selector(MIMETypeEnumerator)];
+}
 
-    for(i=0; i<[plugins count]; i++){
-        plugin = [plugins objectAtIndex:i];
-        if([[plugin extensionToMIMEDictionary] objectForKey:extension]){
-            return plugin;
-        }
-    }
-    return nil;
+- (WebBasePluginPackage *)pluginForExtension:(NSString *)extension
+{
+    return [self pluginForKey:extension withEnumeratorSelector:@selector(extensionEnumerator)];
 }
 
 - (WebBasePluginPackage *)pluginForFilename:(NSString *)filename
@@ -82,7 +102,7 @@ static WebPluginDatabase *database = nil;
     MIMETypes = [NSMutableSet set];
     for(i=0; i<[plugins count]; i++){
         plugin = [plugins objectAtIndex:i];
-        [MIMETypes addObjectsFromArray:[[plugin MIMEToDescriptionDictionary] allKeys]];
+        [MIMETypes addObjectsFromArray:[[plugin MIMETypeEnumerator] allObjects]];
     }
     return [MIMETypes allObjects];
 }
@@ -157,6 +177,7 @@ static NSArray *pluginLocations(void)
         
         // Don't override previously registered types.
         if(![viewTypes containsObject:mime]){
+            // FIXME: This won't work for the new plug-ins.
             [WebView registerViewClass:[WebNetscapePluginDocumentView class] forMIMEType:mime];
             [WebDataSource registerRepresentationClass:[WebNetscapePluginRepresentation class] forMIMEType:mime];
         }
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.m b/WebKit/WebCoreSupport.subproj/WebBridge.m
index 6cebc28..33e0d03 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.m
@@ -469,7 +469,7 @@
     } else {
         extension = [[URL path] pathExtension];
         pluginPackage = [[WebPluginDatabase installedPlugins] pluginForExtension:extension];
-        mimeType = [[pluginPackage extensionToMIMEDictionary] objectForKey:extension];
+        mimeType = [pluginPackage MIMETypeForExtension:extension];
     }
 
     if (pluginPackage) {
@@ -526,4 +526,10 @@
     }
 }
 
+
+- (void)didAddSubview:(NSView *)view
+{
+    [frame _didAddSubview:view];
+}
+
 @end
diff --git a/WebKit/WebView.subproj/WebFramePrivate.h b/WebKit/WebView.subproj/WebFramePrivate.h
index c8ac1b5..0f6e75c 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.h
+++ b/WebKit/WebView.subproj/WebFramePrivate.h
@@ -109,4 +109,6 @@ typedef enum {
 
 - (WebPluginController *)pluginController;
 
+- (void)_didAddSubview:(NSView *)view;
+
 @end
diff --git a/WebKit/WebView.subproj/WebFramePrivate.m b/WebKit/WebView.subproj/WebFramePrivate.m
index 7b8863d..27c5e19 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.m
+++ b/WebKit/WebView.subproj/WebFramePrivate.m
@@ -813,4 +813,11 @@ static const char * const stateNames[] = {
     return _private->pluginController;
 }
 
+- (void)_didAddSubview:(NSView *)view
+{
+    if([view conformsToProtocol:@protocol(WebPlugin)]){
+        [_private->pluginController didAddSubview:view];
+    }
+}
+
 @end

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list