Home | History | Annotate | Download | only in plugin
      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
      3 // found in the LICENSE file.
      4 
      5 #include "native_client/src/include/nacl_macros.h"
      6 #include "ppapi/native_client/src/trusted/plugin/nacl_entry_points.h"
      7 #include "ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h"
      8 
      9 #include "ppapi/cpp/var.h"
     10 
     11 LaunchNaClProcessFunc launch_nacl_process = NULL;
     12 
     13 namespace plugin {
     14 
     15 bool SelLdrLauncherChrome::Start(const char* url) {
     16   NACL_NOTREACHED();
     17   return false;
     18 }
     19 
     20 bool SelLdrLauncherChrome::Start(PP_Instance instance,
     21                                  const char* url,
     22                                  bool uses_irt,
     23                                  bool uses_ppapi,
     24                                  bool enable_ppapi_dev,
     25                                  bool enable_dyncode_syscalls,
     26                                  bool enable_exception_handling,
     27                                  nacl::string* error_message) {
     28   *error_message = "";
     29   if (!launch_nacl_process)
     30     return false;
     31   PP_Var var_error_message;
     32   // send a synchronous message to the browser process
     33   if (launch_nacl_process(instance,
     34                           url,
     35                           PP_FromBool(uses_irt),
     36                           PP_FromBool(uses_ppapi),
     37                           PP_FromBool(enable_ppapi_dev),
     38                           PP_FromBool(enable_dyncode_syscalls),
     39                           PP_FromBool(enable_exception_handling),
     40                           &channel_,
     41                           &var_error_message) != PP_EXTERNAL_PLUGIN_OK) {
     42     pp::Var var_error_message_cpp(pp::PASS_REF, var_error_message);
     43     if (var_error_message_cpp.is_string()) {
     44       *error_message = var_error_message_cpp.AsString();
     45     }
     46     return false;
     47   }
     48   return true;
     49 }
     50 
     51 }  // namespace plugin
     52