Changeset 61454 in webkit
- Timestamp:
- Jun 18, 2010 4:51:31 PM (14 years ago)
- Location:
- trunk/WebKit/mac
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/mac/ChangeLog
r61453 r61454 1 2010-06-18 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 Get rid of the NSEnumerators from WebBasePluginPackage 6 https://bugs.webkit.org/show_bug.cgi?id=40868 7 8 * Plugins/WebBasePluginPackage.h: 9 * Plugins/WebBasePluginPackage.mm: 10 (-[WebBasePluginPackage MIMETypes]): 11 (-[WebBasePluginPackage supportsExtension:]): 12 (-[WebBasePluginPackage supportsMIMEType:]): 13 * Plugins/WebPluginDatabase.mm: 14 (-[WebPluginDatabase pluginForMIMEType:]): 15 (-[WebPluginDatabase pluginForExtension:]): 16 (-[WebPluginDatabase refresh]): 17 (-[WebPluginDatabase _removePlugin:]): 18 * WebCoreSupport/WebPlatformStrategies.mm: 19 (WebPlatformStrategies::getPluginInfo): 20 1 21 2010-06-18 Anders Carlsson <andersca@apple.com> 2 22 -
trunk/WebKit/mac/Plugins/WebBasePluginPackage.h
r61452 r61454 83 83 - (NSBundle *)bundle; 84 84 85 - (NSEnumerator *)extensionEnumerator; 86 - (NSEnumerator *)MIMETypeEnumerator; 85 - (BOOL)supportsExtension:(NSString *)extension; 86 - (BOOL)supportsMIMEType:(NSString *)MIMEType; 87 88 - (NSArray *)MIMETypes; 89 87 90 - (NSString *)descriptionForMIMEType:(NSString *)MIMEType; 88 91 - (NSString *)MIMETypeForExtension:(NSString *)extension; -
trunk/WebKit/mac/Plugins/WebBasePluginPackage.mm
r61452 r61454 304 304 } 305 305 306 - (NSEnumerator *)extensionEnumerator 307 { 308 return [extensionToMIME keyEnumerator]; 309 } 310 311 - (NSEnumerator *)MIMETypeEnumerator 312 { 313 return [MIMEToExtensions keyEnumerator]; 306 - (NSArray *)MIMETypes 307 { 308 return [MIMEToExtensions allKeys]; 309 } 310 311 - (BOOL)supportsExtension:(NSString *)extension 312 { 313 return [extensionToMIME objectForKey:extension] != 0; 314 } 315 316 - (BOOL)supportsMIMEType:(NSString *)MIMEType 317 { 318 return [MIMEToExtensions objectForKey:MIMEType] != 0; 314 319 } 315 320 -
trunk/WebKit/mac/Plugins/WebPluginDatabase.mm
r61452 r61454 155 155 }; 156 156 157 - (WebBasePluginPackage *)pluginFor Key:(NSString *)key withEnumeratorSelector:(SEL)enumeratorSelector157 - (WebBasePluginPackage *)pluginForMIMEType:(NSString *)MIMEType 158 158 { 159 159 PluginPackageCandidates candidates; 160 WebBasePluginPackage *plugin = nil; 161 162 key = [key lowercaseString]; 160 161 MIMEType = [MIMEType lowercaseString]; 163 162 NSEnumerator *pluginEnumerator = [plugins objectEnumerator]; 164 165 while ( (plugin = [pluginEnumerator nextObject]) != nil) {166 if ([ [[plugin performSelector:enumeratorSelector] allObjects] containsObject:key])163 164 while (WebBasePluginPackage *plugin = [pluginEnumerator nextObject]) { 165 if ([plugin supportsMIMEType:MIMEType]) 167 166 candidates.update(plugin); 168 167 } 169 168 170 169 return candidates.bestCandidate(); 171 170 } 172 171 173 - (WebBasePluginPackage *)pluginForMIMEType:(NSString *)MIMEType174 {175 return [self pluginForKey:[MIMEType lowercaseString]176 withEnumeratorSelector:@selector(MIMETypeEnumerator)];177 }178 179 172 - (WebBasePluginPackage *)pluginForExtension:(NSString *)extension 180 173 { 181 WebBasePluginPackage *plugin = [self pluginForKey:[extension lowercaseString] 182 withEnumeratorSelector:@selector(extensionEnumerator)]; 174 PluginPackageCandidates candidates; 175 176 extension = [extension lowercaseString]; 177 NSEnumerator *pluginEnumerator = [plugins objectEnumerator]; 178 179 while (WebBasePluginPackage *plugin = [pluginEnumerator nextObject]) { 180 if ([plugin supportsExtension:extension]) 181 candidates.update(plugin); 182 } 183 184 WebBasePluginPackage *plugin = candidates.bestCandidate(); 185 183 186 if (!plugin) { 184 187 // If no plug-in was found from the extension, attempt to map from the extension to a MIME type … … 303 306 pluginEnumerator = [plugins objectEnumerator]; 304 307 while ((plugin = [pluginEnumerator nextObject]) != nil) 305 [MIMETypes addObjectsFromArray:[ [plugin MIMETypeEnumerator] allObjects]];308 [MIMETypes addObjectsFromArray:[plugin MIMETypes]]; 306 309 307 310 // Register plug-in views and representations. … … 437 440 438 441 // Unregister plug-in's MIME type registrations 439 NSEnumerator *MIMETypeEnumerator = [plugin MIMETypeEnumerator]; 440 NSString *MIMEType; 441 while ((MIMEType = [MIMETypeEnumerator nextObject])) { 442 NSArray *MIMETypes = [plugin MIMETypes]; 443 for (NSUInteger i = 0; i < [MIMETypes count]; ++i) { 444 NSString *MIMEType = [MIMETypes objectAtIndex:i]; 445 442 446 if ([registeredMIMETypes containsObject:MIMEType]) { 443 447 if (self == sharedDatabase) -
trunk/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm
r61449 r61454 32 32 33 33 #ifdef BUILDING_ON_TIGER 34 -typedef unsigned NSUInteger;34 typedef unsigned NSUInteger; 35 35 #endif 36 36 … … 73 73 pluginInfo.desc = [plugin pluginDescription]; 74 74 75 NS Enumerator* MIMETypeEnumerator = [plugin MIMETypeEnumerator];76 while (NSString* MIME = [MIMETypeEnumerator nextObject]) {77 MimeClassInfo mime;75 NSArray *MIMETypes = [plugin MIMETypes]; 76 for (NSUInteger i = 0; i < [MIMETypes count]; ++i) { 77 NSString *MIMEType = [MIMETypes objectAtIndex:i]; 78 78 79 mime.type = String(MIME).lower(); 79 MimeClassInfo mimeClassInfo; 80 81 mimeClassInfo.type = String(MIMEType).lower(); 80 82 81 NSArray *extensions = [plugin extensionsForMIMEType:MIME ];83 NSArray *extensions = [plugin extensionsForMIMEType:MIMEType]; 82 84 for (NSUInteger i = 0; i < [extensions count]; ++i) { 83 85 NSString *extension = [extensions objectAtIndex:i]; 84 mime .extensions.append(extension);86 mimeClassInfo.extensions.append(extension); 85 87 } 86 88 87 mime .desc = [plugin descriptionForMIMEType:MIME];89 mimeClassInfo.desc = [plugin descriptionForMIMEType:MIMEType]; 88 90 89 pluginInfo.mimes.append(mime );91 pluginInfo.mimes.append(mimeClassInfo); 90 92 } 91 93
Note: See TracChangeset
for help on using the changeset viewer.