| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import <Carbon/Carbon.h> | 5 #import <Carbon/Carbon.h> |
| 6 #import <CoreFoundation/CoreFoundation.h> | 6 #import <CoreFoundation/CoreFoundation.h> |
| 7 | 7 |
| 8 #include "webkit/plugins/npapi/plugin_lib.h" | 8 #include "webkit/plugins/npapi/plugin_lib.h" |
| 9 | 9 |
| 10 #include "base/mac/scoped_cftyperef.h" | 10 #include "base/mac/scoped_cftyperef.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 return [mime_file_dict objectForKey:@"WebPluginMIMETypes"]; | 69 return [mime_file_dict objectForKey:@"WebPluginMIMETypes"]; |
| 70 else | 70 else |
| 71 return nil; | 71 return nil; |
| 72 | 72 |
| 73 } else { | 73 } else { |
| 74 return (NSDictionary*)CFBundleGetValueForInfoDictionaryKey(bundle, | 74 return (NSDictionary*)CFBundleGetValueForInfoDictionaryKey(bundle, |
| 75 CFSTR("WebPluginMIMETypes")); | 75 CFSTR("WebPluginMIMETypes")); |
| 76 } | 76 } |
| 77 } | 77 } |
| 78 | 78 |
| 79 bool ReadPlistPluginInfo(const FilePath& filename, CFBundleRef bundle, | 79 bool ReadPlistPluginInfo(const base::FilePath& filename, CFBundleRef bundle, |
| 80 WebPluginInfo* info) { | 80 WebPluginInfo* info) { |
| 81 NSDictionary* mime_types = GetMIMETypes(bundle); | 81 NSDictionary* mime_types = GetMIMETypes(bundle); |
| 82 if (!mime_types) | 82 if (!mime_types) |
| 83 return false; // no type info here; try elsewhere | 83 return false; // no type info here; try elsewhere |
| 84 | 84 |
| 85 for (NSString* mime_type in [mime_types allKeys]) { | 85 for (NSString* mime_type in [mime_types allKeys]) { |
| 86 NSDictionary* mime_dict = [mime_types objectForKey:mime_type]; | 86 NSDictionary* mime_dict = [mime_types objectForKey:mime_type]; |
| 87 NSNumber* type_enabled = [mime_dict objectForKey:@"WebPluginTypeEnabled"]; | 87 NSNumber* type_enabled = [mime_dict objectForKey:@"WebPluginTypeEnabled"]; |
| 88 NSString* mime_desc = [mime_dict objectForKey:@"WebPluginTypeDescription"]; | 88 NSString* mime_desc = [mime_dict objectForKey:@"WebPluginTypeDescription"]; |
| 89 NSArray* mime_exts = [mime_dict objectForKey:@"WebPluginExtensions"]; | 89 NSArray* mime_exts = [mime_dict objectForKey:@"WebPluginExtensions"]; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 if (plugin_desc) | 130 if (plugin_desc) |
| 131 info->desc = base::SysNSStringToUTF16(plugin_desc); | 131 info->desc = base::SysNSStringToUTF16(plugin_desc); |
| 132 else | 132 else |
| 133 info->desc = UTF8ToUTF16(filename.BaseName().value()); | 133 info->desc = UTF8ToUTF16(filename.BaseName().value()); |
| 134 | 134 |
| 135 return true; | 135 return true; |
| 136 } | 136 } |
| 137 | 137 |
| 138 } // anonymous namespace | 138 } // anonymous namespace |
| 139 | 139 |
| 140 bool PluginLib::ReadWebPluginInfo(const FilePath &filename, | 140 bool PluginLib::ReadWebPluginInfo(const base::FilePath &filename, |
| 141 WebPluginInfo* info) { | 141 WebPluginInfo* info) { |
| 142 // There are three ways to get information about plugin capabilities: | 142 // There are three ways to get information about plugin capabilities: |
| 143 // 1) a set of Info.plist keys, documented at | 143 // 1) a set of Info.plist keys, documented at |
| 144 // http://developer.apple.com/documentation/InternetWeb/Conceptual/WebKit_Plug
inProgTopic/Concepts/AboutPlugins.html . | 144 // http://developer.apple.com/documentation/InternetWeb/Conceptual/WebKit_Plug
inProgTopic/Concepts/AboutPlugins.html . |
| 145 // 2) a set of STR# resources, documented at | 145 // 2) a set of STR# resources, documented at |
| 146 // https://developer.mozilla.org/En/Gecko_Plugin_API_Reference/Plug-in_Develop
ment_Overview . | 146 // https://developer.mozilla.org/En/Gecko_Plugin_API_Reference/Plug-in_Develop
ment_Overview . |
| 147 // 3) a NP_GetMIMEDescription() entry point, documented at | 147 // 3) a NP_GetMIMEDescription() entry point, documented at |
| 148 // https://developer.mozilla.org/en/NP_GetMIMEDescription | 148 // https://developer.mozilla.org/en/NP_GetMIMEDescription |
| 149 // | 149 // |
| 150 // Mozilla supported (3), but WebKit never has, so no plugins rely on it. Most | 150 // Mozilla supported (3), but WebKit never has, so no plugins rely on it. Most |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 if (ReadPlistPluginInfo(filename, bundle.get(), info)) | 220 if (ReadPlistPluginInfo(filename, bundle.get(), info)) |
| 221 return true; | 221 return true; |
| 222 | 222 |
| 223 // ... or not | 223 // ... or not |
| 224 | 224 |
| 225 return false; | 225 return false; |
| 226 } | 226 } |
| 227 | 227 |
| 228 } // namespace npapi | 228 } // namespace npapi |
| 229 } // namespace webkit | 229 } // namespace webkit |
| OLD | NEW |