| 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 "chrome/renderer/pepper/ppb_nacl_private_impl.h" | 5 #include "chrome/renderer/pepper/ppb_nacl_private_impl.h" |
| 6 | 6 |
| 7 #ifndef DISABLE_NACL | 7 #ifndef DISABLE_NACL |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 content::RendererPpapiHost *host = | 60 content::RendererPpapiHost *host = |
| 61 content::RendererPpapiHost::GetForPPInstance(instance); | 61 content::RendererPpapiHost::GetForPPInstance(instance); |
| 62 if (!host) | 62 if (!host) |
| 63 return 0; | 63 return 0; |
| 64 return host->GetRoutingIDForWidget(instance); | 64 return host->GetRoutingIDForWidget(instance); |
| 65 } | 65 } |
| 66 | 66 |
| 67 // Launch NaCl's sel_ldr process. | 67 // Launch NaCl's sel_ldr process. |
| 68 PP_NaClResult LaunchSelLdr(PP_Instance instance, | 68 PP_NaClResult LaunchSelLdr(PP_Instance instance, |
| 69 const char* alleged_url, | 69 const char* alleged_url, |
| 70 PP_Bool uses_irt, |
| 70 PP_Bool uses_ppapi, | 71 PP_Bool uses_ppapi, |
| 71 PP_Bool enable_ppapi_dev, | 72 PP_Bool enable_ppapi_dev, |
| 72 int socket_count, | 73 int socket_count, |
| 73 void* imc_handles) { | 74 void* imc_handles) { |
| 74 std::vector<nacl::FileDescriptor> sockets; | 75 std::vector<nacl::FileDescriptor> sockets; |
| 75 IPC::Sender* sender = content::RenderThread::Get(); | 76 IPC::Sender* sender = content::RenderThread::Get(); |
| 76 if (sender == NULL) | 77 if (sender == NULL) |
| 77 sender = g_background_thread_sender.Pointer()->get(); | 78 sender = g_background_thread_sender.Pointer()->get(); |
| 78 | 79 |
| 79 int routing_id = 0; | 80 int routing_id = 0; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 96 // must also check on the trusted side of the proxy. | 97 // must also check on the trusted side of the proxy. |
| 97 if (enable_ppapi_dev) | 98 if (enable_ppapi_dev) |
| 98 perm_bits |= ppapi::PERMISSION_DEV; | 99 perm_bits |= ppapi::PERMISSION_DEV; |
| 99 instance_info.permissions = | 100 instance_info.permissions = |
| 100 ppapi::PpapiPermissions::GetForCommandLine(perm_bits); | 101 ppapi::PpapiPermissions::GetForCommandLine(perm_bits); |
| 101 | 102 |
| 102 if (!sender->Send(new ChromeViewHostMsg_LaunchNaCl( | 103 if (!sender->Send(new ChromeViewHostMsg_LaunchNaCl( |
| 103 instance_info.url, | 104 instance_info.url, |
| 104 routing_id, | 105 routing_id, |
| 105 perm_bits, | 106 perm_bits, |
| 106 socket_count, &sockets, | 107 PP_ToBool(uses_irt), |
| 108 socket_count, |
| 109 &sockets, |
| 107 &instance_info.channel_handle, | 110 &instance_info.channel_handle, |
| 108 &instance_info.plugin_child_id))) { | 111 &instance_info.plugin_child_id))) { |
| 109 return PP_NACL_FAILED; | 112 return PP_NACL_FAILED; |
| 110 } | 113 } |
| 111 | 114 |
| 112 // Don't save instance_info if channel handle is invalid. | 115 // Don't save instance_info if channel handle is invalid. |
| 113 bool invalid_handle = instance_info.channel_handle.name.empty(); | 116 bool invalid_handle = instance_info.channel_handle.name.empty(); |
| 114 #if defined(OS_POSIX) | 117 #if defined(OS_POSIX) |
| 115 if (!invalid_handle) | 118 if (!invalid_handle) |
| 116 invalid_handle = (instance_info.channel_handle.socket.fd == -1); | 119 invalid_handle = (instance_info.channel_handle.socket.fd == -1); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 &ReportNaClError | 281 &ReportNaClError |
| 279 }; | 282 }; |
| 280 | 283 |
| 281 } // namespace | 284 } // namespace |
| 282 | 285 |
| 283 const PPB_NaCl_Private* PPB_NaCl_Private_Impl::GetInterface() { | 286 const PPB_NaCl_Private* PPB_NaCl_Private_Impl::GetInterface() { |
| 284 return &nacl_interface; | 287 return &nacl_interface; |
| 285 } | 288 } |
| 286 | 289 |
| 287 #endif // DISABLE_NACL | 290 #endif // DISABLE_NACL |
| OLD | NEW |