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 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 if (!info) { | 684 if (!info) { |
685 *pepper_plugin_was_registered = false; | 685 *pepper_plugin_was_registered = false; |
686 return scoped_refptr<PluginModule>(); | 686 return scoped_refptr<PluginModule>(); |
687 } else if (!info->is_out_of_process) { | 687 } else if (!info->is_out_of_process) { |
688 // In-process plugin not preloaded, it probably couldn't be initialized. | 688 // In-process plugin not preloaded, it probably couldn't be initialized. |
689 return scoped_refptr<PluginModule>(); | 689 return scoped_refptr<PluginModule>(); |
690 } | 690 } |
691 | 691 |
692 // Out of process: have the browser start the plugin process for us. | 692 // Out of process: have the browser start the plugin process for us. |
693 IPC::ChannelHandle channel_handle; | 693 IPC::ChannelHandle channel_handle; |
694 base::ProcessId peer_pid; | 694 base::ProcessId peer_pid = 0; |
695 int plugin_child_id = 0; | 695 int plugin_child_id = 0; |
696 render_frame->Send(new ViewHostMsg_OpenChannelToPepperPlugin( | 696 render_frame->Send(new ViewHostMsg_OpenChannelToPepperPlugin( |
697 path, &channel_handle, &peer_pid, &plugin_child_id)); | 697 path, &channel_handle, &peer_pid, &plugin_child_id)); |
698 if (channel_handle.name.empty()) { | 698 if (channel_handle.name.empty()) { |
699 // Couldn't be initialized. | 699 // Couldn't be initialized. |
700 return scoped_refptr<PluginModule>(); | 700 return scoped_refptr<PluginModule>(); |
701 } | 701 } |
702 | 702 |
703 ppapi::PpapiPermissions permissions(info->permissions); | 703 ppapi::PpapiPermissions permissions(info->permissions); |
704 | 704 |
705 // AddLiveModule must be called before any early returns since the | 705 // AddLiveModule must be called before any early returns since the |
706 // module's destructor will remove itself. | 706 // module's destructor will remove itself. |
707 module = new PluginModule(info->name, path, permissions); | 707 module = new PluginModule(info->name, path, permissions); |
708 PepperPluginRegistry::GetInstance()->AddLiveModule(path, module.get()); | 708 PepperPluginRegistry::GetInstance()->AddLiveModule(path, module.get()); |
709 | 709 |
710 if (!module->CreateOutOfProcessModule(render_frame, | 710 if (!module->CreateOutOfProcessModule(render_frame, |
711 path, | 711 path, |
712 permissions, | 712 permissions, |
713 channel_handle, | 713 channel_handle, |
714 peer_pid, | 714 peer_pid, |
715 plugin_child_id, | 715 plugin_child_id, |
716 false)) // is_external = false | 716 false)) // is_external = false |
717 return scoped_refptr<PluginModule>(); | 717 return scoped_refptr<PluginModule>(); |
718 | 718 |
719 return module; | 719 return module; |
720 } | 720 } |
721 | 721 |
722 } // namespace content | 722 } // namespace content |
OLD | NEW |