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 #include "chrome/common/pepper_plugin_registry.h" | 5 #include "chrome/common/pepper_plugin_registry.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/native_library.h" | 9 #include "base/native_library.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 #else | 114 #else |
115 plugin.path = FilePath(name_parts[0]); | 115 plugin.path = FilePath(name_parts[0]); |
116 #endif | 116 #endif |
117 if (name_parts.size() > 1) | 117 if (name_parts.size() > 1) |
118 plugin.name = name_parts[1]; | 118 plugin.name = name_parts[1]; |
119 if (name_parts.size() > 2) | 119 if (name_parts.size() > 2) |
120 plugin.type_descriptions = name_parts[2]; | 120 plugin.type_descriptions = name_parts[2]; |
121 for (size_t j = 1; j < parts.size(); ++j) | 121 for (size_t j = 1; j < parts.size(); ++j) |
122 plugin.mime_types.push_back(parts[j]); | 122 plugin.mime_types.push_back(parts[j]); |
123 | 123 |
| 124 // Empty description is not allowed so use the plugin base name if none is |
| 125 // provided. |
| 126 if (plugin.type_descriptions.length() == 0) { |
| 127 #if defined(OS_WIN) |
| 128 plugin.type_descriptions = |
| 129 UTF16ToUTF8(plugin.path.BaseName().RemoveExtension().value()); |
| 130 #else |
| 131 plugin.type_descriptions = |
| 132 plugin.path.BaseName().RemoveExtension().value(); |
| 133 #endif |
| 134 } |
| 135 |
124 plugins->push_back(plugin); | 136 plugins->push_back(plugin); |
125 } | 137 } |
126 } | 138 } |
127 | 139 |
128 // static | 140 // static |
129 void PepperPluginRegistry::GetExtraPlugins( | 141 void PepperPluginRegistry::GetExtraPlugins( |
130 std::vector<PepperPluginInfo>* plugins) { | 142 std::vector<PepperPluginInfo>* plugins) { |
131 // Once we're sandboxed, we can't know if the PDF plugin is | 143 // Once we're sandboxed, we can't know if the PDF plugin is |
132 // available or not; but (on Linux) this function is always called | 144 // available or not; but (on Linux) this function is always called |
133 // once before we're sandboxed. So the first time through test if | 145 // once before we're sandboxed. So the first time through test if |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 new webkit::ppapi::PluginModule(this)); | 310 new webkit::ppapi::PluginModule(this)); |
299 if (!module->InitAsLibrary(path)) { | 311 if (!module->InitAsLibrary(path)) { |
300 DLOG(ERROR) << "Failed to load pepper module: " << path.value(); | 312 DLOG(ERROR) << "Failed to load pepper module: " << path.value(); |
301 continue; | 313 continue; |
302 } | 314 } |
303 module->set_name(plugins[i].name); | 315 module->set_name(plugins[i].name); |
304 preloaded_modules_[path] = module; | 316 preloaded_modules_[path] = module; |
305 AddLiveModule(path, module); | 317 AddLiveModule(path, module); |
306 } | 318 } |
307 } | 319 } |
OLD | NEW |