| 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 // switch is only for development, it's OK for now. | 213 // switch is only for development, it's OK for now. |
| 214 std::vector<PepperPluginInfo> plugins; | 214 std::vector<PepperPluginInfo> plugins; |
| 215 GetList(&plugins); | 215 GetList(&plugins); |
| 216 for (size_t i = 0; i < plugins.size(); ++i) { | 216 for (size_t i = 0; i < plugins.size(); ++i) { |
| 217 if (path == plugins[i].path) | 217 if (path == plugins[i].path) |
| 218 return plugins[i].is_out_of_process; | 218 return plugins[i].is_out_of_process; |
| 219 } | 219 } |
| 220 return false; | 220 return false; |
| 221 } | 221 } |
| 222 | 222 |
| 223 pepper::PluginModule* PepperPluginRegistry::GetModule( | 223 webkit::ppapi::PluginModule* PepperPluginRegistry::GetModule( |
| 224 const FilePath& path) const { | 224 const FilePath& path) const { |
| 225 ModuleMap::const_iterator it = modules_.find(path); | 225 ModuleMap::const_iterator it = modules_.find(path); |
| 226 if (it == modules_.end()) | 226 if (it == modules_.end()) |
| 227 return NULL; | 227 return NULL; |
| 228 return it->second; | 228 return it->second; |
| 229 } | 229 } |
| 230 | 230 |
| 231 PepperPluginRegistry::~PepperPluginRegistry() {} | 231 PepperPluginRegistry::~PepperPluginRegistry() {} |
| 232 | 232 |
| 233 PepperPluginRegistry::PepperPluginRegistry() { | 233 PepperPluginRegistry::PepperPluginRegistry() { |
| 234 InternalPluginInfoList internal_plugin_info; | 234 InternalPluginInfoList internal_plugin_info; |
| 235 GetInternalPluginInfo(&internal_plugin_info); | 235 GetInternalPluginInfo(&internal_plugin_info); |
| 236 | 236 |
| 237 // Register modules for these suckers. | 237 // Register modules for these suckers. |
| 238 for (InternalPluginInfoList::const_iterator it = | 238 for (InternalPluginInfoList::const_iterator it = |
| 239 internal_plugin_info.begin(); | 239 internal_plugin_info.begin(); |
| 240 it != internal_plugin_info.end(); | 240 it != internal_plugin_info.end(); |
| 241 ++it) { | 241 ++it) { |
| 242 const FilePath& path = it->path; | 242 const FilePath& path = it->path; |
| 243 ModuleHandle module(new pepper::PluginModule); | 243 ModuleHandle module(new webkit::ppapi::PluginModule); |
| 244 if (!module->InitAsInternalPlugin(it->entry_points)) { | 244 if (!module->InitAsInternalPlugin(it->entry_points)) { |
| 245 DLOG(ERROR) << "Failed to load pepper module: " << path.value(); | 245 DLOG(ERROR) << "Failed to load pepper module: " << path.value(); |
| 246 continue; | 246 continue; |
| 247 } | 247 } |
| 248 module->set_name(it->name); | 248 module->set_name(it->name); |
| 249 modules_[path] = module; | 249 modules_[path] = module; |
| 250 } | 250 } |
| 251 | 251 |
| 252 // Add the modules specified on the command line last so that they can | 252 // Add the modules specified on the command line last so that they can |
| 253 // override the internal plugins. | 253 // override the internal plugins. |
| 254 std::vector<PepperPluginInfo> plugins; | 254 std::vector<PepperPluginInfo> plugins; |
| 255 GetPluginInfoFromSwitch(&plugins); | 255 GetPluginInfoFromSwitch(&plugins); |
| 256 GetExtraPlugins(&plugins); | 256 GetExtraPlugins(&plugins); |
| 257 for (size_t i = 0; i < plugins.size(); ++i) { | 257 for (size_t i = 0; i < plugins.size(); ++i) { |
| 258 if (plugins[i].is_out_of_process) | 258 if (plugins[i].is_out_of_process) |
| 259 continue; // Only preload in-process plugins. | 259 continue; // Only preload in-process plugins. |
| 260 | 260 |
| 261 const FilePath& path = plugins[i].path; | 261 const FilePath& path = plugins[i].path; |
| 262 ModuleHandle module(new pepper::PluginModule); | 262 ModuleHandle module(new webkit::ppapi::PluginModule); |
| 263 if (!module->InitAsLibrary(path)) { | 263 if (!module->InitAsLibrary(path)) { |
| 264 DLOG(ERROR) << "Failed to load pepper module: " << path.value(); | 264 DLOG(ERROR) << "Failed to load pepper module: " << path.value(); |
| 265 continue; | 265 continue; |
| 266 } | 266 } |
| 267 module->set_name(plugins[i].name); | 267 module->set_name(plugins[i].name); |
| 268 modules_[path] = module; | 268 modules_[path] = module; |
| 269 } | 269 } |
| 270 } | 270 } |
| OLD | NEW |