OLD | NEW |
1 ==================================== | 1 ==================================== |
2 Distributing Your Application (NaCl) | 2 Distributing Your Application (NaCl) |
3 ==================================== | 3 ==================================== |
4 | 4 |
5 .. {% setvar pepperversion %}pepper28{% endsetvar %} | 5 .. {% setvar pepperversion %}pepper28{% endsetvar %} |
6 .. {% include "native-client/_local_variables.html" %} | 6 .. {% include "native-client/_local_variables.html" %} |
7 | 7 |
8 .. contents:: Table Of Contents | 8 .. contents:: Table Of Contents |
9 :local: | 9 :local: |
10 :backlinks: none | 10 :backlinks: none |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 Here is how to use this feature: | 138 Here is how to use this feature: |
139 | 139 |
140 1. Create a directory called ``_platform_specific``. | 140 1. Create a directory called ``_platform_specific``. |
141 Put this directory at the same level where your CWS manifest file, | 141 Put this directory at the same level where your CWS manifest file, |
142 ``manifest.json``, is located. | 142 ``manifest.json``, is located. |
143 | 143 |
144 2. Create a subdirectory for each specific architecture that you support, | 144 2. Create a subdirectory for each specific architecture that you support, |
145 and add the files for each architecture in the relevant subdirectory. | 145 and add the files for each architecture in the relevant subdirectory. |
146 | 146 |
147 Here is a sample app directory structure: | 147 Here is a sample app directory structure: |
148 | 148 |
149 .. naclcode:: | 149 .. naclcode:: |
150 :prettyprint: 0 | 150 :prettyprint: 0 |
151 | 151 |
152 |-- my_app_directory/ | 152 |-- my_app_directory/ |
153 | |-- manifest.json | 153 | |-- manifest.json |
154 | |-- my_app.html | 154 | |-- my_app.html |
155 | |-- my_module.nmf | 155 | |-- my_module.nmf |
156 | +-- css/ | 156 | +-- css/ |
157 | +-- images/ | 157 | +-- images/ |
158 | +-- scripts/ | 158 | +-- scripts/ |
159 | |-- **_platform_specific/** | 159 | |-- **_platform_specific/** |
160 | | |-- x86-64/ | 160 | | |-- x86-64/ |
161 | | | |-- my_module_x86_64.nexe | 161 | | | |-- my_module_x86_64.nexe |
162 | | |-- x86-32/ | 162 | | |-- x86-32/ |
163 | | | |-- my_module_x86_32.nexe | 163 | | | |-- my_module_x86_32.nexe |
164 | | |-- arm/ | 164 | | |-- arm/ |
165 | | | |-- my_module_arm.nexe | 165 | | | |-- my_module_arm.nexe |
166 | | |-- all/ | 166 | | |-- all/ |
167 | | | |-- my_module_x86_64.nexe | 167 | | | |-- my_module_x86_64.nexe |
168 | | | |-- my_module_x86_64.nexe | 168 | | | |-- my_module_x86_64.nexe |
169 | | | |-- my_module_x86_32.nexe | 169 | | | |-- my_module_x86_32.nexe |
170 | 170 |
171 Please note a few important points about the app directory structure: | 171 Please note a few important points about the app directory structure: |
172 | 172 |
173 * The architecture-specific subdirectories: | 173 * The architecture-specific subdirectories: |
174 | 174 |
175 * can have arbitrary names; | 175 * can have arbitrary names; |
176 * must be directly under the ``_platform_specific`` directory; and | 176 * must be directly under the ``_platform_specific`` directory; and |
177 * must be listed in the CWS manifest file (see step 3 below). | 177 * must be listed in the CWS manifest file (see step 3 below). |
178 | 178 |
179 * You can include a fallback subdirectory that provides a download package | 179 * You can include a fallback subdirectory that provides a download package |
180 with all the architecture-specific files. (In the example above this | 180 with all the architecture-specific files. (In the example above this |
(...skipping 25 matching lines...) Expand all Loading... |
206 +----------------------+---------------------------------------+ | 206 +----------------------+---------------------------------------+ |
207 | ``sub_package_path`` | the path of the directory (starting | | 207 | ``sub_package_path`` | the path of the directory (starting | |
208 | | with ``_platform_specific``) that | | 208 | | with ``_platform_specific``) that | |
209 | | contains the files for the designated | | 209 | | contains the files for the designated | |
210 | | NaCl architecture | | 210 | | NaCl architecture | |
211 +----------------------+---------------------------------------+ | 211 +----------------------+---------------------------------------+ |
212 | 212 |
213 Here is a sample ``manifest.json`` file: | 213 Here is a sample ``manifest.json`` file: |
214 | 214 |
215 .. naclcode:: | 215 .. naclcode:: |
216 :prettyprint: 0 | 216 :prettyprint: 0 |
217 | 217 |
218 { | 218 { |
219 "name": "My Reminder App", | 219 "name": "My Reminder App", |
220 "description": "A reminder app that syncs across Chrome browsers.", | 220 "description": "A reminder app that syncs across Chrome browsers.", |
221 "manifest_version": 2, | 221 "manifest_version": 2, |
222 "minimum_chrome_version": "28", | 222 "minimum_chrome_version": "28", |
223 "offline_enabled": true, | 223 "offline_enabled": true, |
224 "version": "0.3", | 224 "version": "0.3", |
225 "permissions": [ | 225 "permissions": [ |
226 {"fileSystem": ["write"]}, | 226 {"fileSystem": ["write"]}, |
227 "alarms", | 227 "alarms", |
228 "storage" | 228 "storage" |
229 ], | 229 ], |
230 "app": { | 230 "app": { |
231 "background": { | 231 "background": { |
232 "scripts": ["scripts/background.js"] | 232 "scripts": ["scripts/background.js"] |
233 } | 233 } |
234 }, | 234 }, |
235 "icons": { | 235 "icons": { |
236 "16": "images/icon-16x16.png", | 236 "16": "images/icon-16x16.png", |
237 "128": "images/icon-128x128.png" | 237 "128": "images/icon-128x128.png" |
238 }, | 238 }, |
239 **"platforms": [ | 239 **"platforms": [ |
240 { | 240 { |
241 "nacl_arch": "x86-64", | 241 "nacl_arch": "x86-64", |
242 "sub_package_path": "_platform_specific/x86-64/" | 242 "sub_package_path": "_platform_specific/x86-64/" |
243 }, | 243 }, |
244 { | 244 { |
245 "nacl_arch": "x86-32", | 245 "nacl_arch": "x86-32", |
246 "sub_package_path": "_platform_specific/x86-32/" | 246 "sub_package_path": "_platform_specific/x86-32/" |
247 }, | 247 }, |
248 { | 248 { |
249 "nacl_arch": "arm", | 249 "nacl_arch": "arm", |
250 "sub_package_path": "_platform_specific/arm/" | 250 "sub_package_path": "_platform_specific/arm/" |
251 }, | 251 }, |
252 { | 252 { |
253 "sub_package_path": "_platform_specific/all/" | 253 "sub_package_path": "_platform_specific/all/" |
254 } | 254 } |
255 ]** | 255 ]** |
256 } | 256 } |
257 | 257 |
258 Note the last entry in the CWS manifest file above, which specifies a | 258 Note the last entry in the CWS manifest file above, which specifies a |
259 ``sub_package_path`` without a corresponding ``nacl_arch``. This entry | 259 ``sub_package_path`` without a corresponding ``nacl_arch``. This entry |
260 identifies the fallback directory, which is included in the download | 260 identifies the fallback directory, which is included in the download |
261 package if the user architecture does not match any of the listed NaCl | 261 package if the user architecture does not match any of the listed NaCl |
262 architectures, or if the user is using an older version of Chrome that | 262 architectures, or if the user is using an older version of Chrome that |
263 does not support multi-platform zip files. | 263 does not support multi-platform zip files. |
264 | 264 |
265 4. Modify your application as necessary so that it uses the files for the | 265 4. Modify your application as necessary so that it uses the files for the |
266 correct user architecture. | 266 correct user architecture. |
(...skipping 20 matching lines...) Expand all Loading... |
287 * In the description of your application in the CWS, make sure to mention that | 287 * In the description of your application in the CWS, make sure to mention that |
288 your application is a Native Client application that only works with the | 288 your application is a Native Client application that only works with the |
289 Chrome browser. Also make sure to identify the minimum version of Chrome | 289 Chrome browser. Also make sure to identify the minimum version of Chrome |
290 that your application requires. | 290 that your application requires. |
291 * Hosted and packaged applications have a "launch" parameter in the CWS | 291 * Hosted and packaged applications have a "launch" parameter in the CWS |
292 manifest. This parameter is present only in apps (not extensions), and it | 292 manifest. This parameter is present only in apps (not extensions), and it |
293 tells Google Chrome what to show when a user starts an installed app. For | 293 tells Google Chrome what to show when a user starts an installed app. For |
294 example: | 294 example: |
295 | 295 |
296 .. naclcode:: | 296 .. naclcode:: |
| 297 :prettyprint: 0 |
297 | 298 |
298 "launch": { | 299 "launch": { |
299 "web_url": "http://mail.google.com/mail/" | 300 "web_url": "http://mail.google.com/mail/" |
300 } | 301 } |
301 | 302 |
302 * If you want to write local data using the Pepper | 303 * If you want to write local data using the Pepper |
303 `FileIO </native-client/peppercpp/classpp_1_1_file_i_o>`_ | 304 `FileIO </native-client/peppercpp/classpp_1_1_file_i_o>`_ |
304 API, you must set the 'unlimitedStorage' permission in your Chrome Web | 305 API, you must set the 'unlimitedStorage' permission in your Chrome Web |
305 Store manifest file, just as you would for a JavaScript application that | 306 Store manifest file, just as you would for a JavaScript application that |
306 uses the HTML5 File API. | 307 uses the HTML5 File API. |
307 * For packaged applications, you can only use in-app purchases. | 308 * For packaged applications, you can only use in-app purchases. |
308 * You can place your application in the Google Web Store with access only to | 309 * You can place your application in the Google Web Store with access only to |
309 certain people for testing. See | 310 certain people for testing. See |
310 `Publishing to test accounts </chrome/web-store/docs/publish#testaccounts>`_ | 311 `Publishing to test accounts </chrome/web-store/docs/publish#testaccounts>`_ |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 your application is a Native Client application that only works with the | 388 your application is a Native Client application that only works with the |
388 Chrome browser. Also make sure to identify the version of Chrome that your | 389 Chrome browser. Also make sure to identify the version of Chrome that your |
389 application requires. | 390 application requires. |
390 | 391 |
391 * Hosted and packaged applications have a "launch" parameter in the CWS | 392 * Hosted and packaged applications have a "launch" parameter in the CWS |
392 manifest. This parameter is present only in apps (not extensions), and it | 393 manifest. This parameter is present only in apps (not extensions), and it |
393 tells Google Chrome what to show when a user starts an installed app. For | 394 tells Google Chrome what to show when a user starts an installed app. For |
394 example: | 395 example: |
395 | 396 |
396 .. naclcode:: | 397 .. naclcode:: |
397 :prettyprint: 0 | 398 :prettyprint: 0 |
398 | 399 |
399 "launch": { | 400 "launch": { |
400 "web_url": "http://mail.google.com/mail/" | 401 "web_url": "http://mail.google.com/mail/" |
401 } | 402 } |
402 | 403 |
403 * If you want to write local data using the Pepper | 404 * If you want to write local data using the Pepper |
404 `FileIO </native-client/peppercpp/classpp_1_1_file_i_o>`_ | 405 `FileIO </native-client/peppercpp/classpp_1_1_file_i_o>`_ |
405 API, you must set the 'unlimitedStorage' permission in your Chrome Web | 406 API, you must set the 'unlimitedStorage' permission in your Chrome Web |
406 Store manifest file, just as you would for a JavaScript application that uses | 407 Store manifest file, just as you would for a JavaScript application that uses |
407 the HTML5 File API. | 408 the HTML5 File API. |
408 | 409 |
409 * You can place your application in the Google Web Store with access only to | 410 * You can place your application in the Google Web Store with access only to |
410 certain people for testing. See | 411 certain people for testing. See |
411 `Publishing to test accounts </chrome/web-store/docs/publish#testaccounts>`_ | 412 `Publishing to test accounts </chrome/web-store/docs/publish#testaccounts>`_ |
412 for more information. | 413 for more information. |
413 | 414 |
414 Additional considerations | 415 Additional considerations |
415 ========================= | 416 ========================= |
416 | 417 |
417 Registering Native Client modules to handle MIME types | 418 Registering Native Client modules to handle MIME types |
418 ------------------------------------------------------ | 419 ------------------------------------------------------ |
419 | 420 |
420 If you want Chrome to use a Native Client module to display a particular type | 421 If you want Chrome to use a Native Client module to display a particular type |
421 of content, you can associate the MIME type of that content with the Native | 422 of content, you can associate the MIME type of that content with the Native |
422 Client module. Use the ``nacl_modules`` attribute in the Chrome Web Store | 423 Client module. Use the ``nacl_modules`` attribute in the Chrome Web Store |
423 manifest file to register a Native Client module as the handler for one or more | 424 manifest file to register a Native Client module as the handler for one or more |
424 specific MIME types. For example, the bold code in the snippet below registers | 425 specific MIME types. For example, the bold code in the snippet below registers |
425 a Native Client module as the content handler for the OpenOffice spreadsheet | 426 a Native Client module as the content handler for the OpenOffice spreadsheet |
426 MIME type: | 427 MIME type: |
427 | 428 |
428 .. naclcode:: | 429 .. naclcode:: |
429 :prettyprint: 0 | 430 :prettyprint: 0 |
430 | 431 |
431 { | 432 { |
432 "name": "My Native Client Spreadsheet Viewer", | 433 "name": "My Native Client Spreadsheet Viewer", |
433 "version": "0.1", | 434 "version": "0.1", |
434 "description": "Open spreadsheets right in your browser.", | 435 "description": "Open spreadsheets right in your browser.", |
435 **"nacl_modules": [{ | 436 **"nacl_modules": [{ |
436 "path": "SpreadsheetViewer.nmf", | 437 "path": "SpreadsheetViewer.nmf", |
437 "mime_type": "application/vnd.oasis.opendocument.spreadsheet" | 438 "mime_type": "application/vnd.oasis.opendocument.spreadsheet" |
438 }]** | 439 }]** |
439 } | 440 } |
440 | 441 |
441 The value of "path" is the location of a Native Client manifest file (.nmf) | 442 The value of "path" is the location of a Native Client manifest file (.nmf) |
442 within the application directory. For more information on Native Client | 443 within the application directory. For more information on Native Client |
443 manifest files, see | 444 manifest files, see |
444 `Files in a Native Client application </native-client/overview#application-files
>`_. | 445 `Files in a Native Client application </native-client/overview#application-files
>`_. |
445 | 446 |
446 The value of "mime_type" is a specific MIME type that you want the Native | 447 The value of "mime_type" is a specific MIME type that you want the Native |
447 Client module to handle. Each MIME type can be associated with only one .nmf | 448 Client module to handle. Each MIME type can be associated with only one .nmf |
448 file, but a single .nmf file might handle multiple MIME types. The following | 449 file, but a single .nmf file might handle multiple MIME types. The following |
449 example shows an extension with two .nmf files that handle three MIME types. | 450 example shows an extension with two .nmf files that handle three MIME types. |
450 | 451 |
451 .. naclcode:: | 452 .. naclcode:: |
452 :prettyprint: 0 | 453 :prettyprint: 0 |
453 | 454 |
454 { | 455 { |
455 "name": "My Native Client Spreadsheet and Document Viewer", | 456 "name": "My Native Client Spreadsheet and Document Viewer", |
456 "version": "0.1", | 457 "version": "0.1", |
457 "description": "Open spreadsheets and documents right in your browser.", | 458 "description": "Open spreadsheets and documents right in your browser.", |
458 "nacl_modules": [{ | 459 "nacl_modules": [{ |
| 460 "path": "SpreadsheetViewer.nmf", |
| 461 "mime_type": "application/vnd.oasis.opendocument.spreadsheet" |
| 462 }, |
| 463 { |
459 "path": "SpreadsheetViewer.nmf", | 464 "path": "SpreadsheetViewer.nmf", |
460 "mime_type": "application/vnd.oasis.opendocument.spreadsheet" | 465 "mime_type": "application/vnd.oasis.opendocument.spreadsheet-template" |
461 }, | 466 }, |
462 { | 467 { |
463 "path": "SpreadsheetViewer.nmf", | 468 "path": "DocumentViewer.nmf", |
464 "mime_type": "application/vnd.oasis.opendocument.spreadsheet-template" | 469 "mime_type": "application/vnd.oasis.opendocument.text" |
465 }, | 470 }] |
466 { | 471 } |
467 "path": "DocumentViewer.nmf", | |
468 "mime_type": "application/vnd.oasis.opendocument.text" | |
469 }] | |
470 } | |
471 | 472 |
472 The ``nacl_modules`` attribute is optional---specify this attribute only if | 473 The ``nacl_modules`` attribute is optional---specify this attribute only if |
473 you want Chrome to use a Native Client module to display a particular type of | 474 you want Chrome to use a Native Client module to display a particular type of |
474 content. | 475 content. |
475 | 476 |
476 Using CWS inline install | 477 Using CWS inline install |
477 ------------------------ | 478 ------------------------ |
478 | 479 |
479 Once you've published an application, you may be wondering how users will find | 480 Once you've published an application, you may be wondering how users will find |
480 and install the application. For users who browse the Chrome Web Store and find | 481 and install the application. For users who browse the Chrome Web Store and find |
481 your application, installing the application is a simple one-click process. | 482 your application, installing the application is a simple one-click process. |
482 However, if a user is already on your site, it can be cumbersome for them to | 483 However, if a user is already on your site, it can be cumbersome for them to |
483 complete the installation---they would need to navigate away from your site | 484 complete the installation---they would need to navigate away from your site |
484 to the CWS, complete the installation process, and then return to your site. To | 485 to the CWS, complete the installation process, and then return to your site. To |
485 address this issue, you can initiate installation of applications "inline" from | 486 address this issue, you can initiate installation of applications "inline" from |
486 your site---the applications are still hosted in the Chrome Web Store, but | 487 your site---the applications are still hosted in the Chrome Web Store, but |
487 users no longer have to leave your site to install them. See | 488 users no longer have to leave your site to install them. See |
488 `Using Inline Installation </chrome/web-store/docs/inline_installation>`_ | 489 `Using Inline Installation </chrome/web-store/docs/inline_installation>`_ |
489 for information on how to use this feature. | 490 for information on how to use this feature. |
490 | 491 |
491 Monetizing applications and extensions | 492 Monetizing applications and extensions |
492 -------------------------------------- | 493 -------------------------------------- |
493 | 494 |
494 Google provides three primary monetization options for Native Client | 495 Google provides three primary monetization options for Native Client |
495 applications: in-app payments, one-time charges, and subscriptions. Refer to | 496 applications: in-app payments, one-time charges, and subscriptions. Refer to |
496 `Monetizing Your App </chrome/web-store/docs/money>`_ | 497 `Monetizing Your App </chrome/web-store/docs/money>`_ |
497 to learn about these options. The | 498 to learn about these options. The |
498 `Chrome Web Store Overview </chrome/web-store/docs/>`_ | 499 `Chrome Web Store Overview </chrome/web-store/docs/>`_ |
499 also has information on different approaches to charging for your application. | 500 also has information on different approaches to charging for your application. |
OLD | NEW |