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 | |
jam
2011/01/19 20:22:09
this is not the case anymore, right?
pastarmovj
2011/01/19 23:39:17
Done.
| |
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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
300 // destructor will call the corresponding Remove in the "continue" case. | 312 // destructor will call the corresponding Remove in the "continue" case. |
301 AddLiveModule(path, module); | 313 AddLiveModule(path, module); |
302 if (!module->InitAsLibrary(path)) { | 314 if (!module->InitAsLibrary(path)) { |
303 DLOG(ERROR) << "Failed to load pepper module: " << path.value(); | 315 DLOG(ERROR) << "Failed to load pepper module: " << path.value(); |
304 continue; | 316 continue; |
305 } | 317 } |
306 module->set_name(plugins[i].name); | 318 module->set_name(plugins[i].name); |
307 preloaded_modules_[path] = module; | 319 preloaded_modules_[path] = module; |
308 } | 320 } |
309 } | 321 } |
OLD | NEW |