| OLD | NEW |
| 1 <!DOCTYPE html><!-- This page is a placeholder for generated extensions api doc.
Note: 1) The <head> information in this page is significant, should be uniform
across api docs and should be edited only with knowledge of the templating mecha
nism. 2) The <body> tag *must* retain id="body" 3) All <body>.innerHTML is gener
eated as an rendering step. If viewed in a browser, it will be re-generated from
the template, json schema and authored overview content. 4) The <body>.innerHTM
L is also generated by an offline step so that this page may easily be indexed b
y search engines. TODO(rafaelw): Abstract this into a "pageshell" that becomes t
he single version of page template shell and the "instance" pages (bookmarks.htm
l, etc...) can be generated with a build step. --><!-- <html> must retain id="te
mplate --><html xmlns="http://www.w3.org/1999/xhtml" jstcache="0"><!-- <head> da
ta is significant and loads the needed libraries and styles --><head jstcache="0
"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" jstcache="
0"> <title jscontent="getPageTitle()" jstcache="1">NPAPI Plugins</title> <link h
ref="css/ApiRefStyles.css" rel="stylesheet" type="text/css" jstcache="0"> <scrip
t type="text/javascript" src="../../../third_party/jstemplate/jstemplate_compile
d.js" jstcache="0"> </script> <script type="text/javascript" src="js/api_page_ge
nerator.js" jstcache="0"></script> <script type="text/javascript" src="js/bootst
rap.js" jstcache="0"></script> </head><!-- <body> content is completely generate
d. Do not edit, as it will be and rewritten. --><body jstcache="0"> <div id="con
tainer" jstcache="0"> <a name="top" jstcache="0"> </a> <!-- API HEADER --> <div
id="pageHeader" jstcache="0"> <div id="searchbox" jstcache="0"> <form action="ht
tp://www.google.com/cse" id="cse-search-box" jstcache="0"> <div jstcache="0"> <i
nput type="hidden" name="cx" value="002967670403910741006:61_cvzfqtno" jstcache=
"0"> <input type="hidden" name="ie" value="UTF-8" jstcache="0"> <input type="tex
t" name="q" size="31" jstcache="0"> <input type="submit" name="sa" value="Search
" jstcache="0"> </div> </form> <script type="text/javascript" src="http://www.go
ogle.com/jsapi" jstcache="0"></script> <script type="text/javascript" jstcache="
0">google.load("elements", "1", {packages: "transliteration"});</script> <script
type="text/javascript" src="http://www.google.com/coop/cse/t13n?form=cse-search
-box&t13n_langs=en" jstcache="0"></script> <script type="text/javascript" sr
c="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en" jstcach
e="0"></script> </div> <div id="pageTitle" jstcache="0"> <h1 jscontent="getPageT
itle()" jstcache="1">NPAPI Plugins</h1> </div> </div> <!-- /pageHeader --> <div
id="pageContent" jstcache="0"> <!-- SIDENAV --> <div id="leftNav" jstcache="0">
<ul jstcache="0"> <li jstcache="0"> <a href="index.html" jstcache="0">Home</a></
li> <li jstcache="0"> <a href="getstarted.html" jstcache="0">Getting Started</a>
</li> <li jstcache="0"> <a href="overview.html" jstcache="0">Overview</a></li> <
li jstcache="0"> <a href="devguide.html" jstcache="0"><div jstcache="0">Develope
r's Guide</div></a> <ul jstcache="0"> <li jstcache="0"><a href="toolstrip.html"
jstcache="0">Toolstrips</a></li> <li jstcache="0"><a href="pageActions.html" jst
cache="0">Page Actions</a></li> <li jstcache="0"><a href="background_pages.html"
jstcache="0">Background Pages</a></li> <li jstcache="0"><a href="content_script
s.html" jstcache="0">Content Scripts</a></li> <li jstcache="0">Events</li> <li j
stcache="0"><a href="tabs.html" jstcache="0">Tabs</a></li> <li jstcache="0"><a h
ref="windows.html" jstcache="0">Windows</a></li> <li jstcache="0"><a href="bookm
arks.html" jstcache="0">Bookmarks</a></li> <li jstcache="0">Themes</li> <li jstc
ache="0" class="leftNavSelected">NPAPI Plugins</li> <li jstcache="0"><a href="pa
ckaging.html" jstcache="0">Packaging</a></li> <li jstcache="0">Autoupdate</li> <
/ul> </li> <li jstcache="0"><a href="tutorials.html" jstcache="0"><div jstcache=
"0">Tutorials</div></a> <ul jstcache="0"> <li jstcache="0"><a href="tut_debuggin
g.html" jstcache="0">Debugging</a></li> </ul> </li> <li jstcache="0">Reference <
ul jstcache="0"> <li jstcache="0"> Formats <ul jstcache="0"> <li jstcache="0"><a
href="manifest.html" jstcache="0">Manifest Files</a></li> <li jstcache="0">Matc
h Patterns</li> <li jstcache="0">Packages (.crx)</li> </ul> </li> <li jstcache="
0"> <a href="api_index.html" jstcache="0">chrome.* APIs</a> </li> <li jstcache="
0"> <a href="api_other.html" jstcache="0">Other APIs</a> </li> </ul> </li> <li j
stcache="0"><a href="http://dev.chromium.org/developers/design-documents/extensi
ons/samples" jstcache="0">Samples</a></li> </ul> </div> <div id="mainColumn" jst
cache="0"> <!-- TABLE OF CONTENTS --> <div id="toc" jsdisplay="showPageTOC()" js
tcache="2" style="display: none; "> <p jstcache="0">Contents</p> <ol jstcache="0
"> <li jsselect="getStaticTOC()" jstcache="9"> <a jscontent="name" jsvalues=".hr
ef:'#' + href" jstcache="14">h2Name</a> <ol jstcache="0"> <li jsselect="$this.ch
ildren" jstcache="22"> <a jscontent="name" jsvalues=".href:'#' + href" jstcache=
"14">h3Name</a> </li> </ol> </li> <div jsselect="apiDefinition" jstcache="3"> <l
i jstcache="0"> <a href="#apiReference" jscontent="'API reference: ' + getModule
Name()" jstcache="4">API reference</a> <ol jstcache="0"> <li jsdisplay="$this.pr
operties" jstcache="5"> <a href="#properties" jstcache="0">Properties</a> <ol js
tcache="0"> <li jsselect="getPropertyListFromObject($this)" jstcache="10"> <a js
content="name" jsvalues=".href:'#property-' + name" href="#property-anchor" jstc
ache="41">propertyName</a> </li> </ol> </li> <li jsdisplay="functions &&
functions.length > 0" jstcache="6"> <a href="#methods" jstcache="0">Methods<
/a> <ol jstcache="0"> <li jsselect="functions" jstcache="11"> <a jscontent="name
" jsvalues=".href:'#method-' + name" href="#method-anchor" jstcache="42">methodN
ame</a> </li> </ol> </li> <li jsdisplay="events && events.length > 0"
jstcache="7"> <a href="#events" jstcache="0">Events</a> <ol jstcache="0"> <li j
sselect="events" jstcache="12"> <a jscontent="name" jsvalues=".href:'#event-' +
name" href="#event-anchor" jstcache="43">eventName</a> </li> </ol> </li> <li jsd
isplay="types && types.length > 0" jstcache="8"> <a href="#types" jst
cache="0">Types</a> <ol jstcache="0"> <li jsselect="types" jstcache="13"> <a jsc
ontent="id" jsvalues=".href:'#type-' + id" href="#id-anchor" jstcache="44">id</a
> </li> </ol> </li> </ol> </li> </div> </ol> </div> <!-- /TABLE OF CONTENTS -->
<!-- STATIC CONTENT PLACEHOLDER --> <div id="static" jstcache="0"><div id="pageD
ata-title" class="pageData" jstcache="0">NPAPI Plugins</div> <p jstcache="0"> Le
veraging HTML and JavaScript makes developing new extensions really easy, but wh
at if you have existing legacy or proprietary code that you want to reuse in you
r extension? You can bundle an NPAPI plugin with your extension, allowing you to
call into native binary code from JavaScript. </p> <h2 jstcache="0">Details</h2
> <p jstcache="0"> How to develop an NPAPI plugin is outside the scope of this d
ocument. See <a href="https://developer.mozilla.org/en/Plugins" jstcache="0">Moz
illa's NPAPI plugin reference</a> for information on how to do that. </p> <p jst
cache="0"> Once you have an NPAPI plugin, follow these steps to get your extensi
on using it. </p> <ol jstcache="0"> <li jstcache="0"> Add a section to your exte
nsion's <code jstcache="0">manifest.json</code> that describes where to find the
plugin, along with other properties about it: <pre jstcache="0">{ "name": "My e
xtension", ... <b jstcache="0"> "plugins": [ { "path": "content_plugin.dll", "pu
blic": true }, { "path": "extension_plugin.dll" } ]</b> }</pre> <p jstcache="0">
The "path" property specifies the path to your plugin, relative to the manifest
file. The "public" property specifies whether your plugin can be accessed by re
gular web pages; the default is false, meaning only your extension can load the
plugin. </p> </li> <li jstcache="0"> Create an HTML file that loads your plugin
by mime-type. Assuming your mime-type is "application/x-my-extension": <pre jstc
ache="0"><embed type="application/x-my-extension" id="pluginId"> <scrip
t> var plugin = document.getElementById("pluginId"); var result = plugin.myPl
uginMethod(); // call a method in your plugin console.log("my plugin returned: "
+ result); </script></pre> <p jstcache="0"> This can be inside a toolstri
p, a background page, or any other HTML page used by your extension. If your plu
gin is "public", you can even use a content script to programmatically insert yo
ur plugin into a web page. </p> </li></ol></div> <!-- API PAGE --> <div class="a
piPage" jsselect="apiDefinition" jstcache="3" style="display: none; "> <a name="
apiReference" jstcache="0"></a> <h2 jscontent="'API reference: ' + getModuleName
()" jstcache="4">API reference: chrome.apiname </h2> <!-- PROPERTIES --> <div js
display="$this.properties" class="apiGroup" jstcache="5"> <a name="properties" j
stcache="0"></a> <h3 id="properties" jstcache="0">Properties</h3> <div jsselect=
"getPropertyListFromObject($this)" jstcache="10"> <a jsvalues=".name:'property-'
+ name" jstcache="15"></a> <h4 jscontent="name" jstcache="16">getLastError</h4>
<div class="summary" jstcache="0"> <!-- Note: intentionally longer 80 columns -
-> <span jscontent="getModuleName() + '.'" jstcache="23">chrome.extension</span>
<span jscontent="$this.name" jstcache="24">lastError</span> </div> <div transclu
de="valueTemplate" jstcache="17"> </div> </div> </div> <!-- /apiGroup --> <!-- M
ETHODS --> <div jsdisplay="functions && functions.length > 0" class="
apiGroup" id="methods" jstcache="6"> <a name="methods" jstcache="0"></a> <h3 jst
cache="0">Methods</h3> <!-- iterates over all functions --> <div class="apiItem"
jsselect="functions" jstcache="11"> <a jsvalues=".name:'method-' + name" jstcac
he="18"></a> <!-- method-anchor --> <h4 jscontent="name" jstcache="16">method na
me</h4> <div class="summary" jstcache="0"><span jsdisplay="returns" jscontent="g
etTypeName(returns)" jstcache="25">void</span> <!-- Note: intentionally longer 8
0 columns --> <span jscontent="getFullyQualifiedFunctionName($this)" jstcache="2
6">chrome.module.methodName</span>(<span jsselect="parameters" jsvalues="class:o
ptional ? 'optional' : ''" jstcache="27"><span jsdisplay="$index" jstcache="33">
, </span><span jscontent="getTypeName($this)" jstcache="34"></span> <var jstcach
e="0"><span jscontent="name" jstcache="16"></span></var></span>)</div> <div clas
s="description" jstcache="0"> <p class="todo" jsdisplay="!description" jstcache=
"28">Undocumented.</p> <p jsdisplay="description" jsvalues=".innerHTML:descripti
on" jstcache="29"> A description from the json schema def of the function goes h
ere. </p> <!-- PARAMETERS --> <h4 jstcache="0">Parameters</h4> <dl jstcache="0">
<div jsselect="parameters" jstcache="35"> <!-- VALUE: This is a subtemplate tha
t is used elsewhere via jsTemplate *transclude* --> <div id="valueTemplate" jstc
ache="0"> <dt jstcache="0"> <var jsdisplay="$this.name" jscontent="$this.name" j
stcache="45">paramName</var> <em jstcache="0"> <!-- TYPE --> <div style="display
:inline" jstcache="0"> ( <span class="optional" jsdisplay="optional" jstcache="4
6">optional</span> <span id="typeTemplate" jstcache="0"> <span jsdisplay="getTyp
eRef($this)" jstcache="47"> <a jsvalues=".href: getTypeRefPage($this) + '#type-'
+ getTypeRef($this)" jscontent="getTypeRef($this)" jstcache="49"> Type</a> </sp
an> <span jsdisplay="!getTypeRef($this)" jstcache="48"> <span jsdisplay="isArray
($this)" jstcache="50"> array of <span jsselect="items" jstcache="52"><span tran
sclude="typeTemplate" jstcache="53"></span></span> </span> <span jsdisplay="!isA
rray($this)" jscontent="getTypeName($this)" jstcache="51">paramType</span> </spa
n> </span> ) </div> </em> </dt> <dd class="todo" jsdisplay="!$this.description"
jstcache="38"> Undocumented. </dd> <dd jsdisplay="$this.description" jsvalues=".
innerHTML:$this.description" jstcache="39"> Description of this parameter from t
he json schema. </dd> <!-- OBJECT PROPERTIES --> <dd jsdisplay="shouldExpandObje
ct($this)" jstcache="40"> <dl jstcache="0"> <div jsselect="getPropertyListFromOb
ject($this)" jstcache="10"> <div transclude="valueTemplate" jstcache="17"> </div
> </div> </dl> </dd> </div> <!-- /VALUE --> </div> </dl> <!-- RETURNS --> <h4 js
display="returns" jstcache="30">Returns</h4> <dl jstcache="0"> <div jsselect="re
turns" jstcache="36"> <div transclude="valueTemplate" jstcache="17"> </div> </di
v> </dl> <!-- CALLBACK --> <div jsdisplay="hasCallback(parameters)" jstcac
he="31"> <div jsselect="getCallbackParameters(parameters)" jstcache="37"> <h4 js
tcache="0">Callback function</h4> <p jstcache="0"> If you specify the <em jstcac
he="0">callback</em> parameter, it should specify a function that looks like thi
s: </p> <!-- Note: intentionally longer 80 columns --> <pre jstcache="0">functio
n(<span jscontent="getSignatureString(parameters)" jstcache="32">Type param1, Ty
pe param2</span>) <span class="subdued" jstcache="0">{...}</span>);</pre> <dl js
tcache="0"> <div jsselect="parameters" jstcache="35"> <div transclude="valueTemp
late" jstcache="17"> </div> </div> </dl> </div> </div> </div> <!-- /description
--> </div> <!-- /apiItem --> </div> <!-- /apiGroup --> <!-- EVENTS --> <div jsdi
splay="events && events.length > 0" class="apiGroup" jstcache="7"> <a
name="events" jstcache="0"></a> <h3 id="events" jstcache="0">Events</h3> <!-- i
terates over all events --> <div jsselect="events" class="apiItem" jstcache="12"
> <a jsvalues=".name:'event-' + name" jstcache="19"></a> <h4 jscontent="name" js
tcache="16">event name</h4> <div class="summary" jstcache="0"> <!-- Note: intent
ionally longer 80 columns --> <span jscontent="getModuleName() + '.'" class="sub
dued" jstcache="23">chrome.bookmarks</span><span jscontent="name" jstcache="16">
onEvent</span><span class="subdued" jstcache="0">.addListener</span>(function(<s
pan jscontent="getSignatureString(parameters)" jstcache="32">Type param1, Type p
aram2</span>) <span class="subdued" jstcache="0">{...}</span>); </div> <div clas
s="description" jstcache="0"> <p class="todo" jsdisplay="!description" jstcache=
"28">Undocumented.</p> <p jsdisplay="description" jsvalues=".innerHTML:descripti
on" jstcache="29"> A description from the json schema def of the event goes here
. </p> <!-- PARAMETERS --> <h4 jstcache="0">Parameters</h4> <dl jstcache="0"> <d
iv jsselect="parameters" jstcache="35"> <div transclude="valueTemplate" jstcache
="17"> </div> </div> </dl> </div> <!-- /decription --> </div> <!-- /apiItem -->
</div> <!-- /apiGroup --> <!-- TYPES --> <div jsdisplay="types && types.
length > 0" class="apiGroup" jstcache="8"> <a name="types" jstcache="0"></a>
<h3 id="types" jstcache="0">Types</h3> <!-- iterates over all types --> <div jss
elect="types" class="apiItem" jstcache="13"> <a jsvalues=".name:'type-' + id" js
tcache="20"></a> <h4 jscontent="id" jstcache="21">type name</h4> <div transclude
="valueTemplate" jstcache="17"> </div> </div> <!-- /apiItem --> </div> <!-- /api
Group --> </div> <!-- /apiPage --> </div> <!-- /mainColumn --> </div> <!-- /page
Content --> <div id="pageFooter" --="" jstcache="0"> <p jstcache="0"> Except as
otherwise <a href="http://code.google.com/policies.html#restrictions" jstcache="
0">noted</a>, the content of this page is licensed under the <a rel="license" hr
ef="http://creativecommons.org/licenses/by/3.0/" jstcache="0">Creative Commons A
ttribution 3.0 License</a>, and code samples are licensed under the <a rel="lice
nse" href="http://code.google.com/google_bsd_license.html" jstcache="0">BSD Lice
nse</a>. </p> <p jstcache="0"> ©2009 Google </p> </div> <!-- /pageFooter --> </d
iv> <!-- /container --> </body></html> | 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 |
| 3 across api docs and should be edited only with knowledge of the |
| 4 templating mechanism. |
| 5 2) The <body> tag *must* retain id="body" |
| 6 3) All <body>.innerHTML is genereated as an rendering step. If viewed in a |
| 7 browser, it will be re-generated from the template, json schema and |
| 8 authored overview content. |
| 9 4) The <body>.innerHTML is also generated by an offline step so that this |
| 10 page may easily be indexed by search engines. |
| 11 |
| 12 TODO(rafaelw): Abstract this into a "pageshell" that becomes the single |
| 13 version of page template shell and the "instance" pages (bookmarks.html, |
| 14 etc...) can be generated with a build step. |
| 15 --><!-- <html> must retain id="template --><html xmlns="http://www.w3.org/1999/x
html" jstcache="0"><!-- <head> data is significant and loads the needed librarie
s and styles --><head jstcache="0"> |
| 16 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" jstcache=
"0"> |
| 17 <title jscontent="getPageTitle()" jstcache="1">NPAPI Plugins</title> |
| 18 <link href="css/ApiRefStyles.css" rel="stylesheet" type="text/css" jstcache=
"0"> |
| 19 <script type="text/javascript" src="../../../third_party/jstemplate/jstempla
te_compiled.js" jstcache="0"> |
| 20 </script> |
| 21 <script type="text/javascript" src="js/api_page_generator.js" jstcache="0"><
/script> |
| 22 <script type="text/javascript" src="js/bootstrap.js" jstcache="0"></script> |
| 23 </head><!-- <body> content is completely generated. Do not edit, as it will be |
| 24 and rewritten. --><body jstcache="0"> <div id="container" jstcache="0"> |
| 25 <a name="top" jstcache="0"> </a> |
| 26 <!-- API HEADER --> |
| 27 <div id="pageHeader" jstcache="0"> |
| 28 <div id="searchbox" jstcache="0"> |
| 29 <form action="http://www.google.com/cse" id="cse-search-box" jstcache="0
"> |
| 30 <div jstcache="0"> |
| 31 <input type="hidden" name="cx" value="002967670403910741006:61_cvzfq
tno" jstcache="0"> |
| 32 <input type="hidden" name="ie" value="UTF-8" jstcache="0"> |
| 33 <input type="text" name="q" size="31" jstcache="0"> |
| 34 <input type="submit" name="sa" value="Search" jstcache="0"> |
| 35 </div> |
| 36 </form> |
| 37 |
| 38 <script type="text/javascript" src="http://www.google.com/jsapi" jstcach
e="0"></script> |
| 39 <script type="text/javascript" jstcache="0">google.load("elements", "1",
{packages: "transliteration"});</script> |
| 40 <script type="text/javascript" src="http://www.google.com/coop/cse/t13n?
form=cse-search-box&t13n_langs=en" jstcache="0"></script> |
| 41 <script type="text/javascript" src="http://www.google.com/coop/cse/brand
?form=cse-search-box&lang=en" jstcache="0"></script> |
| 42 </div> |
| 43 <div id="pageTitle" jstcache="0"> |
| 44 <h1 jscontent="getPageTitle()" jstcache="1">NPAPI Plugins</h1> |
| 45 </div> |
| 46 </div> <!-- /pageHeader --> |
| 47 |
| 48 <div id="pageContent" jstcache="0"> |
| 49 <!-- SIDENAV --> |
| 50 <div id="leftNav" jstcache="0"> |
| 51 <ul jstcache="0"> |
| 52 <li jstcache="0"> <a href="index.html" jstcache="0">Home</a></li> |
| 53 <li jstcache="0"> <a href="getstarted.html" jstcache="0">Getting Start
ed</a></li> |
| 54 <li jstcache="0"> <a href="overview.html" jstcache="0">Overview</a></l
i> |
| 55 <li jstcache="0"> <a href="devguide.html" jstcache="0"><div jstcache="
0">Developer's Guide</div></a> |
| 56 <ul jstcache="0"> |
| 57 <li jstcache="0"><a href="toolstrip.html" jstcache="0">Toolstrips<
/a></li> |
| 58 <li jstcache="0"><a href="pageActions.html" jstcache="0">Page Acti
ons</a></li> |
| 59 <li jstcache="0"><a href="background_pages.html" jstcache="0">Back
ground Pages</a></li> |
| 60 <li jstcache="0"><a href="content_scripts.html" jstcache="0">Conte
nt Scripts</a></li> |
| 61 <li jstcache="0"><a href="events.html" jstcache="0">Events</a></li
> |
| 62 <li jstcache="0"><a href="tabs.html" jstcache="0">Tabs</a></li> |
| 63 <li jstcache="0"><a href="windows.html" jstcache="0">Windows</a></
li> |
| 64 <li jstcache="0"><a href="bookmarks.html" jstcache="0">Bookmarks</
a></li> |
| 65 <li jstcache="0"><a href="themes.html" jstcache="0">Themes</a></li
> |
| 66 <li jstcache="0" class="leftNavSelected">NPAPI Plugins</li> |
| 67 <li jstcache="0"><a href="packaging.html" jstcache="0">Packaging</
a></li> |
| 68 <li jstcache="0">Autoupdate</li> |
| 69 </ul> |
| 70 </li> |
| 71 <li jstcache="0"><a href="tutorials.html" jstcache="0"><div jstcache="
0">Tutorials</div></a> |
| 72 <ul jstcache="0"> |
| 73 <li jstcache="0"><a href="tut_debugging.html" jstcache="0">Debuggi
ng</a></li> |
| 74 </ul> |
| 75 </li> |
| 76 <li jstcache="0">Reference |
| 77 <ul jstcache="0"> |
| 78 <li jstcache="0"> Formats |
| 79 <ul jstcache="0"> |
| 80 <li jstcache="0"><a href="manifest.html" jstcache="0">Manifest
Files</a></li> |
| 81 <li jstcache="0"><a href="match_patterns.html" jstcache="0">Ma
tch Patterns</a></li> |
| 82 <li jstcache="0">Packages (.crx)</li> |
| 83 </ul> |
| 84 </li> |
| 85 <li jstcache="0"> <a href="api_index.html" jstcache="0">chrome.* A
PIs</a> </li> |
| 86 <li jstcache="0"> <a href="api_other.html" jstcache="0">Other APIs
</a> </li> |
| 87 </ul> |
| 88 </li> |
| 89 <li jstcache="0"><a href="http://dev.chromium.org/developers/design-doc
uments/extensions/samples" jstcache="0">Samples</a></li> |
| 90 </ul> |
| 91 </div> |
| 92 |
| 93 <div id="mainColumn" jstcache="0"> |
| 94 <!-- TABLE OF CONTENTS --> |
| 95 <div id="toc" jsdisplay="showPageTOC()" jstcache="2" style="display: non
e; "> |
| 96 <p jstcache="0">Contents</p> |
| 97 <ol jstcache="0"> |
| 98 <li jsselect="getStaticTOC()" jstcache="9"> |
| 99 <a jscontent="name" jsvalues=".href:'#' + href" jstcache="14">h2Na
me</a> |
| 100 <ol jstcache="0"> |
| 101 <li jsselect="$this.children" jstcache="22"> |
| 102 <a jscontent="name" jsvalues=".href:'#' + href" jstcache="14">
h3Name</a> |
| 103 </li> |
| 104 </ol> |
| 105 </li> |
| 106 <div jsselect="apiDefinition" jstcache="3"> |
| 107 <li jstcache="0"> |
| 108 <a href="#apiReference" jscontent="'API reference: ' + getModule
Name()" jstcache="4">API reference</a> |
| 109 <ol jstcache="0"> |
| 110 <li jsdisplay="$this.properties" jstcache="5"> |
| 111 <a href="#properties" jstcache="0">Properties</a> |
| 112 <ol jstcache="0"> |
| 113 <li jsselect="getPropertyListFromObject($this)" jstcache="
10"> |
| 114 <a jscontent="name" jsvalues=".href:'#property-' + name"
href="#property-anchor" jstcache="42">propertyName</a> |
| 115 </li> |
| 116 </ol> |
| 117 </li> |
| 118 <li jsdisplay="functions && functions.length > 0" j
stcache="6"> |
| 119 <a href="#methods" jstcache="0">Methods</a> |
| 120 <ol jstcache="0"> |
| 121 <li jsselect="functions.sort(sortByName)" jstcache="11"> |
| 122 <a jscontent="name" jsvalues=".href:'#method-' + name" h
ref="#method-anchor" jstcache="43">methodName</a> |
| 123 </li> |
| 124 </ol> |
| 125 </li> |
| 126 <li jsdisplay="events && events.length > 0" jstcach
e="7"> |
| 127 <a href="#events" jstcache="0">Events</a> |
| 128 <ol jstcache="0"> |
| 129 <li jsselect="events.sort(sortByName)" jstcache="12"> |
| 130 <a jscontent="name" jsvalues=".href:'#event-' + name" hr
ef="#event-anchor" jstcache="44">eventName</a> |
| 131 </li> |
| 132 </ol> |
| 133 </li> |
| 134 <li jsdisplay="types && types.length > 0" jstcache=
"8"> |
| 135 <a href="#types" jstcache="0">Types</a> |
| 136 <ol jstcache="0"> |
| 137 <li jsselect="types.sort(sortByName)" jstcache="38"> |
| 138 <a jscontent="id" jsvalues=".href:'#type-' + id" href="#
id-anchor" jstcache="45">id</a> |
| 139 </li> |
| 140 </ol> |
| 141 </li> |
| 142 </ol> |
| 143 </li> |
| 144 </div> |
| 145 </ol> |
| 146 </div> |
| 147 <!-- /TABLE OF CONTENTS --> |
| 148 |
| 149 <!-- STATIC CONTENT PLACEHOLDER --> |
| 150 <div id="static" jstcache="0"><div id="pageData-title" class="pageData"
jstcache="0">NPAPI Plugins</div> |
| 151 |
| 152 <p jstcache="0"> |
| 153 Leveraging HTML and JavaScript |
| 154 makes developing new extensions really easy, |
| 155 but what if you have existing legacy or proprietary code |
| 156 that you want to reuse in your extension? |
| 157 You can bundle an NPAPI plugin with your extension, |
| 158 allowing you to call into native binary code from JavaScript. |
| 159 </p> |
| 160 |
| 161 <h2 jstcache="0">Details</h2> |
| 162 |
| 163 <p jstcache="0"> |
| 164 How to develop an NPAPI plugin is outside the scope of this document. |
| 165 See <a href="https://developer.mozilla.org/en/Plugins" jstcache="0">Mozilla's |
| 166 NPAPI plugin reference</a> for information on how to do that. |
| 167 </p> |
| 168 |
| 169 <p jstcache="0"> |
| 170 Once you have an NPAPI plugin, |
| 171 follow these steps to get your extension using it. |
| 172 </p> |
| 173 |
| 174 <ol jstcache="0"> |
| 175 <li jstcache="0"> |
| 176 Add a section to your extension's <code jstcache="0">manifest.json</code> |
| 177 that describes where to find the plugin, |
| 178 along with other properties about it: |
| 179 |
| 180 <pre jstcache="0">{ |
| 181 "name": "My extension", |
| 182 ... |
| 183 <b jstcache="0"> "plugins": [ |
| 184 { "path": "content_plugin.dll", "public": true }, |
| 185 { "path": "extension_plugin.dll" } |
| 186 ]</b> |
| 187 }</pre> |
| 188 |
| 189 <p jstcache="0"> |
| 190 The "path" property specifies the path to your plugin, |
| 191 relative to the manifest file. |
| 192 The "public" property specifies whether |
| 193 your plugin can be accessed by regular web pages; |
| 194 the default is false, |
| 195 meaning only your extension can load the plugin. |
| 196 </p> |
| 197 </li> |
| 198 |
| 199 <li jstcache="0"> |
| 200 Create an HTML file that loads your plugin by mime-type. |
| 201 Assuming your mime-type is "application/x-my-extension": |
| 202 |
| 203 <pre jstcache="0"><embed type="application/x-my-extension" id="pluginId"> |
| 204 <script> |
| 205 var plugin = document.getElementById("pluginId"); |
| 206 var result = plugin.myPluginMethod(); // call a method in your plugin |
| 207 console.log("my plugin returned: " + result); |
| 208 </script></pre> |
| 209 |
| 210 <p jstcache="0"> |
| 211 This can be inside a toolstrip, a background page, |
| 212 or any other HTML page used by your extension. |
| 213 If your plugin is "public", |
| 214 you can even use a content script to programmatically |
| 215 insert your plugin into a web page. |
| 216 </p> |
| 217 </li></ol></div> |
| 218 |
| 219 <!-- API PAGE --> |
| 220 <div class="apiPage" jsselect="apiDefinition" jstcache="3" style="displa
y: none; "> |
| 221 <a name="apiReference" jstcache="0"></a> |
| 222 <h2 jscontent="'API reference: ' + getModuleName()" jstcache="4">API ref
erence: chrome.apiname </h2> |
| 223 |
| 224 <!-- PROPERTIES --> |
| 225 <div jsdisplay="$this.properties" class="apiGroup" jstcache="5"> |
| 226 <a name="properties" jstcache="0"></a> |
| 227 <h3 id="properties" jstcache="0">Properties</h3> |
| 228 |
| 229 <div jsselect="getPropertyListFromObject($this)" jstcache="10"> |
| 230 <a jsvalues=".name:'property-' + name" jstcache="15"></a> |
| 231 <h4 jscontent="name" jstcache="16">getLastError</h4> |
| 232 <div class="summary" jstcache="0"> |
| 233 <!-- Note: intentionally longer 80 columns --> |
| 234 <span jscontent="getModuleName() + '.'" jstcache="23">chrome.ext
ension</span><span jscontent="$this.name" jstcache="24">lastError</span> |
| 235 </div> |
| 236 <div transclude="valueTemplate" jstcache="17"> |
| 237 </div> |
| 238 </div> |
| 239 |
| 240 </div> <!-- /apiGroup --> |
| 241 |
| 242 <!-- METHODS --> |
| 243 <div jsdisplay="functions && functions.length > 0" class="a
piGroup" id="methods" jstcache="6"> |
| 244 <a name="methods" jstcache="0"></a> |
| 245 <h3 jstcache="0">Methods</h3> |
| 246 |
| 247 <!-- iterates over all functions --> |
| 248 <div class="apiItem" jsselect="functions.sort(sortByName)" jstcache=
"11"> |
| 249 <a jsvalues=".name:'method-' + name" jstcache="18"></a> <!-- metho
d-anchor --> |
| 250 <h4 jscontent="name" jstcache="16">method name</h4> |
| 251 |
| 252 <div class="summary" jstcache="0"><span jsdisplay="returns" jscont
ent="getTypeName(returns)" jstcache="25">void</span> |
| 253 <!-- Note: intentionally longer 80 columns --> |
| 254 <span jscontent="getFullyQualifiedFunctionName($this)" jstcach
e="26">chrome.module.methodName</span>(<span jsselect="parameters" jsvalues="cla
ss:optional ? 'optional' : ''" jstcache="27"><span jsdisplay="$index" jstcache="
33">, </span><span jscontent="getTypeName($this)" jstcache="34"></span> |
| 255 <var jstcache="0"><span jscontent="name" jstcache="16"></s
pan></var></span>)</div> |
| 256 |
| 257 <div class="description" jstcache="0"> |
| 258 <p class="todo" jsdisplay="!description" jstcache="28">Undocumen
ted.</p> |
| 259 <p jsdisplay="description" jsvalues=".innerHTML:description" jst
cache="29"> |
| 260 A description from the json schema def of the function goes he
re. |
| 261 </p> |
| 262 |
| 263 <!-- PARAMETERS --> |
| 264 <h4 jstcache="0">Parameters</h4> |
| 265 <dl jstcache="0"> |
| 266 <div jsselect="parameters" jstcache="35"> |
| 267 |
| 268 <!-- VALUE: This is a subtemplate that is used elsewhere |
| 269 via jsTemplate *transclude* --> |
| 270 <div id="valueTemplate" jstcache="0"> |
| 271 <dt jstcache="0"> |
| 272 <var jsdisplay="$this.name" jscontent="$this.name" jstca
che="46">paramName</var> |
| 273 <em jstcache="0"> |
| 274 |
| 275 <!-- TYPE --> |
| 276 <div style="display:inline" jstcache="0"> |
| 277 ( |
| 278 <span class="optional" jsdisplay="optional" jstc
ache="47">optional</span> |
| 279 <span id="typeTemplate" jstcache="0"> |
| 280 <span jsdisplay="getTypeRef($this)" jstcache="
48"> |
| 281 <a jsvalues=".href: getTypeRefPage($this) +
'#type-' + getTypeRef($this)" jscontent="getTypeRef($this)" jstcache="50"> Type<
/a> |
| 282 </span> |
| 283 <span jsdisplay="!getTypeRef($this)" jstcache=
"49"> |
| 284 <span jsdisplay="isArray($this)" jstcache="5
1"> |
| 285 array of <span jsselect="items" jstcache="
53"><span transclude="typeTemplate" jstcache="54"></span></span> |
| 286 </span> |
| 287 <span jsdisplay="!isArray($this)" jscontent=
"getTypeName($this)" jstcache="52">paramType</span> |
| 288 </span> |
| 289 </span> |
| 290 ) |
| 291 </div> |
| 292 |
| 293 </em> |
| 294 </dt> |
| 295 <dd class="todo" jsdisplay="!$this.description" jstcache="
39"> |
| 296 Undocumented. |
| 297 </dd> |
| 298 <dd jsdisplay="$this.description" jsvalues=".innerHTML:$th
is.description" jstcache="40"> |
| 299 Description of this parameter from the json schema. |
| 300 </dd> |
| 301 |
| 302 <!-- OBJECT PROPERTIES --> |
| 303 <dd jsdisplay="shouldExpandObject($this)" jstcache="41"> |
| 304 <dl jstcache="0"> |
| 305 <div jsselect="getPropertyListFromObject($this)" jstca
che="10"> |
| 306 <div transclude="valueTemplate" jstcache="17"> |
| 307 </div> |
| 308 </div> |
| 309 </dl> |
| 310 </dd> |
| 311 </div> <!-- /VALUE --> |
| 312 |
| 313 </div> |
| 314 </dl> |
| 315 |
| 316 <!-- RETURNS --> |
| 317 <h4 jsdisplay="returns" jstcache="30">Returns</h4> |
| 318 <dl jstcache="0"> |
| 319 <div jsselect="returns" jstcache="36"> |
| 320 <div transclude="valueTemplate" jstcache="17"> |
| 321 </div> |
| 322 </div> |
| 323 </dl> |
| 324 |
| 325 <!-- CALLBACK --> |
| 326 <div jsdisplay="hasCallback(parameters)" jstcache="31"> |
| 327 <div jsselect="getCallbackParameters(parameters)" jstcache="37
"> |
| 328 <h4 jstcache="0">Callback function</h4> |
| 329 <p jstcache="0"> |
| 330 If you specify the <em jstcache="0">callback</em> parameter, |
| 331 it should specify a function that looks like this: |
| 332 </p> |
| 333 |
| 334 <!-- Note: intentionally longer 80 columns --> |
| 335 <pre jstcache="0">function(<span jscontent="getSignatureString
(parameters)" jstcache="32">Type param1, Type param2</span>) <span class="subdue
d" jstcache="0">{...}</span>);</pre> |
| 336 <dl jstcache="0"> |
| 337 <div jsselect="parameters" jstcache="35"> |
| 338 <div transclude="valueTemplate" jstcache="17"> |
| 339 </div> |
| 340 </div> |
| 341 </dl> |
| 342 </div> |
| 343 </div> |
| 344 |
| 345 </div> <!-- /description --> |
| 346 |
| 347 </div> <!-- /apiItem --> |
| 348 |
| 349 </div> <!-- /apiGroup --> |
| 350 |
| 351 <!-- EVENTS --> |
| 352 <div jsdisplay="events && events.length > 0" class="apiGrou
p" jstcache="7"> |
| 353 <a name="events" jstcache="0"></a> |
| 354 <h3 id="events" jstcache="0">Events</h3> |
| 355 |
| 356 <!-- iterates over all events --> |
| 357 <div jsselect="events.sort(sortByName)" class="apiItem" jstcache="12
"> |
| 358 <a jsvalues=".name:'event-' + name" jstcache="19"></a> |
| 359 <h4 jscontent="name" jstcache="16">event name</h4> |
| 360 |
| 361 <div class="summary" jstcache="0"> |
| 362 <!-- Note: intentionally longer 80 columns --> |
| 363 <span jscontent="getModuleName() + '.'" class="subdued" jstcache
="23">chrome.bookmarks</span><span jscontent="name" jstcache="16">onEvent</span>
<span class="subdued" jstcache="0">.addListener</span>(function(<span jscontent=
"getSignatureString(parameters)" jstcache="32">Type param1, Type param2</span>)
<span class="subdued" jstcache="0">{...}</span>); |
| 364 </div> |
| 365 |
| 366 <div class="description" jstcache="0"> |
| 367 <p class="todo" jsdisplay="!description" jstcache="28">Undocumen
ted.</p> |
| 368 <p jsdisplay="description" jsvalues=".innerHTML:description" jst
cache="29"> |
| 369 A description from the json schema def of the event goes here. |
| 370 </p> |
| 371 |
| 372 <!-- PARAMETERS --> |
| 373 <h4 jstcache="0">Parameters</h4> |
| 374 <dl jstcache="0"> |
| 375 <div jsselect="parameters" jstcache="35"> |
| 376 <div transclude="valueTemplate" jstcache="17"> |
| 377 </div> |
| 378 </div> |
| 379 </dl> |
| 380 |
| 381 </div> <!-- /decription --> |
| 382 |
| 383 </div> <!-- /apiItem --> |
| 384 |
| 385 </div> <!-- /apiGroup --> |
| 386 |
| 387 <!-- TYPES --> |
| 388 <div jsdisplay="types && types.length > 0" class="apiGroup"
jstcache="8"> |
| 389 <a name="types.sort(sortByName)" jstcache="0"></a> |
| 390 <h3 id="types" jstcache="0">Types</h3> |
| 391 |
| 392 <!-- iterates over all types --> |
| 393 <div jsselect="types" class="apiItem" jstcache="13"> |
| 394 <a jsvalues=".name:'type-' + id" jstcache="20"></a> |
| 395 <h4 jscontent="id" jstcache="21">type name</h4> |
| 396 |
| 397 <div transclude="valueTemplate" jstcache="17"> |
| 398 </div> |
| 399 |
| 400 </div> <!-- /apiItem --> |
| 401 |
| 402 </div> <!-- /apiGroup --> |
| 403 |
| 404 </div> <!-- /apiPage --> |
| 405 </div> <!-- /mainColumn --> |
| 406 </div> <!-- /pageContent --> |
| 407 <div id="pageFooter" --="" jstcache="0"> |
| 408 <p jstcache="0"> |
| 409 Except as otherwise <a href="http://code.google.com/policies.html#restrictions
" jstcache="0">noted</a>, |
| 410 the content of this page is licensed under the <a rel="license" href="http://c
reativecommons.org/licenses/by/3.0/" jstcache="0">Creative Commons |
| 411 Attribution 3.0 License</a>, and code samples are licensed under the |
| 412 <a rel="license" href="http://code.google.com/google_bsd_license.html" jstcach
e="0">BSD License</a>. |
| 413 </p> |
| 414 <p jstcache="0"> |
| 415 ©2009 Google |
| 416 </p> |
| 417 </div> <!-- /pageFooter --> |
| 418 </div> <!-- /container --> |
| 419 </body></html> |
| 420 #EOF |
| OLD | NEW |