Added documentation to web_view.js/web_view_experimental.js regarding the webview...
[chromium-blink-merge.git] / ppapi / api / private / ppb_nacl_private.idl
blob4e215d7fa89caa934c09c74b214a897fdfc197df
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 */
6 /* This file contains NaCl private interfaces. This interface is not versioned
7 * and is for internal Chrome use. It may change without notice. */
9 label Chrome {
10 M25 = 1.0
13 #inline c
14 #include "ppapi/c/private/pp_file_handle.h"
15 #include "ppapi/c/private/ppb_instance_private.h"
16 #endinl
18 /** NaCl-specific errors that should be reported to the user */
19 enum PP_NaClError {
20 /**
21 * The manifest program element does not contain a program usable on the
22 * user's architecture
24 PP_NACL_MANIFEST_MISSING_ARCH = 0
27 /** Event types that NaCl may use when reporting load progress or errors. */
28 enum PP_NaClEventType {
29 PP_NACL_EVENT_LOADSTART,
30 PP_NACL_EVENT_PROGRESS,
31 PP_NACL_EVENT_ERROR,
32 PP_NACL_EVENT_ABORT,
33 PP_NACL_EVENT_LOAD,
34 PP_NACL_EVENT_LOADEND,
35 PP_NACL_EVENT_CRASH
38 /* PPB_NaCl_Private */
39 interface PPB_NaCl_Private {
40 /* Launches NaCl's sel_ldr process. Returns PP_EXTERNAL_PLUGIN_OK on success
41 * and writes a NaClHandle to imc_handle. Returns PP_EXTERNAL_PLUGIN_FAILED on
42 * failure. The |enable_ppapi_dev| parameter controls whether GetInterface
43 * returns 'Dev' interfaces to the NaCl plugin. The |uses_ppapi| flag
44 * indicates that the nexe run by sel_ldr will use the PPAPI APIs.
45 * This implies that LaunchSelLdr is run from the main thread. If a nexe
46 * does not need PPAPI, then it can run off the main thread.
47 * The |uses_irt| flag indicates whether the IRT should be loaded in this
48 * NaCl process. This is true for ABI stable nexes.
49 * The |enable_dyncode_syscalls| flag indicates whether or not the nexe
50 * will be able to use dynamic code system calls (e.g., mmap with PROT_EXEC).
51 * The |enable_exception_handling| flag indicates whether or not the nexe
52 * will be able to use hardware exception handling.
53 * The |enable_crash_throttling| flag indicates whether or not crashes of
54 * the nexe contribute to crash throttling statisics and whether nexe starts
55 * are throttled by crash throttling.
57 PP_ExternalPluginResult LaunchSelLdr([in] PP_Instance instance,
58 [in] str_t alleged_url,
59 [in] PP_Bool uses_irt,
60 [in] PP_Bool uses_ppapi,
61 [in] PP_Bool enable_ppapi_dev,
62 [in] PP_Bool enable_dyncode_syscalls,
63 [in] PP_Bool enable_exception_handling,
64 [in] PP_Bool enable_crash_throttling,
65 [out] mem_t imc_handle,
66 [out] PP_Var error_message);
68 /* This function starts the IPC proxy so the nexe can communicate with the
69 * browser. Returns PP_EXTERNAL_PLUGIN_OK on success, otherwise a result code
70 * indicating the failure. PP_EXTERNAL_PLUGIN_FAILED is returned if
71 * LaunchSelLdr wasn't called with the instance.
72 * PP_EXTERNAL_PLUGIN_ERROR_MODULE is returned if the module can't be
73 * initialized. PP_EXTERNAL_PLUGIN_ERROR_INSTANCE is returned if the instance
74 * can't be initialized.
76 PP_ExternalPluginResult StartPpapiProxy(PP_Instance instance);
78 /* On POSIX systems, this function returns the file descriptor of
79 * /dev/urandom. On non-POSIX systems, this function returns 0.
81 int32_t UrandomFD();
83 /* Whether the Pepper 3D interfaces should be disabled in the NaCl PPAPI
84 * proxy. This is so paranoid admins can effectively prevent untrusted shader
85 * code to be processed by the graphics stack.
87 PP_Bool Are3DInterfacesDisabled();
89 /* This is Windows-specific. This is a replacement for DuplicateHandle() for
90 * use inside the Windows sandbox. Note that we provide this via dependency
91 * injection only to avoid the linkage problems that occur because the NaCl
92 * plugin is built as a separate DLL/DSO
93 * (see http://code.google.com/p/chromium/issues/detail?id=114439#c8).
95 int32_t BrokerDuplicateHandle([in] PP_FileHandle source_handle,
96 [in] uint32_t process_id,
97 [out] PP_FileHandle target_handle,
98 [in] uint32_t desired_access,
99 [in] uint32_t options);
101 /* Returns a read-only file descriptor of a file rooted in the Pnacl
102 * component directory, or an invalid handle on failure.
104 PP_FileHandle GetReadonlyPnaclFd([in] str_t filename);
106 /* This creates a temporary file that will be deleted by the time
107 * the last handle is closed (or earlier on POSIX systems), and
108 * returns a posix handle to that temporary file.
110 PP_FileHandle CreateTemporaryFile([in] PP_Instance instance);
112 /* Create a temporary file, which will be deleted by the time the
113 * last handle is closed (or earlier on POSIX systems), to use for
114 * the nexe with the cache information given by |pexe_url|,
115 * |abi_version|, |opt_level|, |last_modified|, |etag|, and
116 * |has_no_store_header|. If the nexe is already present in the
117 * cache, |is_hit| is set to PP_TRUE and the contents of the nexe
118 * will be copied into the temporary file. Otherwise |is_hit| is set
119 * to PP_FALSE and the temporary file will be writeable. Currently
120 * the implementation is a stub, which always sets is_hit to false
121 * and calls the implementation of CreateTemporaryFile. In a
122 * subsequent CL it will call into the browser which will remember
123 * the association between the cache key and the fd, and copy the
124 * nexe into the cache after the translation finishes.
126 int32_t GetNexeFd([in] PP_Instance instance,
127 [in] str_t pexe_url,
128 [in] uint32_t abi_version,
129 [in] uint32_t opt_level,
130 [in] str_t last_modified,
131 [in] str_t etag,
132 [in] PP_Bool has_no_store_header,
133 [out] PP_Bool is_hit,
134 [out] PP_FileHandle nexe_handle,
135 [in] PP_CompletionCallback callback);
137 /* Report to the browser that translation of the pexe for |instance|
138 * has finished, or aborted with an error. If |success| is true, the
139 * browser may then store the translation in the cache. The renderer
140 * must first have called GetNexeFd for the same instance. (The browser is
141 * not guaranteed to store the nexe even if |success| is true; if there is
142 * an error on the browser side, or the file is too big for the cache, or
143 * the browser is in incognito mode, no notification will be delivered to
144 * the plugin.)
146 void ReportTranslationFinished([in] PP_Instance instance,
147 [in] PP_Bool success);
149 /* Display a UI message to the user. */
150 PP_ExternalPluginResult ReportNaClError([in] PP_Instance instance,
151 [in] PP_NaClError message_id);
153 /* Opens a NaCl executable file in the application's extension directory
154 * corresponding to the file URL and returns a file descriptor, or an invalid
155 * handle on failure. |metadata| is left unchanged on failure.
157 PP_FileHandle OpenNaClExecutable([in] PP_Instance instance,
158 [in] str_t file_url,
159 [out] uint64_t file_token_lo,
160 [out] uint64_t file_token_hi);
163 /* Dispatch a progress event on the DOM element where the given instance is
164 * embedded.
166 void DispatchEvent([in] PP_Instance instance,
167 [in] PP_NaClEventType event_type,
168 [in] PP_Var resource_url,
169 [in] PP_Bool length_is_computable,
170 [in] uint64_t loaded_bytes,
171 [in] uint64_t total_bytes);
173 /* Sets a read-only property on the <embed> DOM element that corresponds to
174 * the given instance.
176 void SetReadOnlyProperty([in] PP_Instance instance,
177 [in] PP_Var key,
178 [in] PP_Var value);