OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 // switch is only for development, it's OK for now. | 184 // switch is only for development, it's OK for now. |
185 std::vector<PepperPluginInfo> plugins; | 185 std::vector<PepperPluginInfo> plugins; |
186 GetList(&plugins); | 186 GetList(&plugins); |
187 for (size_t i = 0; i < plugins.size(); ++i) { | 187 for (size_t i = 0; i < plugins.size(); ++i) { |
188 if (path == plugins[i].path) | 188 if (path == plugins[i].path) |
189 return plugins[i].is_out_of_process; | 189 return plugins[i].is_out_of_process; |
190 } | 190 } |
191 return false; | 191 return false; |
192 } | 192 } |
193 | 193 |
194 pepper::PluginModule* PepperPluginRegistry::GetModule( | 194 webkit::plugins::ppapi::PluginModule* PepperPluginRegistry::GetModule( |
195 const FilePath& path) const { | 195 const FilePath& path) const { |
196 ModuleMap::const_iterator it = modules_.find(path); | 196 ModuleMap::const_iterator it = modules_.find(path); |
197 if (it == modules_.end()) | 197 if (it == modules_.end()) |
198 return NULL; | 198 return NULL; |
199 return it->second; | 199 return it->second; |
200 } | 200 } |
201 | 201 |
202 PepperPluginRegistry::~PepperPluginRegistry() {} | 202 PepperPluginRegistry::~PepperPluginRegistry() {} |
203 | 203 |
204 PepperPluginRegistry::PepperPluginRegistry() { | 204 PepperPluginRegistry::PepperPluginRegistry() { |
205 InternalPluginInfoList internal_plugin_info; | 205 InternalPluginInfoList internal_plugin_info; |
206 GetInternalPluginInfo(&internal_plugin_info); | 206 GetInternalPluginInfo(&internal_plugin_info); |
207 | 207 |
208 // Register modules for these suckers. | 208 // Register modules for these suckers. |
209 for (InternalPluginInfoList::const_iterator it = | 209 for (InternalPluginInfoList::const_iterator it = |
210 internal_plugin_info.begin(); | 210 internal_plugin_info.begin(); |
211 it != internal_plugin_info.end(); | 211 it != internal_plugin_info.end(); |
212 ++it) { | 212 ++it) { |
213 const FilePath& path = it->path; | 213 const FilePath& path = it->path; |
214 ModuleHandle module(new pepper::PluginModule); | 214 ModuleHandle module(new webkit::plugins::ppapi::PluginModule); |
215 if (!module->InitAsInternalPlugin(it->entry_points)) { | 215 if (!module->InitAsInternalPlugin(it->entry_points)) { |
216 DLOG(ERROR) << "Failed to load pepper module: " << path.value(); | 216 DLOG(ERROR) << "Failed to load pepper module: " << path.value(); |
217 continue; | 217 continue; |
218 } | 218 } |
219 module->set_name(it->name); | 219 module->set_name(it->name); |
220 modules_[path] = module; | 220 modules_[path] = module; |
221 } | 221 } |
222 | 222 |
223 // Add the modules specified on the command line last so that they can | 223 // Add the modules specified on the command line last so that they can |
224 // override the internal plugins. | 224 // override the internal plugins. |
225 std::vector<PepperPluginInfo> plugins; | 225 std::vector<PepperPluginInfo> plugins; |
226 GetPluginInfoFromSwitch(&plugins); | 226 GetPluginInfoFromSwitch(&plugins); |
227 GetExtraPlugins(&plugins); | 227 GetExtraPlugins(&plugins); |
228 for (size_t i = 0; i < plugins.size(); ++i) { | 228 for (size_t i = 0; i < plugins.size(); ++i) { |
229 if (plugins[i].is_out_of_process) | 229 if (plugins[i].is_out_of_process) |
230 continue; // Only preload in-process plugins. | 230 continue; // Only preload in-process plugins. |
231 | 231 |
232 const FilePath& path = plugins[i].path; | 232 const FilePath& path = plugins[i].path; |
233 ModuleHandle module(new pepper::PluginModule); | 233 ModuleHandle module(new webkit::plugins::ppapi::PluginModule); |
234 if (!module->InitAsLibrary(path)) { | 234 if (!module->InitAsLibrary(path)) { |
235 DLOG(ERROR) << "Failed to load pepper module: " << path.value(); | 235 DLOG(ERROR) << "Failed to load pepper module: " << path.value(); |
236 continue; | 236 continue; |
237 } | 237 } |
238 module->set_name(plugins[i].name); | 238 module->set_name(plugins[i].name); |
239 modules_[path] = module; | 239 modules_[path] = module; |
240 } | 240 } |
241 } | 241 } |
OLD | NEW |