| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "content/common/plugin_list.h" | 5 #include "content/common/plugin_list.h" |
| 6 | 6 |
| 7 #import <Carbon/Carbon.h> | 7 #import <Carbon/Carbon.h> |
| 8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
| 9 | 9 |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // MIME types. | 49 // MIME types. |
| 50 for (std::vector<WebPluginMimeType>::const_iterator i = | 50 for (std::vector<WebPluginMimeType>::const_iterator i = |
| 51 info.mime_types.begin(); i != info.mime_types.end(); ++i) { | 51 info.mime_types.begin(); i != info.mime_types.end(); ++i) { |
| 52 // The Gears plugin is Safari-specific, so don't load it. | 52 // The Gears plugin is Safari-specific, so don't load it. |
| 53 if (i->mime_type == "application/x-googlegears") | 53 if (i->mime_type == "application/x-googlegears") |
| 54 return true; | 54 return true; |
| 55 } | 55 } |
| 56 | 56 |
| 57 // Versions of Flip4Mac 2.3 before 2.3.6 often hang the renderer, so don't | 57 // Versions of Flip4Mac 2.3 before 2.3.6 often hang the renderer, so don't |
| 58 // load them. | 58 // load them. |
| 59 if (StartsWith(info.name, ASCIIToUTF16("Flip4Mac Windows Media"), false) && | 59 if (StartsWith(info.name, |
| 60 StartsWith(info.version, ASCIIToUTF16("2.3"), false)) { | 60 base::ASCIIToUTF16("Flip4Mac Windows Media"), false) && |
| 61 StartsWith(info.version, base::ASCIIToUTF16("2.3"), false)) { |
| 61 std::vector<base::string16> components; | 62 std::vector<base::string16> components; |
| 62 base::SplitString(info.version, '.', &components); | 63 base::SplitString(info.version, '.', &components); |
| 63 int bugfix_version = 0; | 64 int bugfix_version = 0; |
| 64 return (components.size() >= 3 && | 65 return (components.size() >= 3 && |
| 65 base::StringToInt(components[2], &bugfix_version) && | 66 base::StringToInt(components[2], &bugfix_version) && |
| 66 bugfix_version < 6); | 67 bugfix_version < 6); |
| 67 } | 68 } |
| 68 | 69 |
| 69 return false; | 70 return false; |
| 70 } | 71 } |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 NSString* plugin_vers = | 163 NSString* plugin_vers = |
| 163 (NSString*)CFBundleGetValueForInfoDictionaryKey(bundle, | 164 (NSString*)CFBundleGetValueForInfoDictionaryKey(bundle, |
| 164 CFSTR("CFBundleShortVersionString")); | 165 CFSTR("CFBundleShortVersionString")); |
| 165 NSString* plugin_desc = | 166 NSString* plugin_desc = |
| 166 (NSString*)CFBundleGetValueForInfoDictionaryKey(bundle, | 167 (NSString*)CFBundleGetValueForInfoDictionaryKey(bundle, |
| 167 CFSTR("WebPluginDescription")); | 168 CFSTR("WebPluginDescription")); |
| 168 | 169 |
| 169 if (plugin_name) | 170 if (plugin_name) |
| 170 info->name = base::SysNSStringToUTF16(plugin_name); | 171 info->name = base::SysNSStringToUTF16(plugin_name); |
| 171 else | 172 else |
| 172 info->name = UTF8ToUTF16(filename.BaseName().value()); | 173 info->name = base::UTF8ToUTF16(filename.BaseName().value()); |
| 173 info->path = filename; | 174 info->path = filename; |
| 174 if (plugin_vers) | 175 if (plugin_vers) |
| 175 info->version = base::SysNSStringToUTF16(plugin_vers); | 176 info->version = base::SysNSStringToUTF16(plugin_vers); |
| 176 if (plugin_desc) | 177 if (plugin_desc) |
| 177 info->desc = base::SysNSStringToUTF16(plugin_desc); | 178 info->desc = base::SysNSStringToUTF16(plugin_desc); |
| 178 else | 179 else |
| 179 info->desc = UTF8ToUTF16(filename.BaseName().value()); | 180 info->desc = base::UTF8ToUTF16(filename.BaseName().value()); |
| 180 | 181 |
| 181 return true; | 182 return true; |
| 182 } | 183 } |
| 183 | 184 |
| 184 } // namespace | 185 } // namespace |
| 185 | 186 |
| 186 bool PluginList::ReadWebPluginInfo(const base::FilePath &filename, | 187 bool PluginList::ReadWebPluginInfo(const base::FilePath &filename, |
| 187 WebPluginInfo* info) { | 188 WebPluginInfo* info) { |
| 188 // There are three ways to get information about plugin capabilities: | 189 // There are three ways to get information about plugin capabilities: |
| 189 // 1) a set of Info.plist keys, documented at | 190 // 1) a set of Info.plist keys, documented at |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 } | 295 } |
| 295 } | 296 } |
| 296 | 297 |
| 297 bool PluginList::ShouldLoadPluginUsingPluginList( | 298 bool PluginList::ShouldLoadPluginUsingPluginList( |
| 298 const WebPluginInfo& info, | 299 const WebPluginInfo& info, |
| 299 std::vector<WebPluginInfo>* plugins) { | 300 std::vector<WebPluginInfo>* plugins) { |
| 300 return !IsBlacklistedPlugin(info); | 301 return !IsBlacklistedPlugin(info); |
| 301 } | 302 } |
| 302 | 303 |
| 303 } // namespace content | 304 } // namespace content |
| OLD | NEW |