| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 "webkit/glue/plugins/plugin_list.h" | 5 #include "webkit/glue/plugins/plugin_list.h" |
| 6 | 6 |
| 7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/mac_util.h" | 10 #include "base/mac_util.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 } | 78 } |
| 79 return false; | 79 return false; |
| 80 } | 80 } |
| 81 | 81 |
| 82 bool PluginList::ShouldLoadPlugin(const WebPluginInfo& info, | 82 bool PluginList::ShouldLoadPlugin(const WebPluginInfo& info, |
| 83 std::vector<WebPluginInfo>* plugins) { | 83 std::vector<WebPluginInfo>* plugins) { |
| 84 // Plugins that we know don't work at all. | 84 // Plugins that we know don't work at all. |
| 85 const char* blacklisted_plugin_mimes[] = { | 85 const char* blacklisted_plugin_mimes[] = { |
| 86 "application/x-director", // Crashes during initialization. | 86 "application/x-director", // Crashes during initialization. |
| 87 "application/x-googlegears", // Safari-specific. | 87 "application/x-googlegears", // Safari-specific. |
| 88 "application/x-id-quakelive", // Crashes on load. |
| 89 "application/x-vnd.movenetworks.qm", // Crashes on Snow Leopard. |
| 88 "application/vnd.o3d.auto", // Doesn't render, and having it | 90 "application/vnd.o3d.auto", // Doesn't render, and having it |
| 89 // detected can prevent fallbacks. | 91 // detected can prevent fallbacks. |
| 90 }; | 92 }; |
| 91 // In the case of plugins that share MIME types, we have to blacklist by name. | 93 // In the case of plugins that share MIME types, we have to blacklist by name. |
| 92 const char* blacklisted_plugin_names[] = { | 94 const char* blacklisted_plugin_names[] = { |
| 93 // Blacklisted for now since having it non-functional but trying to handle | 95 // Blacklisted for now since having it non-functional but trying to handle |
| 94 // PDFs is worse than not having it (PDF content would otherwise be | 96 // PDFs is worse than not having it (PDF content would otherwise be |
| 95 // downloaded or handled by QuickTime). | 97 // downloaded or handled by QuickTime). |
| 96 "PDF Browser Plugin", | 98 "PDF Browser Plugin", |
| 97 }; | 99 }; |
| 98 | 100 |
| 99 // Plugins that we know are working reasonably well. | 101 // Plugins that we know are working reasonably well. |
| 100 const char* whitelisted_plugin_mimes[] = { | 102 const char* whitelisted_plugin_mimes[] = { |
| 101 "application/googletalk", | 103 "application/googletalk", |
| 102 "application/x-picasa-detect", | 104 "application/x-picasa-detect", |
| 103 "application/x-shockwave-flash", | 105 "application/x-shockwave-flash", |
| 104 "application/x-silverlight", | 106 "application/x-silverlight", |
| 105 "application/x-webkit-test-netscape", | 107 "application/x-webkit-test-netscape", |
| 108 "video/quicktime", |
| 106 }; | 109 }; |
| 107 | 110 |
| 108 // Start with names. | 111 // Start with names. |
| 109 std::string plugin_name = WideToUTF8(info.name); | 112 std::string plugin_name = WideToUTF8(info.name); |
| 110 if (ArrayContainsString(blacklisted_plugin_names, | 113 if (ArrayContainsString(blacklisted_plugin_names, |
| 111 arraysize(blacklisted_plugin_names), plugin_name)) { | 114 arraysize(blacklisted_plugin_names), plugin_name)) { |
| 112 return false; | 115 return false; |
| 113 } | 116 } |
| 114 // Then check mime types. | 117 // Then check mime types. |
| 115 bool whitelisted = false; | 118 bool whitelisted = false; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 139 for (size_t i = 0; i < plugins->size(); ++i) { | 142 for (size_t i = 0; i < plugins->size(); ++i) { |
| 140 if ((*plugins)[i].path.BaseName() == info.path.BaseName()) { | 143 if ((*plugins)[i].path.BaseName() == info.path.BaseName()) { |
| 141 return false; // We already have a loaded plugin higher in the hierarchy. | 144 return false; // We already have a loaded plugin higher in the hierarchy. |
| 142 } | 145 } |
| 143 } | 146 } |
| 144 | 147 |
| 145 return true; | 148 return true; |
| 146 } | 149 } |
| 147 | 150 |
| 148 } // namespace NPAPI | 151 } // namespace NPAPI |
| OLD | NEW |