Skip to content
Snippets Groups Projects
Commit fe2b2b36 authored by kathyw@google.com's avatar kathyw@google.com
Browse files

Filled out the manifest page. Transferred info from dev.chromium.org

into a new NPAPI page.

TBR=aa
Review URL: http://codereview.chromium.org/174526

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24445 0039d316-1c4b-4281-b951-d872f2087c98
parent 11a6eee1
No related merge requests found
<!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 mechanism.
2) The <body> tag *must* retain id="body"
3) All <body>.innerHTML is genereated 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>.innerHTML is also generated by an offline step so that this
page may easily be indexed by search engines.
TODO(rafaelw): Abstract this into a "pageshell" that becomes the single
version of page template shell and the "instance" pages (bookmarks.html,
etc...) can be generated with a build step.
-->
<!-- <html> must retain id="template -->
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- <head> data is significant and loads the needed libraries and styles -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title jscontent="pageTitle">pageTitle</title>
<link href="css/ApiRefStyles.css" rel="stylesheet" type="text/css">
<script type="text/javascript"
src="../../../third_party/jstemplate/jstemplate_compiled.js">
</script>
<script type="text/javascript" src="js/api_page_generator.js"></script>
<script type="text/javascript" src="js/bootstrap.js"></script>
</head>
<!-- <body> content is completely generated. Do not edit, as it will be
and rewritten. -->
<body>
</body>
</html>
<div id="pageData-title" class="pageData">Formats: Manifest Files</div>
<div id="pageData-showTOC" class="pageData">true</div>
<p class="comment">
[PENDING: This page should go into detail about all the parts of manifest.json files. In cases where there's not too much to say about something (icons, cross-origin XHR), we can just document it inline. Otherwise (content scripts), we can link off to a separate page.]
<p>
Every extension has a
<a href="http://www.json.org">JSON</a>-formatted manifest file,
named <code>manifest.json</code>,
that provides important information about the extension.
</p>
<h2 id="overview"> Field summary </h2>
<p>
The following code shows the supported manifest fields,
with links to the page that discusses each field.
The only fields that are required for every extension
are <b>name</b> and <b>version</b>.
</p>
<pre>
{
<b>"<a href="#name">name</a>"</b>: "<em>My Extension</em>",
<b>"<a href="http://dev.chromium.org/developers/design-documents/extensions/autoupdate">version</a>"</b>: "<em>versionString</em>",
"<a href="#description">description</a>": "<em>A plain text description</em>",
"<a href="#icons">icons</a>": { ... },
"<a href="http://dev.chromium.org/developers/design-documents/extensions/autoupdate">update_url</a>": "http://<em>path/to/updateInfo</em>.xml",
"<a href="background_pages.html">background_page</a>": "<em>aFile</em>.html",
"<a href="content_scripts.html">content_scripts</a>": [...],
"<a href="pageActions.html">page_actions</a>": [...],
"<a href="#permissions">permissions</a>": [...],
"<a href="npapi.html">plugins</a>": [...],
"<a href="http://dev.chromium.org/developers/design-documents/themes">theme</a>": [...],
"<a href="toolstrip.html">toolstrips</a>": [...],
}
</pre>
<h2>Field details</h2>
<p>
This section covers fields that aren't described in another page.
For a complete list of fields,
with links to where they're described in detail,
see the <a href="#overview">Field summary</a>.
</p>
<h3 id="description">description</h3>
<p>
A plain text string
(no HTML or other formatting)
that describes the extension.
The description should be suitable for both
the browser's extension management UI
and the extension gallery.
</p>
<h3 id="icon">icon</h3>
<p>
An icon that represents the extension.
As a rule, you should use the <b>icons</b> field instead,
so that you can specify icons in multiple sizes.
Here's an example of using this field:
</p>
<pre>
"icon": "icon.png",
</pre>
<h3 id="icons">icons</h3>
<p>
One or more icons that represent the extension.
We recommend that you provide icons in four sizes &mdash;
16x16, 32x32, 48x48, and 128x128 pixels.
The icons can be in any format supported by WebKit,
such as BMP, GIF, ICO, JPEG, or PNG.
Here's an example of specifying all four icon sizes:
</p>
<pre>
"icons": { "16": "icon16.png",
"32": "icon32.png",
"48": "icon48.png",
"128": "icon128.png" },
</pre>
<h3 id="name">name</h3>
<p>
A short, plain text string
that identifies the extension.
The name is used in the install dialog,
extension management UI,
and the extension gallery.
</p>
<h3 id="permissions">permissions</h3>
<p>
The capabilities the extension might use.
A permission can be either one of a list of known strings
(currently, either "tabs" or "bookmarks")
or a match pattern,
which gives access to one or more hosts.
The idea is not to restrict what you can do,
but to give advanced users an indication of what your extension
will be able to do.
Permissions might also help to limit damage
if your extension is attacked.
</p>
<p>
Here's an example of the permissions part of a manifest file:
</p>
<pre>
"permissions": [
"tabs",
"bookmarks",
"http://www.blogger.com/",
"http://*.google.com/"
],
</pre>
<p>
For more information, see
<a href="http://dev.chromium.org/developers/design-documents/extensions/match-patterns">Match patterns</a>.
Note, however, that the match pattern in the <b>permissions</b> field
specifies only the hosts &mdash;
not the paths &mdash;
to which the extension can make XMLHttpRequests.
</p>
<div id="pageData-title" class="pageData">NPAPI Plugins</div>
<p>
Leveraging HTML and JavaScript
makes developing new extensions really easy,
but what if you have existing legacy or proprietary code
that you want to reuse in your extension?
You can bundle an NPAPI plugin with your extension,
allowing you to call into native binary code from JavaScript.
</p>
<h2>Details</h2>
<p>
How to develop an NPAPI plugin is outside the scope of this document.
See <a href="https://developer.mozilla.org/en/Plugins">Mozilla's
NPAPI plugin reference</a> for information on how to do that.
</p>
<p>
Once you have an NPAPI plugin,
follow these steps to get your extension using it.
</p>
<ol>
<li>
Add a section to your extension's <code>manifest.json</code>
that describes where to find the plugin,
along with other properties about it:
<pre>{
"name": "My extension",
...
"plugins": [
{ "path": "content_plugin.dll", "public": true },
{ "path": "extension_plugin.dll" }
]
}</pre>
<p>
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 regular web pages;
the default is false,
meaning only your extension can load the plugin.
</p>
</li>
<li>
Create an HTML file that loads your plugin by mime-type.
Assuming your mime-type is "application/x-my-extension":
<pre>
&lt;embed type="application/x-my-extension" id="pluginId"></embed>
&lt;script>
var plugin = document.getElementById("pluginId");
var result = plugin.myPluginMethod(); // call a method in your plugin
console.log("my plugin returned: " + result);
&lt;/script></pre>
<p>
This can be inside a toolstrip, a background page,
or any other HTML page used by your extension.
If your plugin is "public",
you can even use a content script to programmatically
insert your plugin into a web page.
</p>
......@@ -40,7 +40,7 @@
<li><a href="windows.html">Windows</a></li>
<li><a href="bookmarks.html">Bookmarks</a></li>
<li>Themes</li>
<li>NPAPI Plugins</li>
<li><a href="npapi.html">NPAPI Plugins</a></li>
<li><a href="packaging.html">Packaging</a></li>
<li>Autoupdate</li>
</ul>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment