| OLD | NEW |
| 1 <!DOCTYPE html><!-- This page is a placeholder for generated extensions api doc.
Note: | 1 <!DOCTYPE html><!-- This page is a placeholder for generated extensions api doc.
Note: |
| 2 1) The <head> information in this page is significant, should be uniform | 2 1) The <head> information in this page is significant, should be uniform |
| 3 across api docs and should be edited only with knowledge of the | 3 across api docs and should be edited only with knowledge of the |
| 4 templating mechanism. | 4 templating mechanism. |
| 5 3) All <body>.innerHTML is genereated as an rendering step. If viewed in a | 5 3) All <body>.innerHTML is genereated as an rendering step. If viewed in a |
| 6 browser, it will be re-generated from the template, json schema and | 6 browser, it will be re-generated from the template, json schema and |
| 7 authored overview content. | 7 authored overview content. |
| 8 4) The <body>.innerHTML is also generated by an offline step so that this | 8 4) The <body>.innerHTML is also generated by an offline step so that this |
| 9 page may easily be indexed by search engines. | 9 page may easily be indexed by search engines. |
| 10 --><html xmlns="http://www.w3.org/1999/xhtml"><head> | 10 --><html xmlns="http://www.w3.org/1999/xhtml"><head> |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 </div> | 192 </div> |
| 193 <!-- /TABLE OF CONTENTS --> | 193 <!-- /TABLE OF CONTENTS --> |
| 194 | 194 |
| 195 <!-- STATIC CONTENT PLACEHOLDER --> | 195 <!-- STATIC CONTENT PLACEHOLDER --> |
| 196 <div id="static"><div id="pageData-title" class="pageData">NPAPI Plugins
</div> | 196 <div id="static"><div id="pageData-title" class="pageData">NPAPI Plugins
</div> |
| 197 | 197 |
| 198 <p> | 198 <p> |
| 199 Leveraging HTML and JavaScript | 199 Leveraging HTML and JavaScript |
| 200 makes developing new extensions really easy, | 200 makes developing new extensions really easy, |
| 201 but what if you have existing legacy or proprietary code | 201 but what if you have existing legacy or proprietary code |
| 202 that you want to reuse in your extension? | 202 that you want to reuse in your extension? |
| 203 You can bundle an NPAPI plugin with your extension, | 203 You can bundle an NPAPI plugin with your extension, |
| 204 allowing you to call into native binary code from JavaScript. | 204 allowing you to call into native binary code from JavaScript. |
| 205 </p> | 205 </p> |
| 206 | 206 |
| 207 <h2>Details</h2> | 207 <h2>Details</h2> |
| 208 | 208 |
| 209 <p> | 209 <p> |
| 210 How to develop an NPAPI plugin is outside the scope of this document. | 210 How to develop an NPAPI plugin is outside the scope of this document. |
| 211 See <a href="https://developer.mozilla.org/en/Plugins">Mozilla's | 211 See <a href="https://developer.mozilla.org/en/Plugins">Mozilla's |
| 212 NPAPI plugin reference</a> for information on how to do that. | 212 NPAPI plugin reference</a> for information on how to do that. |
| 213 </p> | 213 </p> |
| 214 | 214 |
| 215 <p> | 215 <p> |
| 216 Once you have an NPAPI plugin, | 216 Once you have an NPAPI plugin, |
| 217 follow these steps to get your extension using it. | 217 follow these steps to get your extension using it. |
| 218 </p> | 218 </p> |
| 219 | 219 |
| 220 <ol> | 220 <ol> |
| 221 <li> | 221 <li> |
| 222 Add a section to your extension's <code>manifest.json</code> | 222 Add a section to your extension's <code>manifest.json</code> |
| 223 that describes where to find the plugin, | 223 that describes where to find the plugin, |
| 224 along with other properties about it: | 224 along with other properties about it: |
| 225 | 225 |
| 226 <pre>{ | 226 <pre>{ |
| 227 "name": "My extension", | 227 "name": "My extension", |
| 228 ... | 228 ... |
| 229 <b> "plugins": [ | 229 <b> "plugins": [ |
| 230 { "path": "content_plugin.dll", "public": true }, | 230 { "path": "content_plugin.dll", "public": true }, |
| 231 { "path": "extension_plugin.dll" } | 231 { "path": "extension_plugin.dll" } |
| 232 ]</b> | 232 ]</b> |
| 233 }</pre> | 233 }</pre> |
| 234 | 234 |
| 235 <p> | 235 <p> |
| 236 The "path" property specifies the path to your plugin, | 236 The "path" property specifies the path to your plugin, |
| 237 relative to the manifest file. | 237 relative to the manifest file. |
| 238 The "public" property specifies whether | 238 The "public" property specifies whether |
| 239 your plugin can be accessed by regular web pages; | 239 your plugin can be accessed by regular web pages; |
| 240 the default is false, | 240 the default is false, |
| 241 meaning only your extension can load the plugin. | 241 meaning only your extension can load the plugin. |
| 242 </p> | 242 </p> |
| 243 </li> | 243 </li> |
| 244 | 244 |
| 245 <li> | 245 <li> |
| 246 Create an HTML file that loads your plugin by mime-type. | 246 Create an HTML file that loads your plugin by mime-type. |
| 247 Assuming your mime-type is "application/x-my-extension": | 247 Assuming your mime-type is "application/x-my-extension": |
| 248 | 248 |
| 249 <pre><embed type="application/x-my-extension" id="pluginId"> | 249 <pre><embed type="application/x-my-extension" id="pluginId"> |
| 250 <script> | 250 <script> |
| 251 var plugin = document.getElementById("pluginId"); | 251 var plugin = document.getElementById("pluginId"); |
| 252 var result = plugin.myPluginMethod(); // call a method in your plugin | 252 var result = plugin.myPluginMethod(); // call a method in your plugin |
| 253 console.log("my plugin returned: " + result); | 253 console.log("my plugin returned: " + result); |
| 254 </script></pre> | 254 </script></pre> |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 <div id="pageFooter" --=""> | 409 <div id="pageFooter" --=""> |
| 410 <p> | 410 <p> |
| 411 Except as otherwise <a href="http://code.google.com/policies.html#restrictions
">noted</a>, | 411 Except as otherwise <a href="http://code.google.com/policies.html#restrictions
">noted</a>, |
| 412 the content of this page is licensed under the <a rel="license" href="http://c
reativecommons.org/licenses/by/3.0/">Creative Commons | 412 the content of this page is licensed under the <a rel="license" href="http://c
reativecommons.org/licenses/by/3.0/">Creative Commons |
| 413 Attribution 3.0 License</a>, and code samples are licensed under the | 413 Attribution 3.0 License</a>, and code samples are licensed under the |
| 414 <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD Lic
ense</a>. | 414 <a rel="license" href="http://code.google.com/google_bsd_license.html">BSD Lic
ense</a>. |
| 415 </p> | 415 </p> |
| 416 <p> | 416 <p> |
| 417 ©2009 Google | 417 ©2009 Google |
| 418 </p> | 418 </p> |
| 419 |
| 420 <!-- begin analytics --> |
| 421 <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"><
/script> |
| 422 <script src="http://www.google-analytics.com/ga.js" type="text/javascript"></scr
ipt> |
| 423 |
| 424 <script type="text/javascript"> |
| 425 // chrome doc tracking |
| 426 try { |
| 427 var engdocs = _gat._getTracker("YT-10763712-2"); |
| 428 engdocs._trackPageview(); |
| 429 } catch(err) {} |
| 430 |
| 431 // code.google.com site-wide tracking |
| 432 try { |
| 433 _uacct="UA-18071-1"; |
| 434 _uanchor=1; |
| 435 _uff=0; |
| 436 urchinTracker(); |
| 437 } |
| 438 catch(e) {/* urchinTracker not available. */} |
| 439 </script> |
| 440 <!-- end analytics --> |
| 441 |
| 419 </div> <!-- /pageFooter --> | 442 </div> <!-- /pageFooter --> |
| 420 </div> <!-- /container --> | 443 </div> <!-- /container --> |
| 421 </body></html> | 444 </body></html> |
| 422 | 445 |
| OLD | NEW |