Changeset 61452 in webkit
- Timestamp:
- Jun 18, 2010 4:17:06 PM (14 years ago)
- Location:
- trunk/WebKit/mac
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/mac/ChangeLog
r61449 r61452 1 2010-06-18 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 Clean up WebPluginDatabase.mm 6 https://bugs.webkit.org/show_bug.cgi?id=40866 7 8 * Plugins/WebBasePluginPackage.h: 9 * Plugins/WebBasePluginPackage.mm: 10 (pathByResolvingSymlinksAndAliases): 11 (-[WebBasePluginPackage initWithPath:]): 12 Change an instance method into a static function. 13 14 * Plugins/WebPluginDatabase.mm: 15 (PluginPackageCandidates::PluginPackageCandidates): 16 (PluginPackageCandidates::update): 17 (PluginPackageCandidates::bestCandidate): 18 Add a new PluginPackageCandidates class. 19 20 (-[WebPluginDatabase pluginForKey:withEnumeratorSelector:]): 21 Use PluginPackageCandidates here. 22 1 23 2010-06-18 Anders Carlsson <andersca@apple.com> 2 24 -
trunk/WebKit/mac/Plugins/WebBasePluginPackage.h
r61444 r61452 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 29 #import <WebCore/WebCoreViewFactory.h>30 28 31 29 #if ENABLE(NETSCAPE_PLUGIN_API) -
trunk/WebKit/mac/Plugins/WebBasePluginPackage.mm
r61213 r61452 92 92 } 93 93 94 - (NSString *)pathByResolvingSymlinksAndAliasesInPath:(NSString *)thePath 94 static NSString *pathByResolvingSymlinksAndAliases(NSString *thePath) 95 95 { 96 96 NSString *newPath = [thePath stringByResolvingSymlinksInPath]; … … 123 123 return nil; 124 124 125 path = [ [self pathByResolvingSymlinksAndAliasesInPath:pluginPath] retain];125 path = [pathByResolvingSymlinksAndAliases(pluginPath) copy]; 126 126 bundle = [[NSBundle alloc] initWithPath:path]; 127 127 #ifndef __ppc__ -
trunk/WebKit/mac/Plugins/WebPluginDatabase.mm
r58917 r61452 87 87 } 88 88 89 struct PluginPackageCandidates { 90 PluginPackageCandidates() 91 : webPlugin(nil) 92 , machoPlugin(nil) 93 #ifdef SUPPORT_CFM 94 , CFMPlugin(nil) 95 #endif 96 { 97 } 98 99 void update(WebBasePluginPackage *plugin) 100 { 101 if ([plugin isKindOfClass:[WebPluginPackage class]]) { 102 checkCandidate(&webPlugin, &plugin); 103 return; 104 } 105 106 #if ENABLE(NETSCAPE_PLUGIN_API) 107 if([plugin isKindOfClass:[WebNetscapePluginPackage class]]) { 108 WebExecutableType executableType = [(WebNetscapePluginPackage *)plugin executableType]; 109 #ifdef SUPPORT_CFM 110 if (executableType == WebCFMExecutableType) { 111 checkCandidate(&CFMPlugin, &plugin); 112 return; 113 } 114 #endif // SUPPORT_CFM 115 if (executableType == WebMachOExecutableType) { 116 checkCandidate(&machoPlugin, &plugin); 117 return; 118 } 119 } 120 #endif 121 ASSERT_NOT_REACHED(); 122 } 123 124 WebBasePluginPackage *bestCandidate() 125 { 126 // Allow other plug-ins to win over QT because if the user has installed a plug-in that can handle a type 127 // that the QT plug-in can handle, they probably intended to override QT. 128 if (webPlugin && ![webPlugin isQuickTimePlugIn]) 129 return webPlugin; 130 131 if (machoPlugin && ![machoPlugin isQuickTimePlugIn]) 132 return machoPlugin; 133 134 #ifdef SUPPORT_CFM 135 if (CFMPlugin && ![CFMPlugin isQuickTimePlugIn]) 136 return CFMPlugin; 137 #endif // SUPPORT_CFM 138 139 if (webPlugin) 140 return webPlugin; 141 if (machoPlugin) 142 return machoPlugin; 143 #ifdef SUPPORT_CFM 144 if (CFMPlugin) 145 return CFMPlugin; 146 #endif 147 return nil; 148 } 149 150 WebBasePluginPackage *webPlugin; 151 WebBasePluginPackage *machoPlugin; 152 #ifdef SUPPORT_CFM 153 WebBasePluginPackage *CFMPlugin; 154 #endif 155 }; 156 89 157 - (WebBasePluginPackage *)pluginForKey:(NSString *)key withEnumeratorSelector:(SEL)enumeratorSelector 90 158 { 159 PluginPackageCandidates candidates; 91 160 WebBasePluginPackage *plugin = nil; 92 WebBasePluginPackage *webPlugin = nil; 93 #ifdef SUPPORT_CFM 94 WebBasePluginPackage *CFMPlugin = nil; 95 #endif 96 WebBasePluginPackage *machoPlugin = nil; 97 161 162 key = [key lowercaseString]; 98 163 NSEnumerator *pluginEnumerator = [plugins objectEnumerator]; 99 key = [key lowercaseString];100 164 101 165 while ((plugin = [pluginEnumerator nextObject]) != nil) { 102 if ([[[plugin performSelector:enumeratorSelector] allObjects] containsObject:key]) { 103 if ([plugin isKindOfClass:[WebPluginPackage class]]) 104 checkCandidate(&webPlugin, &plugin); 105 #if ENABLE(NETSCAPE_PLUGIN_API) 106 else if([plugin isKindOfClass:[WebNetscapePluginPackage class]]) { 107 WebExecutableType executableType = [(WebNetscapePluginPackage *)plugin executableType]; 108 #ifdef SUPPORT_CFM 109 if (executableType == WebCFMExecutableType) { 110 checkCandidate(&CFMPlugin, &plugin); 111 } else 112 #endif // SUPPORT_CFM 113 if (executableType == WebMachOExecutableType) { 114 checkCandidate(&machoPlugin, &plugin); 115 } else { 116 ASSERT_NOT_REACHED(); 117 } 118 } else { 119 ASSERT_NOT_REACHED(); 120 } 121 #endif 122 } 123 } 124 125 // Allow other plug-ins to win over QT because if the user has installed a plug-in that can handle a type 126 // that the QT plug-in can handle, they probably intended to override QT. 127 if (webPlugin && ![webPlugin isQuickTimePlugIn]) 128 return webPlugin; 129 130 else if (machoPlugin && ![machoPlugin isQuickTimePlugIn]) 131 return machoPlugin; 132 #ifdef SUPPORT_CFM 133 else if (CFMPlugin && ![CFMPlugin isQuickTimePlugIn]) 134 return CFMPlugin; 135 #endif // SUPPORT_CFM 136 else if (webPlugin) 137 return webPlugin; 138 else if (machoPlugin) 139 return machoPlugin; 140 #ifdef SUPPORT_CFM 141 else if (CFMPlugin) 142 return CFMPlugin; 143 #endif 144 return nil; 166 if ([[[plugin performSelector:enumeratorSelector] allObjects] containsObject:key]) 167 candidates.update(plugin); 168 } 169 170 return candidates.bestCandidate(); 145 171 } 146 172
Note: See TracChangeset
for help on using the changeset viewer.