| 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 // or is it safe to include the appropriate headers in | 265 // or is it safe to include the appropriate headers in |
| 266 // render_messages.h? | 266 // render_messages.h? |
| 267 GetRoutingID(instance), static_cast<int>(error_id)))) { | 267 GetRoutingID(instance), static_cast<int>(error_id)))) { |
| 268 return PP_NACL_FAILED; | 268 return PP_NACL_FAILED; |
| 269 } | 269 } |
| 270 return PP_NACL_OK; | 270 return PP_NACL_OK; |
| 271 } | 271 } |
| 272 | 272 |
| 273 PP_FileHandle OpenNaClExecutable(PP_Instance instance, | 273 PP_FileHandle OpenNaClExecutable(PP_Instance instance, |
| 274 const char* file_url, | 274 const char* file_url, |
| 275 PP_NaClExecutableMetadata* metadata) { | 275 uint64_t* nonce) { |
| 276 IPC::PlatformFileForTransit out_fd = IPC::InvalidPlatformFileForTransit(); | 276 IPC::PlatformFileForTransit out_fd = IPC::InvalidPlatformFileForTransit(); |
| 277 IPC::Sender* sender = content::RenderThread::Get(); | 277 IPC::Sender* sender = content::RenderThread::Get(); |
| 278 if (sender == NULL) | 278 if (sender == NULL) |
| 279 sender = g_background_thread_sender.Pointer()->get(); | 279 sender = g_background_thread_sender.Pointer()->get(); |
| 280 | 280 |
| 281 metadata->file_path = PP_MakeUndefined(); | 281 *nonce = 0; |
| 282 base::FilePath file_path; | 282 base::FilePath file_path; |
| 283 if (!sender->Send( | 283 if (!sender->Send( |
| 284 new ChromeViewHostMsg_OpenNaClExecutable(GetRoutingID(instance), | 284 new ChromeViewHostMsg_OpenNaClExecutable(GetRoutingID(instance), |
| 285 GURL(file_url), | 285 GURL(file_url), |
| 286 &file_path, | 286 &out_fd, |
| 287 &out_fd))) { | 287 nonce))) { |
| 288 return base::kInvalidPlatformFileValue; | 288 return base::kInvalidPlatformFileValue; |
| 289 } | 289 } |
| 290 | 290 |
| 291 if (out_fd == IPC::InvalidPlatformFileForTransit()) { | 291 if (out_fd == IPC::InvalidPlatformFileForTransit()) { |
| 292 return base::kInvalidPlatformFileValue; | 292 return base::kInvalidPlatformFileValue; |
| 293 } | 293 } |
| 294 | 294 |
| 295 metadata->file_path = | |
| 296 ppapi::StringVar::StringToPPVar(file_path.AsUTF8Unsafe()); | |
| 297 | |
| 298 base::PlatformFile handle = | 295 base::PlatformFile handle = |
| 299 IPC::PlatformFileForTransitToPlatformFile(out_fd); | 296 IPC::PlatformFileForTransitToPlatformFile(out_fd); |
| 300 return handle; | 297 return handle; |
| 301 } | 298 } |
| 302 | 299 |
| 303 const PPB_NaCl_Private nacl_interface = { | 300 const PPB_NaCl_Private nacl_interface = { |
| 304 &LaunchSelLdr, | 301 &LaunchSelLdr, |
| 305 &StartPpapiProxy, | 302 &StartPpapiProxy, |
| 306 &UrandomFD, | 303 &UrandomFD, |
| 307 &Are3DInterfacesDisabled, | 304 &Are3DInterfacesDisabled, |
| 308 &EnableBackgroundSelLdrLaunch, | 305 &EnableBackgroundSelLdrLaunch, |
| 309 &BrokerDuplicateHandle, | 306 &BrokerDuplicateHandle, |
| 310 &GetReadonlyPnaclFD, | 307 &GetReadonlyPnaclFD, |
| 311 &CreateTemporaryFile, | 308 &CreateTemporaryFile, |
| 312 &IsOffTheRecord, | 309 &IsOffTheRecord, |
| 313 &IsPnaclEnabled, | 310 &IsPnaclEnabled, |
| 314 &ReportNaClError, | 311 &ReportNaClError, |
| 315 &OpenNaClExecutable | 312 &OpenNaClExecutable |
| 316 }; | 313 }; |
| 317 | 314 |
| 318 } // namespace | 315 } // namespace |
| 319 | 316 |
| 320 const PPB_NaCl_Private* PPB_NaCl_Private_Impl::GetInterface() { | 317 const PPB_NaCl_Private* PPB_NaCl_Private_Impl::GetInterface() { |
| 321 return &nacl_interface; | 318 return &nacl_interface; |
| 322 } | 319 } |
| 323 | 320 |
| 324 #endif // DISABLE_NACL | 321 #endif // DISABLE_NACL |
| OLD | NEW |