OLD | NEW |
1 .. _tutorial2: | 1 .. _tutorial2: |
2 | 2 |
3 ###################################### | 3 ###################################### |
4 C++ Tutorial: Getting Started (Part 2) | 4 C++ Tutorial: Getting Started (Part 2) |
5 ###################################### | 5 ###################################### |
6 | 6 |
7 .. contents:: | 7 .. contents:: |
8 :local: | 8 :local: |
9 :backlinks: none | 9 :backlinks: none |
10 :depth: 2 | 10 :depth: 2 |
11 | 11 |
12 Overview | 12 Overview |
13 ======== | 13 ======== |
14 | 14 |
15 This tutorial shows how to convert the finished PNaCl web application from | 15 This tutorial shows how to convert the finished PNaCl web application from |
16 :doc:`Part 1 <tutorial-part1>` to use the Native Client SDK build system and | 16 :doc:`Part 1 <tutorial-part1>` to use the Native Client SDK build system and |
17 common JavaScript files. It also demonstrates some techniques to make your web | 17 common JavaScript files. It also demonstrates some techniques to make your web |
18 application `Content Security Policy (CSP)-compliant | 18 application `Content Security Policy (CSP)-compliant |
19 </apps/contentSecurityPolicy>`_, which is necessary for `Chrome Apps | 19 </apps/contentSecurityPolicy>`_, which is necessary for `Chrome Apps </apps>`_. |
20 </apps/about_apps>`_. | |
21 | 20 |
22 Using the Native Client SDK build system makes it easy to build with all of the | 21 Using the Native Client SDK build system makes it easy to build with all of the |
23 SDK toolchains, and switch between the Debug and Release configurations. It | 22 SDK toolchains, and switch between the Debug and Release configurations. It |
24 also simplifies the makefiles for your project, as we'll see in the next | 23 also simplifies the makefiles for your project, as we'll see in the next |
25 section. Finally, it adds some useful commands for :ref:`running | 24 section. Finally, it adds some useful commands for :ref:`running |
26 <running_the_sdk_examples>` and :ref:`debugging <debugging_the_sdk_examples>` | 25 <running_the_sdk_examples>` and :ref:`debugging <debugging_the_sdk_examples>` |
27 your application. | 26 your application. |
28 | 27 |
29 The finished code for this example can be found in the | 28 The finished code for this example can be found in the |
30 ``pepper_$(VERSION)/getting_started/part2`` directory in the Native Client SDK | 29 ``pepper_$(VERSION)/getting_started/part2`` directory in the Native Client SDK |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 224 |
226 .. naclcode:: | 225 .. naclcode:: |
227 | 226 |
228 $(eval $(call NMF_RULE,$(TARGET),)) | 227 $(eval $(call NMF_RULE,$(TARGET),)) |
229 | 228 |
230 Making index.html work for Chrome Apps | 229 Making index.html work for Chrome Apps |
231 ====================================== | 230 ====================================== |
232 | 231 |
233 This section describes the changes necessary to make the HTML and JavaScript in | 232 This section describes the changes necessary to make the HTML and JavaScript in |
234 part1 CSP-compliant. This is required if you want to build a `Chrome App | 233 part1 CSP-compliant. This is required if you want to build a `Chrome App |
235 </apps/about_apps>`_, but is not necessary if you want to use PNaCl on the open | 234 </apps>`_, but is not necessary if you want to use PNaCl on the open web. |
236 web. | |
237 | 235 |
238 CSP rules | 236 CSP rules |
239 --------- | 237 --------- |
240 | 238 |
241 `Chrome Apps CSP </apps/contentSecurityPolicy#what>`_ restricts you from doing | 239 `Chrome Apps CSP </apps/contentSecurityPolicy#what>`_ restricts you from doing |
242 the following: | 240 the following: |
243 | 241 |
244 * You can’t use inline scripting in your Chrome App pages. The restriction | 242 * You can’t use inline scripting in your Chrome App pages. The restriction |
245 bans both ``<script>`` blocks and event handlers (``<button onclick="...">``). | 243 bans both ``<script>`` blocks and event handlers (``<button onclick="...">``). |
246 * You can’t reference any external resources in any of your app files (except | 244 * You can’t reference any external resources in any of your app files (except |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 Compile the Native Client module and run the application again | 500 Compile the Native Client module and run the application again |
503 ============================================================== | 501 ============================================================== |
504 | 502 |
505 #. Compile the Native Client module by running the ``make`` command again. | 503 #. Compile the Native Client module by running the ``make`` command again. |
506 #. Start the SDK web server by running ``make server``. | 504 #. Start the SDK web server by running ``make server``. |
507 #. Re-run the application by reloading ``http://localhost:5103/part2`` in | 505 #. Re-run the application by reloading ``http://localhost:5103/part2`` in |
508 Chrome. | 506 Chrome. |
509 | 507 |
510 After Chrome loads the Native Client module, you should see the message sent | 508 After Chrome loads the Native Client module, you should see the message sent |
511 from the module. | 509 from the module. |
OLD | NEW |