| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "webkit/glue/plugins/plugin_lib.h" | 7 #include "webkit/glue/plugins/plugin_lib.h" |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/file_version_info.h" | 10 #include "base/file_version_info.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 // We can only have one PluginLib object per plugin as it controls the per | 38 // We can only have one PluginLib object per plugin as it controls the per |
| 39 // instance function calls (i.e. NP_Initialize and NP_Shutdown). So we keep | 39 // instance function calls (i.e. NP_Initialize and NP_Shutdown). So we keep |
| 40 // a (non-ref counted) map of PluginLib objects. | 40 // a (non-ref counted) map of PluginLib objects. |
| 41 if (!loaded_libs_) | 41 if (!loaded_libs_) |
| 42 loaded_libs_ = new PluginMap(); | 42 loaded_libs_ = new PluginMap(); |
| 43 | 43 |
| 44 PluginMap::const_iterator iter = loaded_libs_->find(filename); | 44 PluginMap::const_iterator iter = loaded_libs_->find(filename); |
| 45 if (iter != loaded_libs_->end()) | 45 if (iter != loaded_libs_->end()) |
| 46 return iter->second; | 46 return iter->second; |
| 47 | 47 |
| 48 static const InternalPluginInfo activex_shim_info = { | 48 static const InternalPluginInfo activex_shim_info_generic = { |
| 49 {kActiveXShimFileName, | 49 {kActiveXShimFileName, |
| 50 L"ActiveX Plug-in", | 50 L"ActiveX Plug-in", |
| 51 L"ActiveX Plug-in provides a shim to support ActiveX controls", | 51 L"ActiveX Plug-in provides a shim to support ActiveX controls", |
| 52 L"1, 0, 0, 1", | 52 L"1, 0, 0, 1", |
| 53 L"application/x-oleobject|application/oleobject|" | 53 L"application/x-oleobject|application/oleobject", |
| 54 L"application/x-ms-wmp|application/asx|video/x-ms-asf-plugin|" | 54 L"*|*", |
| 55 L"" |
| 56 }, |
| 57 activex_shim::ActiveX_Shim_NP_GetEntryPoints, |
| 58 activex_shim::ActiveX_Shim_NP_Initialize, |
| 59 activex_shim::ActiveX_Shim_NP_Shutdown |
| 60 }; |
| 61 |
| 62 static const InternalPluginInfo activex_shim_windows_media_player = { |
| 63 {kActivexShimFileNameForMediaPlayer, |
| 64 kActivexShimFileNameForMediaPlayer, |
| 65 L"Windows Media Player", |
| 66 L"1, 0, 0, 1", |
| 67 L"application/x-ms-wmp|application/asx|video/x-ms-asf-plugin|" |
| 55 L"application/x-mplayer2|video/x-ms-asf|video/x-ms-wm|audio/x-ms-wma|" | 68 L"application/x-mplayer2|video/x-ms-asf|video/x-ms-wm|audio/x-ms-wma|" |
| 56 L"audio/x-ms-wax|video/x-ms-wmv|video/x-ms-wvx", | 69 L"audio/x-ms-wax|video/x-ms-wmv|video/x-ms-wvx", |
| 57 L"*|*|*|*|*|*|asf,asx,*|wm,*|wma,*|wax,*|wmv,*|wvx,*", | 70 L"*|*|*|*|*|*|asf,asx,*|wm,*|wma,*|wax,*|wmv,*|wvx,*", |
| 58 L"" | 71 L"" |
| 59 }, | 72 }, |
| 60 activex_shim::ActiveX_Shim_NP_GetEntryPoints, | 73 activex_shim::ActiveX_Shim_NP_GetEntryPoints, |
| 61 activex_shim::ActiveX_Shim_NP_Initialize, | 74 activex_shim::ActiveX_Shim_NP_Initialize, |
| 62 activex_shim::ActiveX_Shim_NP_Shutdown | 75 activex_shim::ActiveX_Shim_NP_Shutdown |
| 63 }; | 76 }; |
| 64 | 77 |
| 65 static const InternalPluginInfo default_null_plugin_info = { | 78 static const InternalPluginInfo default_null_plugin_info = { |
| 66 {kDefaultPluginDllName, | 79 {kDefaultPluginDllName, |
| 67 L"Default Plug-in", | 80 L"Default Plug-in", |
| 68 L"Provides functionality for installing third-party plug-ins", | 81 L"Provides functionality for installing third-party plug-ins", |
| 69 L"1, 0, 0, 1", | 82 L"1, 0, 0, 1", |
| 70 L"*", | 83 L"*", |
| 71 L"", | 84 L"", |
| 72 L"" | 85 L"" |
| 73 }, | 86 }, |
| 74 default_plugin::NP_GetEntryPoints, | 87 default_plugin::NP_GetEntryPoints, |
| 75 default_plugin::NP_Initialize, | 88 default_plugin::NP_Initialize, |
| 76 default_plugin::NP_Shutdown | 89 default_plugin::NP_Shutdown |
| 77 }; | 90 }; |
| 78 | 91 |
| 79 WebPluginInfo* info = NULL; | 92 WebPluginInfo* info = NULL; |
| 80 const InternalPluginInfo* internal_plugin_info = NULL; | 93 const InternalPluginInfo* internal_plugin_info = NULL; |
| 81 if (filename == activex_shim_info.version_info.file_name) { | 94 if (filename == activex_shim_info_generic.version_info.file_name) { |
| 82 info = CreateWebPluginInfo(activex_shim_info.version_info); | 95 info = CreateWebPluginInfo(activex_shim_info_generic.version_info); |
| 83 internal_plugin_info = &activex_shim_info; | 96 internal_plugin_info = &activex_shim_info_generic; |
| 97 } else if (filename == |
| 98 activex_shim_windows_media_player.version_info.file_name) { |
| 99 info = CreateWebPluginInfo(activex_shim_windows_media_player.version_info); |
| 100 internal_plugin_info = &activex_shim_windows_media_player; |
| 84 } else if (filename == default_null_plugin_info.version_info.file_name) { | 101 } else if (filename == default_null_plugin_info.version_info.file_name) { |
| 85 info = CreateWebPluginInfo(default_null_plugin_info.version_info); | 102 info = CreateWebPluginInfo(default_null_plugin_info.version_info); |
| 86 internal_plugin_info = &default_null_plugin_info; | 103 internal_plugin_info = &default_null_plugin_info; |
| 87 } else { | 104 } else { |
| 88 info = ReadWebPluginInfo(filename); | 105 info = ReadWebPluginInfo(filename); |
| 89 if (!info) { | 106 if (!info) { |
| 90 DLOG(INFO) << "This file isn't a valid NPAPI plugin: " << filename; | 107 DLOG(INFO) << "This file isn't a valid NPAPI plugin: " << filename; |
| 91 return NULL; | 108 return NULL; |
| 92 } | 109 } |
| 93 } | 110 } |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 pvi.product_name = version_info->product_name(); | 418 pvi.product_name = version_info->product_name(); |
| 402 pvi.file_description = version_info->file_description(); | 419 pvi.file_description = version_info->file_description(); |
| 403 pvi.file_version = version_info->file_version(); | 420 pvi.file_version = version_info->file_version(); |
| 404 pvi.file_name = filename; | 421 pvi.file_name = filename; |
| 405 | 422 |
| 406 return CreateWebPluginInfo(pvi); | 423 return CreateWebPluginInfo(pvi); |
| 407 } | 424 } |
| 408 | 425 |
| 409 } // namespace NPAPI | 426 } // namespace NPAPI |
| 410 | 427 |
| OLD | NEW |