1 // Copyright 2013 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.
5 // Multiply-included file, no traditional include guard.
9 #include "base/basictypes.h"
10 #include "base/process/process.h"
11 #include "build/build_config.h"
12 #include "components/nacl/common/nacl_types.h"
13 #include "components/nacl/common/nacl_types_param_traits.h"
14 #include "components/nacl/common/pnacl_types.h"
15 #include "content/public/common/common_param_traits.h"
16 #include "ipc/ipc_channel_handle.h"
17 #include "ipc/ipc_message_macros.h"
18 #include "ipc/ipc_platform_file.h"
21 #define IPC_MESSAGE_START NaClHostMsgStart
23 IPC_STRUCT_TRAITS_BEGIN(nacl::NaClResourcePrefetchRequest
)
24 IPC_STRUCT_TRAITS_MEMBER(file_key
)
25 IPC_STRUCT_TRAITS_MEMBER(resource_url
)
26 IPC_STRUCT_TRAITS_END()
28 IPC_STRUCT_TRAITS_BEGIN(nacl::NaClLaunchParams
)
29 IPC_STRUCT_TRAITS_MEMBER(manifest_url
)
30 IPC_STRUCT_TRAITS_MEMBER(nexe_file
)
31 IPC_STRUCT_TRAITS_MEMBER(nexe_token_lo
)
32 IPC_STRUCT_TRAITS_MEMBER(nexe_token_hi
)
33 IPC_STRUCT_TRAITS_MEMBER(resource_prefetch_request_list
)
34 IPC_STRUCT_TRAITS_MEMBER(render_view_id
)
35 IPC_STRUCT_TRAITS_MEMBER(permission_bits
)
36 IPC_STRUCT_TRAITS_MEMBER(uses_nonsfi_mode
)
37 IPC_STRUCT_TRAITS_MEMBER(process_type
)
38 IPC_STRUCT_TRAITS_END()
40 IPC_STRUCT_TRAITS_BEGIN(nacl::NaClLaunchResult
)
41 IPC_STRUCT_TRAITS_MEMBER(imc_channel_handle
)
42 IPC_STRUCT_TRAITS_MEMBER(ppapi_ipc_channel_handle
)
43 IPC_STRUCT_TRAITS_MEMBER(trusted_ipc_channel_handle
)
44 IPC_STRUCT_TRAITS_MEMBER(manifest_service_ipc_channel_handle
)
45 IPC_STRUCT_TRAITS_MEMBER(plugin_pid
)
46 IPC_STRUCT_TRAITS_MEMBER(plugin_child_id
)
47 IPC_STRUCT_TRAITS_MEMBER(crash_info_shmem_handle
)
48 IPC_STRUCT_TRAITS_END()
50 IPC_STRUCT_TRAITS_BEGIN(nacl::PnaclCacheInfo
)
51 IPC_STRUCT_TRAITS_MEMBER(pexe_url
)
52 IPC_STRUCT_TRAITS_MEMBER(abi_version
)
53 IPC_STRUCT_TRAITS_MEMBER(opt_level
)
54 IPC_STRUCT_TRAITS_MEMBER(last_modified
)
55 IPC_STRUCT_TRAITS_MEMBER(etag
)
56 IPC_STRUCT_TRAITS_MEMBER(has_no_store_header
)
57 IPC_STRUCT_TRAITS_MEMBER(use_subzero
)
58 IPC_STRUCT_TRAITS_MEMBER(sandbox_isa
)
59 IPC_STRUCT_TRAITS_MEMBER(extra_flags
)
60 IPC_STRUCT_TRAITS_END()
62 // A renderer sends this to the browser process when it wants to start
63 // a new instance of the Native Client process. The browser will launch
64 // the process and return an IPC channel handle. This handle will only
65 // be valid if the NaCl IPC proxy is enabled.
66 IPC_SYNC_MESSAGE_CONTROL1_2(NaClHostMsg_LaunchNaCl
,
67 nacl::NaClLaunchParams
/* launch_params */,
68 nacl::NaClLaunchResult
/* launch_result */,
69 std::string
/* error_message */)
71 // A renderer sends this to the browser process when it wants to
72 // open a file for from the Pnacl component directory.
73 IPC_SYNC_MESSAGE_CONTROL2_3(NaClHostMsg_GetReadonlyPnaclFD
,
74 std::string
/* name of requested PNaCl file */,
75 bool /* is_executable */,
76 IPC::PlatformFileForTransit
/* output file */,
77 uint64_t /* file_token_lo */,
78 uint64_t /* file_token_hi */)
80 // A renderer sends this to the browser process when it wants to
81 // create a temporary file.
82 IPC_SYNC_MESSAGE_CONTROL0_1(NaClHostMsg_NaClCreateTemporaryFile
,
83 IPC::PlatformFileForTransit
/* out file */)
85 // A renderer sends this to the browser to request a file descriptor for
87 IPC_MESSAGE_CONTROL3(NaClHostMsg_NexeTempFileRequest
,
88 int /* render_view_id */,
90 nacl::PnaclCacheInfo
/* cache info */)
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
,
97 bool /* is_cache_hit */,
98 IPC::PlatformFileForTransit
/* output file */)
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
,
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
,
109 int /* render_view_id */)
111 // A renderer sends this to the browser process when it wants to
112 // open a NaCl executable file from an installed application directory.
113 IPC_SYNC_MESSAGE_CONTROL3_3(NaClHostMsg_OpenNaClExecutable
,
114 int /* render_view_id */,
115 GURL
/* URL of NaCl executable file */,
116 bool /* enable_validation_caching */,
117 IPC::PlatformFileForTransit
/* output file */,
118 uint64
/* file_token_lo */,
119 uint64
/* file_token_hi */)
121 // A renderer sends this to the browser process to determine how many
122 // processors are online.
123 IPC_SYNC_MESSAGE_CONTROL0_1(NaClHostMsg_NaClGetNumProcessors
,
124 int /* Number of processors */)
126 // A renderer sends this to the browser process to determine if the
127 // NaCl application started from the given NMF URL will be debugged.
128 // If not (filtered out by commandline flags), it sets should_debug to false.
129 IPC_SYNC_MESSAGE_CONTROL1_1(NaClHostMsg_NaClDebugEnabledForURL
,
130 GURL
/* alleged URL of NMF file */,
131 bool /* should debug */)