1 // Copyright 2013 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Multiply-included file, no traditional include guard. 6 // no-include-guard-because-multiply-included 7 8 #include <stdint.h> 9 10 #include <string> 11 12 #include "base/process/process.h" 13 #include "build/build_config.h" 14 #include "components/nacl/common/nacl_types.h" 15 #include "components/nacl/common/nacl_types_param_traits.h" 16 #include "components/nacl/common/pnacl_types.h" 17 #include "ipc/ipc_channel_handle.h" 18 #include "ipc/ipc_message_macros.h" 19 #include "ipc/ipc_message_start.h" 20 #include "ipc/ipc_platform_file.h" 21 #include "url/gurl.h" 22 #include "url/ipc/url_param_traits.h" 23 24 #define IPC_MESSAGE_START NaClHostMsgStart 25 26 IPC_STRUCT_TRAITS_BEGIN(nacl::NaClResourcePrefetchRequest) 27 IPC_STRUCT_TRAITS_MEMBER(file_key) 28 IPC_STRUCT_TRAITS_MEMBER(resource_url) 29 IPC_STRUCT_TRAITS_END() 30 31 IPC_STRUCT_TRAITS_BEGIN(nacl::NaClLaunchParams) 32 IPC_STRUCT_TRAITS_MEMBER(manifest_url) 33 IPC_STRUCT_TRAITS_MEMBER(nexe_file) 34 IPC_STRUCT_TRAITS_MEMBER(nexe_token_lo) 35 IPC_STRUCT_TRAITS_MEMBER(nexe_token_hi) 36 IPC_STRUCT_TRAITS_MEMBER(resource_prefetch_request_list) 37 IPC_STRUCT_TRAITS_MEMBER(render_frame_id) 38 IPC_STRUCT_TRAITS_MEMBER(permission_bits) 39 IPC_STRUCT_TRAITS_MEMBER(process_type) 40 IPC_STRUCT_TRAITS_END() 41 42 IPC_STRUCT_TRAITS_BEGIN(nacl::NaClLaunchResult) 43 IPC_STRUCT_TRAITS_MEMBER(ppapi_ipc_channel_handle) 44 IPC_STRUCT_TRAITS_MEMBER(trusted_ipc_channel_handle) 45 IPC_STRUCT_TRAITS_MEMBER(manifest_service_ipc_channel_handle) 46 IPC_STRUCT_TRAITS_MEMBER(plugin_pid) 47 IPC_STRUCT_TRAITS_MEMBER(plugin_child_id) 48 IPC_STRUCT_TRAITS_MEMBER(crash_info_shmem_region) 49 IPC_STRUCT_TRAITS_END() 50 51 IPC_STRUCT_TRAITS_BEGIN(nacl::PnaclCacheInfo) 52 IPC_STRUCT_TRAITS_MEMBER(pexe_url) 53 IPC_STRUCT_TRAITS_MEMBER(abi_version) 54 IPC_STRUCT_TRAITS_MEMBER(opt_level) 55 IPC_STRUCT_TRAITS_MEMBER(last_modified) 56 IPC_STRUCT_TRAITS_MEMBER(etag) 57 IPC_STRUCT_TRAITS_MEMBER(has_no_store_header) 58 IPC_STRUCT_TRAITS_MEMBER(use_subzero) 59 IPC_STRUCT_TRAITS_MEMBER(sandbox_isa) 60 IPC_STRUCT_TRAITS_MEMBER(extra_flags) 61 IPC_STRUCT_TRAITS_END() 62 63 // A renderer sends this to the browser process when it wants to start 64 // a new instance of the Native Client process. The browser will launch 65 // the process and return an IPC channel handle. This handle will only 66 // be valid if the NaCl IPC proxy is enabled. 67 IPC_SYNC_MESSAGE_CONTROL1_2(NaClHostMsg_LaunchNaCl, 68 nacl::NaClLaunchParams /* launch_params */, 69 nacl::NaClLaunchResult /* launch_result */, 70 std::string /* error_message */) 71 72 // A renderer sends this to the browser process when it wants to 73 // open a file for from the Pnacl component directory. 74 IPC_SYNC_MESSAGE_CONTROL2_3(NaClHostMsg_GetReadonlyPnaclFD, 75 std::string /* name of requested PNaCl file */, 76 bool /* is_executable */, 77 IPC::PlatformFileForTransit /* output file */, 78 uint64_t /* file_token_lo */, 79 uint64_t /* file_token_hi */) 80 81 // A renderer sends this to the browser process when it wants to 82 // create a temporary file. 83 IPC_SYNC_MESSAGE_CONTROL0_1(NaClHostMsg_NaClCreateTemporaryFile, 84 IPC::PlatformFileForTransit /* out file */) 85 86 // A renderer sends this to the browser to request a file descriptor for 87 // a translated nexe. 88 IPC_MESSAGE_CONTROL2(NaClHostMsg_NexeTempFileRequest, 89 int /* instance */, 90 nacl::PnaclCacheInfo /* cache info */) 91 92 // The browser replies to a renderer's temp file request with output_file, 93 // which is either a writeable temp file to use for translation, or a 94 // read-only file containing the translated nexe from the cache. 95 IPC_MESSAGE_CONTROL3(NaClViewMsg_NexeTempFileReply, 96 int /* instance */, 97 bool /* is_cache_hit */, 98 IPC::PlatformFileForTransit /* output file */) 99 100 // A renderer sends this to the browser to report that its translation has 101 // finished and its temp file contains the translated nexe. 102 IPC_MESSAGE_CONTROL2(NaClHostMsg_ReportTranslationFinished, 103 int /* instance */, 104 bool /* success */) 105 106 // A renderer sends this to the browser process to report when the client 107 // architecture is not listed in the manifest. 108 IPC_MESSAGE_CONTROL1(NaClHostMsg_MissingArchError, int /* render_frame_id */) 109 110 // A renderer sends this to the browser process when it wants to 111 // open a NaCl executable file from an installed application directory. 112 IPC_SYNC_MESSAGE_CONTROL2_3(NaClHostMsg_OpenNaClExecutable, 113 int /* render_frame_id */, 114 GURL /* URL of NaCl executable file */, 115 IPC::PlatformFileForTransit /* output file */, 116 uint64_t /* file_token_lo */, 117 uint64_t /* file_token_hi */) 118 119 // A renderer sends this to the browser process to determine how many 120 // processors are online. 121 IPC_SYNC_MESSAGE_CONTROL0_1(NaClHostMsg_NaClGetNumProcessors, 122 int /* Number of processors */) 123 124 // A renderer sends this to the browser process to determine if the 125 // NaCl application started from the given NMF URL will be debugged. 126 // If not (filtered out by commandline flags), it sets should_debug to false. 127 IPC_SYNC_MESSAGE_CONTROL1_1(NaClHostMsg_NaClDebugEnabledForURL, 128 GURL /* alleged URL of NMF file */, 129 bool /* should debug */) 130