OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/pepper/plugin_module.h" | 5 #include "content/renderer/pepper/plugin_module.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 RendererPpapiHostImpl* host_impl = | 388 RendererPpapiHostImpl* host_impl = |
389 RendererPpapiHostImpl::CreateOnModuleForInProcess(module, perms); | 389 RendererPpapiHostImpl::CreateOnModuleForInProcess(module, perms); |
390 render_frame->PepperPluginCreated(host_impl); | 390 render_frame->PepperPluginCreated(host_impl); |
391 } | 391 } |
392 | 392 |
393 } // namespace | 393 } // namespace |
394 | 394 |
395 // PluginModule ---------------------------------------------------------------- | 395 // PluginModule ---------------------------------------------------------------- |
396 | 396 |
397 PluginModule::PluginModule(const std::string& name, | 397 PluginModule::PluginModule(const std::string& name, |
| 398 const std::string& version, |
398 const base::FilePath& path, | 399 const base::FilePath& path, |
399 const ppapi::PpapiPermissions& perms) | 400 const ppapi::PpapiPermissions& perms) |
400 : callback_tracker_(new ppapi::CallbackTracker), | 401 : callback_tracker_(new ppapi::CallbackTracker), |
401 is_in_destructor_(false), | 402 is_in_destructor_(false), |
402 is_crashed_(false), | 403 is_crashed_(false), |
403 broker_(NULL), | 404 broker_(NULL), |
404 library_(NULL), | 405 library_(NULL), |
405 name_(name), | 406 name_(name), |
| 407 version_(version), |
406 path_(path), | 408 path_(path), |
407 permissions_(ppapi::PpapiPermissions::GetForCommandLine(perms.GetBits())), | 409 permissions_(ppapi::PpapiPermissions::GetForCommandLine(perms.GetBits())), |
408 reserve_instance_id_(NULL) { | 410 reserve_instance_id_(NULL) { |
409 // Ensure the globals object is created. | 411 // Ensure the globals object is created. |
410 if (!host_globals) | 412 if (!host_globals) |
411 host_globals = new HostGlobals; | 413 host_globals = new HostGlobals; |
412 | 414 |
413 memset(&entry_points_, 0, sizeof(entry_points_)); | 415 memset(&entry_points_, 0, sizeof(entry_points_)); |
414 pp_module_ = HostGlobals::Get()->AddModule(this); | 416 pp_module_ = HostGlobals::Get()->AddModule(this); |
415 GetLivePluginSet()->insert(this); | 417 GetLivePluginSet()->insert(this); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 HostDispatcherWrapper* host_dispatcher_wrapper) { | 490 HostDispatcherWrapper* host_dispatcher_wrapper) { |
489 DCHECK(!host_dispatcher_wrapper_.get()); | 491 DCHECK(!host_dispatcher_wrapper_.get()); |
490 host_dispatcher_wrapper_.reset(host_dispatcher_wrapper); | 492 host_dispatcher_wrapper_.reset(host_dispatcher_wrapper); |
491 } | 493 } |
492 | 494 |
493 scoped_refptr<PluginModule> | 495 scoped_refptr<PluginModule> |
494 PluginModule::CreateModuleForExternalPluginInstance() { | 496 PluginModule::CreateModuleForExternalPluginInstance() { |
495 // Create a new module, but don't set the lifetime delegate. This isn't a | 497 // Create a new module, but don't set the lifetime delegate. This isn't a |
496 // plugin in the usual sense, so it isn't tracked by the browser. | 498 // plugin in the usual sense, so it isn't tracked by the browser. |
497 scoped_refptr<PluginModule> external_plugin_module( | 499 scoped_refptr<PluginModule> external_plugin_module( |
498 new PluginModule(name_, path_, permissions_)); | 500 new PluginModule(name_, version_, path_, permissions_)); |
499 return external_plugin_module; | 501 return external_plugin_module; |
500 } | 502 } |
501 | 503 |
502 PP_ExternalPluginResult PluginModule::InitAsProxiedExternalPlugin( | 504 PP_ExternalPluginResult PluginModule::InitAsProxiedExternalPlugin( |
503 PepperPluginInstanceImpl* instance) { | 505 PepperPluginInstanceImpl* instance) { |
504 DCHECK(host_dispatcher_wrapper_.get()); | 506 DCHECK(host_dispatcher_wrapper_.get()); |
505 // InitAsProxied (for the trusted/out-of-process case) initializes only the | 507 // InitAsProxied (for the trusted/out-of-process case) initializes only the |
506 // module, and one or more instances are added later. In this case, the | 508 // module, and one or more instances are added later. In this case, the |
507 // PluginInstance was already created as in-process, so we missed the proxy | 509 // PluginInstance was already created as in-process, so we missed the proxy |
508 // AddInstance step and must do it now. | 510 // AddInstance step and must do it now. |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 path, &channel_handle, &peer_pid, &plugin_child_id)); | 704 path, &channel_handle, &peer_pid, &plugin_child_id)); |
703 if (channel_handle.name.empty()) { | 705 if (channel_handle.name.empty()) { |
704 // Couldn't be initialized. | 706 // Couldn't be initialized. |
705 return scoped_refptr<PluginModule>(); | 707 return scoped_refptr<PluginModule>(); |
706 } | 708 } |
707 | 709 |
708 ppapi::PpapiPermissions permissions(info->permissions); | 710 ppapi::PpapiPermissions permissions(info->permissions); |
709 | 711 |
710 // AddLiveModule must be called before any early returns since the | 712 // AddLiveModule must be called before any early returns since the |
711 // module's destructor will remove itself. | 713 // module's destructor will remove itself. |
712 module = new PluginModule(info->name, path, permissions); | 714 module = new PluginModule(info->name, info->version, path, permissions); |
713 PepperPluginRegistry::GetInstance()->AddLiveModule(path, module.get()); | 715 PepperPluginRegistry::GetInstance()->AddLiveModule(path, module.get()); |
714 | 716 |
715 if (!module->CreateOutOfProcessModule(render_frame, | 717 if (!module->CreateOutOfProcessModule(render_frame, |
716 path, | 718 path, |
717 permissions, | 719 permissions, |
718 channel_handle, | 720 channel_handle, |
719 peer_pid, | 721 peer_pid, |
720 plugin_child_id, | 722 plugin_child_id, |
721 false)) // is_external = false | 723 false)) // is_external = false |
722 return scoped_refptr<PluginModule>(); | 724 return scoped_refptr<PluginModule>(); |
723 | 725 |
724 return module; | 726 return module; |
725 } | 727 } |
726 | 728 |
727 } // namespace content | 729 } // namespace content |
OLD | NEW |