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_version_info.h" | 9 #include "base/file_version_info.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "base/sys_string_conversions.h" | 12 #include "base/sys_string_conversions.h" |
13 #include "webkit/activex_shim/npp_impl.h" | 13 #include "webkit/activex_shim/npp_impl.h" |
14 #include "webkit/default_plugin/plugin_main.h" | 14 #include "webkit/default_plugin/plugin_main.h" |
15 #include "webkit/glue/plugins/plugin_constants_win.h" | 15 #include "webkit/glue/plugins/plugin_constants_win.h" |
16 #include "webkit/glue/plugins/plugin_list.h" | 16 #include "webkit/glue/plugins/plugin_list.h" |
17 | 17 |
| 18 #ifdef GEARS_STATIC_LIB |
| 19 // defined in gears/base/common/module.cc |
| 20 NPError API_CALL Gears_NP_GetEntryPoints(NPPluginFuncs* funcs); |
| 21 NPError API_CALL Gears_NP_Initialize(NPNetscapeFuncs* funcs); |
| 22 NPError API_CALL Gears_NP_Shutdown(void); |
| 23 #endif |
| 24 |
18 namespace NPAPI | 25 namespace NPAPI |
19 { | 26 { |
20 | 27 |
21 static const InternalPluginInfo g_internal_plugins[] = { | 28 static const InternalPluginInfo g_internal_plugins[] = { |
22 { | 29 { |
23 {FilePath(kActiveXShimFileName), | 30 {FilePath(kActiveXShimFileName), |
24 L"ActiveX Plug-in", | 31 L"ActiveX Plug-in", |
25 L"ActiveX Plug-in provides a shim to support ActiveX controls", | 32 L"ActiveX Plug-in provides a shim to support ActiveX controls", |
26 L"1, 0, 0, 1", | 33 L"1, 0, 0, 1", |
27 L"application/x-oleobject|application/oleobject", | 34 L"application/x-oleobject|application/oleobject", |
(...skipping 25 matching lines...) Expand all Loading... |
53 L"Provides functionality for installing third-party plug-ins", | 60 L"Provides functionality for installing third-party plug-ins", |
54 L"1, 0, 0, 1", | 61 L"1, 0, 0, 1", |
55 L"*", | 62 L"*", |
56 L"", | 63 L"", |
57 L"" | 64 L"" |
58 }, | 65 }, |
59 default_plugin::NP_GetEntryPoints, | 66 default_plugin::NP_GetEntryPoints, |
60 default_plugin::NP_Initialize, | 67 default_plugin::NP_Initialize, |
61 default_plugin::NP_Shutdown | 68 default_plugin::NP_Shutdown |
62 }, | 69 }, |
| 70 #ifdef GEARS_STATIC_LIB |
| 71 { |
| 72 {FilePath(kGearsPluginLibraryName), |
| 73 L"Gears", |
| 74 L"Statically linked Gears", |
| 75 L"1, 0, 0, 1", |
| 76 L"application/x-googlegears", |
| 77 L"", |
| 78 L"" |
| 79 }, |
| 80 Gears_NP_GetEntryPoints, |
| 81 Gears_NP_Initialize, |
| 82 Gears_NP_Shutdown |
| 83 }, |
| 84 #endif |
63 }; | 85 }; |
64 | 86 |
65 static const size_t g_internal_plugins_size = arraysize(g_internal_plugins); | 87 static const size_t g_internal_plugins_size = arraysize(g_internal_plugins); |
66 | 88 |
67 /* static */ | 89 /* static */ |
68 void PluginLib::GetInternalPlugins(const InternalPluginInfo** plugins, | 90 void PluginLib::GetInternalPlugins(const InternalPluginInfo** plugins, |
69 size_t* count) { | 91 size_t* count) { |
70 *plugins = g_internal_plugins; | 92 *plugins = g_internal_plugins; |
71 *count = g_internal_plugins_size; | 93 *count = g_internal_plugins_size; |
72 } | 94 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 // Creates WebPluginInfo structure based on read in or built in | 132 // Creates WebPluginInfo structure based on read in or built in |
111 // PluginVersionInfo. | 133 // PluginVersionInfo. |
112 bool CreateWebPluginInfo(const PluginVersionInfo& pvi, | 134 bool CreateWebPluginInfo(const PluginVersionInfo& pvi, |
113 WebPluginInfo* info) { | 135 WebPluginInfo* info) { |
114 std::vector<std::string> mime_types, file_extensions; | 136 std::vector<std::string> mime_types, file_extensions; |
115 std::vector<std::wstring> descriptions; | 137 std::vector<std::wstring> descriptions; |
116 SplitString(base::SysWideToNativeMB(pvi.mime_types), '|', &mime_types); | 138 SplitString(base::SysWideToNativeMB(pvi.mime_types), '|', &mime_types); |
117 SplitString(base::SysWideToNativeMB(pvi.file_extents), '|', &file_extensions); | 139 SplitString(base::SysWideToNativeMB(pvi.file_extents), '|', &file_extensions); |
118 SplitString(pvi.file_open_names, '|', &descriptions); | 140 SplitString(pvi.file_open_names, '|', &descriptions); |
119 | 141 |
| 142 info->mime_types.clear(); |
| 143 |
120 if (mime_types.empty()) | 144 if (mime_types.empty()) |
121 return false; | 145 return false; |
122 | 146 |
123 info->name = pvi.product_name; | 147 info->name = pvi.product_name; |
124 info->desc = pvi.file_description; | 148 info->desc = pvi.file_description; |
125 info->version = pvi.file_version; | 149 info->version = pvi.file_version; |
126 info->path = FilePath(pvi.path); | 150 info->path = FilePath(pvi.path); |
127 | 151 |
128 for (size_t i = 0; i < mime_types.size(); ++i) { | 152 for (size_t i = 0; i < mime_types.size(); ++i) { |
129 WebPluginMimeType mime_type; | 153 WebPluginMimeType mime_type; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 pvi.product_name = version_info->product_name(); | 200 pvi.product_name = version_info->product_name(); |
177 pvi.file_description = version_info->file_description(); | 201 pvi.file_description = version_info->file_description(); |
178 pvi.file_version = version_info->file_version(); | 202 pvi.file_version = version_info->file_version(); |
179 pvi.path = filename; | 203 pvi.path = filename; |
180 | 204 |
181 return CreateWebPluginInfo(pvi, info); | 205 return CreateWebPluginInfo(pvi, info); |
182 } | 206 } |
183 | 207 |
184 } // namespace NPAPI | 208 } // namespace NPAPI |
185 | 209 |
OLD | NEW |