OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <!-- | 3 <!-- |
4 Copyright (c) 2012 The Chromium Authors. All rights reserved. | 4 Copyright (c) 2016 The Chromium Authors. All rights reserved. |
5 Use of this source code is governed by a BSD-style license that can be | 5 Use of this source code is governed by a BSD-style license that can be |
6 found in the LICENSE file. | 6 found in the LICENSE file. |
7 --> | 7 --> |
8 <head> | 8 <head> |
9 <meta http-equiv="Pragma" content="no-cache"> | 9 <meta http-equiv="Pragma" content="no-cache"> |
10 <meta http-equiv="Expires" content="-1"> | 10 <meta http-equiv="Expires" content="-1"> |
11 <title>{{title}}</title> | 11 <title>{{title}}</title> |
12 <script type="text/javascript" src="common.js"></script> | 12 <script type="text/javascript" src="common.js"></script> |
13 <script type="text/javascript" src="example.js"></script> | 13 <script type="text/javascript" src="example.js"></script> |
14 </head> | 14 </head> |
15 <body data-custom-load="true" {{attrs}}> | 15 <body data-custom-load="true" {{attrs}}> |
16 <h1>{{title}}</h1> | 16 <h1>{{title}}</h1> |
17 <h2>Status: <code id="statusField">NO-STATUS</code></h2> | |
18 <p> | 17 <p> |
19 This example shows how you can use standard C library file and socket | 18 This example shows how you can use standard C++ library files |
20 operation functions in Native Client using a library called nacl_io. | 19 in Native Client to access Google Drive exposed by a library called nacl_io. |
21 </p> | 20 </p> |
22 <p> | 21 <p> |
23 nacl_io provides a virtual filesystem. The filesystem can be "mounted" | 22 nacl_io provides a virtual filesystem. Google Drive can be "mounted" |
24 in a given directory tree. When you perform operations on files in those | 23 in a given directory tree. When you perform operations on files in those |
25 directories, the mount determines how those operations should be performed. | 24 directories, the mount determines how those operations should be performed. |
26 </p> | 25 </p> |
27 <p> | 26 <p> |
28 This example has four mounts by default. | 27 This example has 1 mount by default. Sign in and use the file operations an
d directory operations. |
29 <ol> | 28 <ol> |
30 <li><i>/</i> the root of the filesystem. This is a memory mount, and | 29 <li><i>/</i> a Google Drive mount. |
31 is non-persistent.</li> | 30 </li> |
32 <li><i>/persistent</i> a persistent storage area. Any data written | |
33 here can be read back after Chrome is restarted.</li> | |
34 <li><i>/http</i> a mount that can read from a URL. Try reading from | |
35 /http/index.html.</li> | |
36 <li><i>/dev</i> a mount containing some utility files. /dev/null, | |
37 /dev/zero, etc.</li> | |
38 </ol> | 31 </ol> |
39 </p> | 32 </p> |
40 <p> | 33 <hr> |
41 nacl_io also provides a (currently incomplete) posix socket api. Like the | 34 <button id="buttonid" onclick="buttonOnClick()">Sign in</button> |
42 virtual filesystem, it is an abstraction layer on top of ppapi. To use this | 35 <script> |
43 API, an app must be a packaged app with the appropriate socket permissions | 36 executeAfterGettingCode(); |
44 specified in the manifest file. | 37 </script> |
45 <hr> | 38 <hr> |
46 <p><b>File Operations:</b></p> | 39 <p><b>File Operations:</b></p> |
47 <div> | 40 <div> |
48 <span> | 41 <span> |
49 <input type="radio" id="radiofopen" name="group" checked="checked">fopen | 42 <input type="radio" id="radiofopen" name="group" checked="checked">fopen |
50 <input type="radio" id="radiofclose" name="group">fclose | 43 <input type="radio" id="radiofclose" name="group">fclose |
51 <input type="radio" id="radiofread" name="group">fread | 44 <input type="radio" id="radiofread" name="group">fread |
52 <input type="radio" id="radiofwrite" name="group">fwrite | 45 <input type="radio" id="radiofwrite" name="group">fwrite |
53 <input type="radio" id="radiofseek" name="group">fseek | 46 <input type="radio" id="radiofseek" name="group">fseek |
54 <input type="radio" id="radiofflush" name="group">fflush | 47 <input type="radio" id="radiofflush" name="group">fflush |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 <input type="text" id="chdirDirname"> | 166 <input type="text" id="chdirDirname"> |
174 <button>chdir</button> | 167 <button>chdir</button> |
175 </span> | 168 </span> |
176 </div> | 169 </div> |
177 <div class="function" id="getcwd" hidden> | 170 <div class="function" id="getcwd" hidden> |
178 <span> | 171 <span> |
179 <button>getcwd</button> | 172 <button>getcwd</button> |
180 </span> | 173 </span> |
181 </div> | 174 </div> |
182 <hr> | 175 <hr> |
183 <p><b>Socket Operations:</b></p> | |
184 <div> | |
185 <span> | |
186 <input type="radio" id="radiogethostbyname" name="group">gethostbyname | |
187 <input type="radio" id="radiogetaddrinfo" name="group">getaddrinfo | |
188 <input type="radio" id="radioconnect" name="group">connect | |
189 <input type="radio" id="radiosend" name="group">send | |
190 <input type="radio" id="radiorecv" name="group">recv | |
191 <input type="radio" id="radioclose" name="group">close | |
192 </span> | |
193 </div> | |
194 <div class="function" id="gethostbyname" hidden> | |
195 <span> | |
196 Hostname: | |
197 <input type="text" id="gethostbynameName" value="google.com"> | |
198 <button>gethostbyname</button> | |
199 </span> | |
200 </div> | |
201 <div class="function" id="getaddrinfo" hidden> | |
202 <span> | |
203 Hostname: | |
204 <input type="text" id="getaddrinfoName" value="google.com"> | |
205 <select id="getaddrinfoFamily"> | |
206 <option>AF_INET</option> | |
207 <option>AF_INET6</option> | |
208 <option>AF_UNSPEC</option> | |
209 </select> | |
210 <button>getaddrinfo</button> | |
211 </span> | |
212 </div> | |
213 <div class="function" id="connect" hidden> | |
214 <span> | |
215 Host: | |
216 <input type="text" id="connectHost" value="google.com"> | |
217 Port: | |
218 <input type="text" id="connectPort" value="80"> | |
219 <button>connect</button> | |
220 </span> | |
221 </div> | |
222 <div class="function" id="send" hidden> | |
223 <span> | |
224 <select class="sock-handle" id="sendHandle"></select> | |
225 Message: | |
226 <input type="text" id="sendMessage" value="Hello!"> | |
227 <button>send</button> | |
228 </span> | |
229 </div> | |
230 <div class="function" id="recv" hidden> | |
231 <span> | |
232 <select class="sock-handle" id="recvHandle"></select> | |
233 Buffer Size: | |
234 <input type="text" id="recvBufferSize" value="256"> | |
235 <button>recv</button> | |
236 </span> | |
237 </div> | |
238 <div class="function" id="close" hidden> | |
239 <span> | |
240 <select class="sock-handle" id="closeHandle"></select> | |
241 <button>close</button> | |
242 </span> | |
243 </div> | |
244 <hr> | |
245 <p><b>JavaScript Pipe Operations:</b></p> | |
246 <p>Type input while the focus is on this box the send input to the pipe | |
247 device: | |
248 <select id="pipe_name"> | |
249 <option>jspipe1</option> | |
250 <option>jspipe2</option> | |
251 <option>jspipe3</option> | |
252 </select> | |
253 <input type="text" id="pipe_input_box"></p> | |
254 <p>Any output from the pipe will be printed below: <textarea id="pipe_output">
</textarea></p> | |
255 <hr> | |
256 <p><b>Log:</b></p> | 176 <p><b>Log:</b></p> |
257 <pre id="log" style="font-weight: bold"></pre> | 177 <pre id="log" style="font-weight: bold"></pre> |
258 <!-- The NaCl plugin will be embedded inside the element with id "listener". | 178 <!-- The NaCl plugin will be embedded inside the element with id "listener". |
259 See common.js.--> | 179 See common.js.--> |
260 <div id="listener"></div> | 180 <div id="listener"></div> |
261 </body> | 181 </body> |
262 </html> | 182 </html> |
OLD | NEW |