Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(282)

Side by Side Diff: chrome/common/extensions/docs/server2/templates/articles/manifest.html

Issue 10832042: Extensions Docs Server: Doc conversion script (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: everything but svn stuff Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <h1>Formats: Manifest Files</h1>
2
3
4 <p>
5 Every extension, installable web app, and theme has a
6 <a href="http://www.json.org">JSON</a>-formatted manifest file,
7 named <code>manifest.json</code>,
8 that provides important information.
9 </p>
10
11 <h2 id="overview"> Field summary </h2>
12
13 <p>
14 The following code shows the supported manifest fields,
15 with links to the page that discusses each field.
16 The only fields that are always required
17 are <b>name</b> and <b>version</b>.
18 </p>
19
20 <pre>
21 {
22 <em>// Required</em>
23 "<a href="#name">name</a>": "<em>My Extension</em>",
24 "<a href="#version">version</a>": "<em>versionString</em>",
25 "<a href="#manifest_version">manifest_version</a>": 2,
26
27 <em>// Recommended</em>
28 "<a href="#description">description</a>": "<em>A plain text description</em>",
29 "<a href="#icons">icons</a>": { ... },
30 "<a href="#default_locale">default_locale</a>": "<em>en</em>",
31
32 <em>// Pick one (or none)</em>
33 "<a href="browserAction.html">browser_action</a>": {...},
34 "<a href="pageAction.html">page_action</a>": {...},
35 "<a href="themes.html">theme</a>": {...},
36 "<a href="#app">app</a>": {...},
37
38 <em>// Add any of these that you need</em>
39 "<a href="background_pages.html">background</a>": {...},
40 "<a href="override.html">chrome_url_overrides</a>": {...},
41 "<a href="content_scripts.html">content_scripts</a>": [...],
42 "<a href="../extensions/contentSecurityPolicy.html">content_security_policy</a >": "<em>policyString</em>",
43 "<a href="fileBrowserHandler.html">file_browser_handlers</a>": [...],
44 "<a href="#homepage_url">homepage_url</a>": "http://<em>path/to/homepage</em>" ,
45 "<a href="#incognito">incognito</a>": "spanning" <em>or</em> "split",
46 "<a href="#intents">intents</a>": {...}
47 "<a href="#key">key</a>": "<em>publicKey</em>",
48 "<a href="#minimum_chrome_version">minimum_chrome_version</a>": "<em>versionSt ring</em>",
49
50 "<a href="#nacl_modules">nacl_modules</a>": [...],
51 "<a href="#offline_enabled">offline_enabled</a>": true,
52 "<a href="omnibox.html">omnibox</a>": { "keyword": "<em>aString</em>" },
53 "<a href="options.html">options_page</a>": "<em>aFile</em>.html",
54 "<a href="#permissions">permissions</a>": [...],
55 "<a href="npapi.html">plugins</a>": [...],
56 "<a href="#requirements">requirements</a>": {...},
57 "<a href="autoupdate.html">update_url</a>": "http://<em>path/to/updateInfo</em >.xml",
58 "<a href="#web_accessible_resources">web_accessible_resources</a>": [...],
59 "<a href="#sandbox">sandbox</a>": [...]
60 }
61 </pre>
62
63
64 <h2>Field details</h2>
65
66 <p>
67 This section covers fields that aren't described in another page.
68 For a complete list of fields,
69 with links to where they're described in detail,
70 see the <a href="#overview">Field summary</a>.
71 </p>
72
73
74 <h3 id="app">app</h3>
75
76 <p>
77 Used by installable web apps,
78 including packaged apps,
79 to specify the URLs that the app uses.
80 Most important is the <em>launch page</em> for the app&mdash;the
81 page that the browser goes to when the user clicks the app's icon
82 in the New Tab page.
83 </p>
84
85 <p>
86 For details, see the documentation for
87 <a href="http://code.google.com/chrome/apps/docs/developers_guide.html">hosted a pps</a> and
88 <a href="apps.html">packaged apps</a>.
89 </p>
90
91 <h3 id="default_locale">default_locale</h3>
92
93 <p>
94 Specifies the subdirectory of <code>_locales</code>
95 that contains the default strings for this extension.
96 This field is <b>required</b> in extensions
97 that have a <code>_locales</code> directory;
98 it <b>must be absent</b> in extensions
99 that have no <code>_locales</code> directory.
100 For details, see
101 <a href="i18n.html">Internationalization</a>.
102 </p>
103
104 <h3 id="description">description</h3>
105
106 <p>
107 A plain text string
108 (no HTML or other formatting;
109 no more than 132 characters)
110 that describes the extension.
111 The description should be suitable for both
112 the browser's extension management UI
113 and the <a href="https://chrome.google.com/webstore">Chrome Web Store</a>.
114 You can specify locale-specific strings for this field;
115 see <a href="i18n.html">Internationalization</a> for details.
116 </p>
117
118 <h3 id="homepage_url">homepage_url</h3>
119
120 <p>
121 The URL of the homepage for this extension. The extensions management page (chro me://extensions)
122 will contain a link to this URL. This field is particularly useful if you
123 <a href="hosting.html">host the extension on your own site</a>. If you distribut e your
124 extension using the <a href="https://chrome.google.com/webstore">Chrome Web Stor e</a>,
125 the homepage URL defaults to the extension's own page.
126 </p>
127
128 <h3 id="icons">icons</h3>
129
130 <p>
131 One or more icons that represent the extension, app, or theme.
132 You should always provide a 128x128 icon;
133 it's used during installation and by the Chrome Web Store.
134 Extensions should also provide a 48x48 icon,
135 which is used in the extensions management page
136 (chrome://extensions).
137 You can also specify a 16x16 icon to be used as the favicon
138 for an extension's pages.
139 The 16x16 icon is also displayed in the experimental extension
140 <a href="experimental.infobars.html">infobar</a>
141 feature.
142 </p>
143
144 <p>
145 Icons should generally be in PNG format,
146 because PNG has the best support for transparency.
147 They can, however, be in any format supported by WebKit,
148 including BMP, GIF, ICO, and JPEG.
149 Here's an example of specifying the icons:
150 </p>
151
152 <pre>
153 "icons": { "16": "icon16.png",
154 "48": "icon48.png",
155 "128": "icon128.png" },
156 </pre>
157
158 <p class="note">
159 <b>Important:</b>
160 Use only the documented icon sizes.
161 <br><br>
162 You might notice that Chrome sometimes resizes these icons down to smaller
163 sizes. For example, the install dialog might shrink the 128-pixel
164 icon down to 69 pixels.
165 <br><br>
166 However, the details of
167 Chrome's UI may change between versions, and these changes assume that
168 developers are using the documented sizes. If you use other sizes,
169 your icon may look bad in future versions of the browser.
170 </p>
171
172 <p>
173 If you upload your extension, app, or theme using the
174 <a href="https://chrome.google.com/webstore/developer/dashboard">Chrome Develope r Dashboard</a>,
175 you'll need to upload additional images,
176 including at least one screenshot of your extension.
177 For more information,
178 see the
179 <a href="http://code.google.com/chrome/webstore/">Chrome Web Store
180 developer documentation</a>.
181 </p>
182
183 <h3 id="incognito">incognito</h3>
184
185 <p>
186 Either "spanning" or "split", to specify how this extension will
187 behave if allowed to run in incognito mode.
188 </p>
189
190 <p>
191 The default for extensions is "spanning", which means that the extension
192 will run in a single shared process. Any events or messages from an incognito
193 tab will be sent to the shared process, with an <em>incognito</em> flag
194 indicating where it came from. Because incognito tabs cannot use this shared
195 process, an extension using the "spanning" incognito mode will not be able to
196 load pages from its extension package into the main frame of an incognito tab.
197 </p>
198
199 <p>
200 The default for installable web apps is "split",
201 which means that all app pages in
202 an incognito window will run in their own incognito process. If the app or exten sion contains a background page, that will also run in the incognito process.
203 This incognito process runs along side the regular process, but has a separate
204 memory-only cookie store. Each process sees events and messages only from its
205 own context (for example, the incognito process will see only incognito tab upda tes).
206 The processes are unable to communicate with each other.
207 </p>
208
209 <p>
210 As a rule of thumb, if your extension or app needs to load a tab in an incognito browser, use
211 <em>split</em> incognito behavior. If your extension or app needs to be logged
212 into a remote server or persist settings locally, use <em>spanning</em>
213 incognito behavior.
214 </p>
215
216 <h3 id="intents">intents</h3>
217
218 <p>
219 A dictionary that specifies all intent handlers provided by this extension or ap p. Each key in the dictionary specifies an action verb that is handled by this e xtension. The following example specifies two handlers for the action verb "<a h ref="http://webintents.org/share">http://webintents.org/share</a>".
220 </p>
221
222 <pre>
223 {
224 "name": "test",
225 "version": "1",
226 "intents": {
227 "http://webintents.org/share": [
228 {
229 "type": ["text/uri-list"],
230 "href": "/services/sharelink.html",
231 "title" : "Sample Link Sharing Intent",
232 "disposition" : "inline"
233 },
234 {
235 "type": ["image/*"],
236 "href": "/services/shareimage.html",
237 "title" : "Sample Image Sharing Intent",
238 "disposition" : "window"
239 }
240 ]
241 }
242 }
243 </pre>
244
245 <p>
246 The value of "type" is an array of mime types that is supported by this handler. The "href" indicates the URL of the page that handles the intent. For hosted ap ps, these URLs must be within the allowed set of URLs. For extensions, all URLs are inside the extension and considered relative to the extension root URL.
247 </p>
248
249 <p>
250 The "title" is displayed in the intent picker UI when the user initiates the act ion specific to the handler.
251 </p>
252
253 <p>
254 The "disposition" is either "inline" or "window". Intents with "window" disposit ion will open a new tab when invoked. Intents with "inline" disposition will be displayed inside the intent picker when invoked.
255 </p>
256
257 <p>
258 For more information on intents, refer to the <a href="http://dvcs.w3.org/hg/web -intents/raw-file/tip/spec/Overview.html">Web Intents specification</a> and <a h ref="http://www.webintents.org">webintents.org</a>.
259 </p>
260
261 <h4>Handling content types via intents</h4>
262
263 <p>
264 Web Intents can be registered as content type viewers. To do that, the action ve rb must be <a href="http://webintents.org/view">"http://webintents.org/view"</a> , and the content type must be a white-listed MIME type.
265 </p>
266
267 <table>
268 <tr>
269 <th>Whitelisted MIME types</th>
270 </tr>
271 <tr><td>application/rss+xml</td></tr>
272 <tr><td>application/atom+xml</td></tr>
273 </table>
274
275 <h3 id="key">key</h3>
276
277 <p>
278 This value can be used to control
279 the unique ID of an extension, app, or theme when
280 it is loaded during development.
281 </p>
282
283 <p class="note">
284 <b>Note:</b> You don't usually need to
285 use this value. Instead, write your
286 code so that the key value doesn't matter
287 by using <a href="overview.html#relative-urls">relative paths</a>
288 and <a href="extension.html#method-getURL">chrome.extension.getURL()</a>.
289 </p>
290
291 <p>
292 To get a suitable key value, first
293 install your extension from a <code>.crx</code> file
294 (you may need to
295 <a href="https://chrome.google.com/webstore/developer/dashboard">upload your ext ension</a>
296 or <a href="packaging.html">package it manually</a>).
297 Then, in your
298 <a href="http://www.chromium.org/user-experience/user-data-directory">user
299 data directory</a>, look in the file
300 <code>Default/Extensions/<em>&lt;extensionId&gt;</em>/<em>&lt;versionString&gt;< /em>/manifest.json</code>.
301 You will see the key value filled in there.
302 </p>
303
304 <h3 id="minimum_chrome_version">minimum_chrome_version</h3>
305
306 <p>
307 The version of Chrome that your extension, app, or theme requires, if any.
308 The format for this string is the same as for the
309 <a href="#version">version</a> field.
310
311 <h3 id="name">name</h3>
312
313 <p>
314 A short, plain text string
315 (no more than 45 characters)
316 that identifies the extension.
317 The name is used in the install dialog,
318 extension management UI,
319 and the <a href="https://chrome.google.com/webstore">store</a>.
320 You can specify locale-specific strings for this field;
321 see <a href="i18n.html">Internationalization</a> for details.
322 </p>
323
324 <h3 id="nacl_modules">nacl_modules</h3>
325
326 <p>
327 One or more mappings from MIME types to the Native Client module
328 that handles each type.
329 For example, the bold code in the following snippet
330 registers a Native Client module as the content handler
331 for the OpenOffice spreadsheet MIME type.
332 </p>
333
334 <pre>
335 {
336 "name": "Native Client OpenOffice Spreadsheet Viewer",
337 "version": "0.1",
338 "description": "Open OpenOffice spreadsheets, right in your browser.",
339 <b>"nacl_modules": [{
340 "path": "OpenOfficeViewer.nmf",
341 "mime_type": "application/vnd.oasis.opendocument.spreadsheet"
342 }]</b>
343 }
344 </pre>
345
346 <p>
347 The value of "path" is the location of a Native Client manifest
348 (a <code>.nmf</code> file)
349 within the extension directory.
350 For more information on Native Client and <code>.nmf</code> files, see the
351 <a href="http://code.google.com/chrome/nativeclient/docs/technical_overview.html ">Native Client Technical Overview</a>.
352 </p>
353
354 <p>
355 Each MIME type can be associated with only one <code>.nmf</code> file,
356 but a single <code>.nmf</code> file might handle multiple MIME types.
357 The following example shows an extension
358 with two <code>.nmf</code> files
359 that handle three MIME types.
360 </p>
361
362 <pre>
363 {
364 "name": "Spreadsheet Viewer",
365 "version": "0.1",
366 "description": "Open OpenOffice and Excel spreadsheets, right in your browser. ",
367 "nacl_modules": [{
368 "path": "OpenOfficeViewer.nmf",
369 "mime_type": "application/vnd.oasis.opendocument.spreadsheet"
370 },
371 {
372 "path": "OpenOfficeViewer.nmf",
373 "mime_type": "application/vnd.oasis.opendocument.spreadsheet-template"
374 },
375 {
376 "path": "ExcelViewer.nmf",
377 "mime_type": "application/excel"
378 }]
379 }
380 </pre>
381
382 <p class="note">
383 <strong>Note:</strong>
384 You can use Native Client modules in extensions
385 without specifying "nacl_modules".
386 Use "nacl_modules" only if you want the browser
387 to use your Native Client module
388 to display a particular type of content.
389 </p>
390
391 <h3 id="offline_enabled">offline_enabled</h3>
392
393 <p>
394 Whether the app or extension is expected to work offline. When Chrome detects
395 that it is offline, apps with this field set to true will be highlighted
396 on the New Tab page.
397 </p>
398
399 <h3 id="permissions">permissions</h3>
400
401 <p>
402 An array of permissions that the extension or app might use.
403 Each permission can be either one of a list of known strings
404 (such as "geolocation")
405 or a match pattern
406 that gives access to one or more hosts.
407 Permissions can help to limit damage
408 if your extension or app is attacked.
409 Some permissions are also displayed to users before installation,
410 as detailed in
411 <a href="permission_warnings.html">Permission Warnings</a>.
412 </p>
413
414 <p>
415 If an extension API requires you to declare a permission in the manifest,
416 then its documentation tells you how to do so.
417 For example,
418 the <a href="tabs.html">Tabs</a> page
419 shows you how to
420 declare the "tabs" permission.
421 </p>
422
423 <p class="note">
424 <b>Note:</b>
425 As of Chrome 16, some permissions can be optional.
426 For details, see
427 <a href="permissions.html">Optional Permissions</a>.
428 </p>
429
430 <p>
431 Here's an example of the permissions part of a manifest file
432 for an extension:
433 </p>
434
435 <pre>
436 "permissions": [
437 "tabs",
438 "bookmarks",
439 "http://www.blogger.com/",
440 "http://*.google.com/",
441 "unlimitedStorage"
442 ],
443 </pre>
444
445 <p>
446 The following table lists the permissions an extension
447 or packaged app can use.
448 </p>
449
450 <p class="note">
451 <strong>Note:</strong>
452 Hosted apps can use the
453 "background", "clipboardRead", "clipboardWrite", "geolocation", "notifications",
454 and "unlimitedStorage" permissions, but not any other permissions listed in this
455 table.
456 </p>
457
458 <table>
459 <tr>
460 <th> Permission </th> <th> Description </th>
461 </tr>
462 <tr>
463 <td> <em>match pattern</em> </td>
464 <td> Specifies a <em>host permission</em>.
465 Required if the extension wants to interact
466 with the code running on pages.
467 Many extension capabilities, such as
468 <a href="xhr.html">cross-origin XMLHttpRequests</a>,
469 <a href="content_scripts.html#pi">programmatically injected
470 content scripts</a>, and <a href="cookies.html">the cookies API</a>
471 require host permissions. For details on the syntax, see
472 <a href="match_patterns.html">Match Patterns</a>.
473 </td>
474 </tr>
475 <tr id="bg">
476 <td> "background" </td>
477 <td> <p>
478 Makes Chrome start up early and and shut down late,
479 so that apps and extensions can have a longer life.
480 </p>
481
482 <p>
483 When any installed hosted app, packaged app, or extension
484 has "background" permission, Chrome runs (invisibly)
485 as soon as the user logs into their computer&mdash;before
486 the user launches Chrome.
487 The "background" permission also makes Chrome continue running
488 (even after its last window is closed)
489 until the user explicitly quits Chrome.
490 </p>
491
492 <p class="note">
493 <b>Note:</b>
494 Disabled apps and extensions
495 are treated as if they aren't installed.
496 </p>
497
498 <p>
499 You typically use the "background" permission with a
500 <a href="background_pages.html">background page</a>
501 or (for hosted apps) a
502 <a href="http://code.google.com/chrome/apps/docs/background.html">backgro und window</a>.
503 </p>
504 </td>
505 </tr>
506 <tr>
507 <td> "bookmarks" </td>
508 <td> Required if the extension uses the
509 <a href="bookmarks.html">chrome.bookmarks</a> module. </td>
510 </tr>
511 <tr>
512 <td> "chrome://favicon/" </td>
513 <td> Required if the extension uses the
514 "chrome://favicon/<em>url</em>" mechanism
515 to display the favicon of a page.
516 For example, to display the favicon of http://www.google.com/,
517 you declare the "chrome://favicon/" permission
518 and use HTML code like this:
519 <pre>&lt;img src="chrome://favicon/http://www.google.com/"></pre>
520 </td>
521 </tr>
522 <tr>
523 <td> "clipboardRead" </td>
524 <td> Required if the extension uses
525 <code>document.execCommand('paste')</code>. </td>
526 </tr>
527 <tr>
528 <td> "clipboardWrite" </td>
529 <td> Indicates the app or extension uses
530 <code>document.execCommand('copy')</code> or
531 <code>document.execCommand('cut')</code>. This permission is <b>required
532 for hosted apps</b>; it's recommended for extensions and packaged apps.
533 </td>
534 </tr>
535 <tr>
536 <td> "contentSettings" </td>
537 <td> Required if the extension uses the
538 <a href="contentSettings.html">chrome.contentSettings</a> module. </td>
539 </tr>
540 <tr>
541 <td> "contextMenus" </td>
542 <td> Required if the extension uses the
543 <a href="contextMenus.html">chrome.contextMenus</a> module. </td>
544 </tr>
545 <tr>
546 <td> "cookies" </td>
547 <td> Required if the extension uses the
548 <a href="cookies.html">chrome.cookies</a> module. </td>
549 </tr>
550 <tr>
551 <td> "experimental" </td>
552 <td> Required if the extension uses any
553 <a href="http://code.google.com/chrome/extensions/dev/experimental.html"> chrome.experimental.* APIs</a>.</td>
554 </tr>
555 <tr>
556 <td id="fileBrowserHandler"> "fileBrowserHandler" </td>
557 <td> Required if the extension uses the
558 <a href="fileBrowserHandler.html">fileBrowserhandler</a> module. </td>
559 </tr>
560 <tr>
561 <td id="geolocation"> "geolocation" </td>
562 <td> Allows the extension to use the proposed HTML5
563 <a href="http://dev.w3.org/geo/api/spec-source.html">geolocation API</a>
564 without prompting the user for permission. </td>
565 </tr>
566 <tr>
567 <td> "history" </td>
568 <td> Required if the extension uses the
569 <a href="history.html">chrome.history</a> module. </td>
570 </tr>
571 <tr>
572 <td> "idle" </td>
573 <td> Required if the extension uses the
574 <a href="idle.html">chrome.idle</a> module. </td>
575 </tr>
576 <tr>
577 <td> "management" </td>
578 <td> Required if the extension uses the
579 <a href="management.html">chrome.management</a> module. </td>
580 </tr>
581 <tr>
582 <td> "notifications" </td>
583 <td> Allows the extension to use the proposed HTML5
584 <a href="http://www.chromium.org/developers/design-documents/desktop-noti fications/api-specification">notification API</a>
585 without calling permission methods
586 (such as <code>checkPermission()</code>).
587 For more information see
588 <a href="notifications.html">Desktop Notifications</a>.</td>
589 </tr>
590 <tr>
591 <td> "privacy" </td>
592 <td> Required if the extension uses the
593 <a href="privacy.html">chrome.privacy</a> module. </td>
594 </tr>
595 <tr>
596 <td> "proxy" </td>
597 <td> Required if the extension uses the
598 <a href="proxy.html">chrome.proxy</a> module. </td>
599 </tr>
600 <tr>
601 <td> "storage" </td>
602 <td> Required if the extension uses the
603 <a href="storage.html">chrome.storage</a> module. </td>
604 </tr>
605 <tr>
606 <td> "tabs" </td>
607 <td> Required if the extension uses the
608 <a href="tabs.html">chrome.tabs</a> or
609 <a href="windows.html">chrome.windows</a> module. </td>
610 </tr>
611 <tr>
612 <td> "tts" </td>
613 <td> Required if the extension uses the
614 <a href="tts.html">chrome.tts</a> module. </td>
615 </tr>
616 <tr>
617 <td> "ttsEngine" </td>
618 <td> Required if the extension uses the
619 <a href="ttsEngine.html">chrome.ttsEngine</a> module. </td>
620 </tr>
621 <tr>
622 <td> "unlimitedStorage"</td>
623 <td> Provides an unlimited quota for storing HTML5 client-side data,
624 such as databases and local storage files.
625 Without this permission, the extension is limited to
626 5 MB of local storage.
627
628 <p class="note">
629 <b>Note:</b>
630 This permission applies only to Web SQL Database and application cache
631 (see issue <a href="http://crbug.com/58985">58985</a>).
632 Also, it doesn't currently work with wildcard subdomains such as
633 <code>http://*.example.com</code>.
634 </p>
635 </td>
636 <tr>
637 <tr>
638 <td> "webNavigation" </td>
639 <td> Required if the extension uses the
640 <a href="webNavigation.html">chrome.webNavigation</a> module. </td>
641 </tr>
642 <tr>
643 <td> "webRequest" </td>
644 <td> Required if the extension uses the
645 <a href="webRequest.html">chrome.webRequest</a> module. </td>
646 </tr>
647 <tr>
648 <td> "webRequestBlocking" </td>
649 <td> Required if the extension uses the
650 <a href="webRequest.html">chrome.webRequest</a> module in a blocking
651 fashion. </td>
652 </tr>
653 </tr>
654 </table>
655
656 <h3 id="requirements">requirements</h3>
657
658 <p>
659 Technologies required by the app or extension.
660 Hosting sites such as the Chrome Web Store may use this list
661 to dissuade users from installing apps or extensions
662 that will not work on their computer.
663 </p>
664
665 <p>
666 The only supported requirement is "3D",
667 which denotes GPU hardware acceleration.
668 For that requirement,
669 you can list the 3D-related features your app requires,
670 as demonstrated in the following example:
671 </p>
672
673 <pre>
674 "requirements": {
675 "3D": {
676 "features": ["css3d", "webgl"]
677 }
678 }
679 </pre>
680
681 <p>
682 The "css3d" requirement refers to the
683 <a href="http://www.w3.org/TR/css3-3d-transforms/">CSS 3D Transforms specificati on</a>,
684 and the "webgl" requirement refers to the
685 <a href="http://www.khronos.org/webgl/">WebGL API</a>.
686 For more information on Chrome 3D graphics support,
687 see the help article on
688 <a href="http://www.google.com/support/chrome/bin/answer.py?answer=1220892">WebG L and 3D graphics</a>.
689 Support for additional requirements checks may be added in the future.
690 </p>
691
692
693 <h3 id="version">version</h3>
694
695 <p>
696 One to four dot-separated integers
697 identifying the version of this extension.
698 A couple of rules apply to the integers:
699 they must be between 0 and 65535, inclusive,
700 and non-zero integers can't start with 0.
701 For example, 99999 and 032 are both invalid.
702 </p>
703
704 <p>
705 Here are some examples of valid versions:
706 </p>
707
708 <ul>
709 <li> <code>"version": "1"</code> </li>
710 <li> <code>"version": "1.0"</code> </li>
711 <li> <code>"version": "2.10.2"</code> </li>
712 <li> <code>"version": "3.1.2.4567"</code> </li>
713 </ul>
714
715 <p>
716 The autoupdate system compares versions
717 to determine whether an installed extension
718 needs to be updated.
719 If the published extension has a newer version string
720 than the installed extension,
721 then the extension is automatically updated.
722 </p>
723
724 <p>
725 The comparison starts with the leftmost integers.
726 If those integers are equal,
727 the integers to the right are compared,
728 and so on.
729 For example, 1.2.0 is a newer version than 1.1.9.9999.
730 </p>
731
732 <p>
733 A missing integer is equal to zero.
734 For example, 1.1.9.9999 is newer than 1.1.
735 </p>
736
737 <p>
738 For more information, see
739 <a href="autoupdate.html">Autoupdating</a>.
740 </p>
741
742
743
744 <h3 id="manifest_version">manifest_version</h3>
745
746 <p>
747 One integer specifying the version of the manifest file format your package
748 requires. As of Chrome 18, developers <em>should</em> specify <code>2</code>
749 (without quotes) to use the format as described by this document:
750 </p>
751
752 <pre>"manifest_version": 2</pre>
753
754 <p>
755 Consider manifest version 1 <em>deprecated</em> as of Chrome 18. Version 2 is
756 not yet <em>required</em>, but we will, at some point in the not-too-distant
757 future, stop supporting packages using deprecated manifest versions. Extensions,
758 applications, and themes that aren't ready to make the jump to the new manifest
759 version in Chrome 18 can either explicitly specify version <code>1</code>, or
760 leave the key off entirely.
761 </p>
762
763 <p>
764 The changes between version 1 and version 2 of the manifest file format are
765 described in detail in <a href="manifestVersion.html">the
766 <code>manifest_version</code> documentation.</a>
767 </p>
768
769 <p class="caution">
770 Setting <code>manifest_version</code> 2 in Chrome 17 or lower is not
771 recommended. If your extension needs to work in older versions of Chrome,
772 stick with version 1 for the moment. We'll give you ample warning before
773 version 1 stops working.
774 </p>
775
776 <h3 id="web_accessible_resources">web_accessible_resources</h3>
777
778 <p>
779 An array of strings specifying the paths (relative to the package root) of
780 packaged resources that are expected to be usable in the context of a web page.
781 For example, an extension that injects a content script with the intention of
782 building up some custom interface for <code>example.com</code> would whitelist
783 any resources that interface requires (images, icons, stylesheets, scripts,
784 etc.) as follows:
785 </p>
786
787 <pre>{
788 ...
789 "web_accessible_resources": [
790 "images/my-awesome-image1.png",
791 "images/my-amazing-icon1.png",
792 "style/double-rainbow.css",
793 "script/double-rainbow.js"
794 ],
795 ...
796 }</pre>
797
798 <p>
799 These resources would then be available in a webpage via the URL
800 <code>chrome-extension://[PACKAGE ID]/[PATH]</code>, which can be generated with
801 the <a href="extension.html#method-getURL">
802 <code>chrome.extension.getURL</code>
803 </a> method. Whitelisted resources are served with appropriate
804 <a href="http://www.w3.org/TR/cors/">CORS</a> headers, so they're available via
805 mechanisms like XHR.
806 </p>
807
808 <p>
809 Injected content scripts themselves do not need to be whitelisted.
810 </p>
811
812 <p>
813 Prior to manifest version 2 all resources within an extension could be accessed
814 from any page on the web. This allowed a malicious website to
815 <a href="http://en.wikipedia.org/wiki/Device_fingerprint">fingerprint</a> the
816 extensions that a user has installed or exploit vulnerabilities (for example
817 <a href="http://en.wikipedia.org/wiki/Cross-site_scripting">XSS bugs</a>)within
818 installed extensions. Limiting availability to only resources which are
819 explicitly intended to be web accessible serves to both minimize the available
820 attack surface and protect the privacy of users.
821 </p>
822
823 <h4>Default Availability</h4>
824
825 <p>
826 Resources inside of packages using <a href="#manifest_version"><code>manifest_ve rsion</code></a>
827 2 or above are <strong>blocked by default</strong>, and must be whitelisted
828 for use via this property.
829 </p>
830
831 <p>
832 Resources inside of packages using <code>manifest_version</code> 1 are available
833 by default, but <em>if</em> you do set this property, then it will be treated as
834 a complete list of all whitelisted resources. Resources not listed will be
835 blocked.
836 </p>
837
838 <h3 id="sandbox">sandbox</h3>
839
840 <p>
841 Defines an collection of app or extension pages that are to be served
842 in a sandboxed unique origin, and optionally a Content Security Policy to use
843 with them. Being in a sandbox has two implications:
844 </p>
845
846 <ol>
847 <li>A sandboxed page will not have access to extension or app APIs, or
848 direct access to non-sandboxed pages (it may communicate with them via
849 <code>postMessage()</code>).</li>
850 <li>
851 <p>A sandboxed page is not subject to the
852 <a href="../extensions/contentSecurityPolicy.html">Content Security Policy
853 (CSP)</a> used by the rest of the app or extension (it has its own separate
854 CSP value). This means that, for example, it can use inline script and
855 <code>eval</code>.</p>
856
857 <p>For example, here's how to specify that two extension pages are to be
858 served in a sandbox with a custom CSP:</p>
859
860 <pre>{
861 ...
862 "sandbox": {
863 "pages": [
864 "page1.html",
865 "directory/page2.html"
866 ]
867 <i>// content_security_policy is optional.</i>
868 "content_security_policy":
869 "sandbox allow-scripts; script-src https://www.google.com"
870 ],
871 ...
872 }</pre>
873
874 <p>
875 If not specified, the default <code>content_security_policy</code> value is
876 <code>sandbox allow-scripts allow-forms</code>. You can specify your CSP
877 value to restrict the sandbox even further, but it must have the <code>sandbox </code>
878 directive and may not have the <code>allow-same-origin</code> token (see
879 <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/the-ifram e-element.html#attr-iframe-sandbox">the
880 HTML5 specification</a> for possible sandbox tokens).
881 </p>
882 </li>
883 </ol>
884
885 <p>
886 Note that you only need to list pages that you expected to be loaded in
887 windows or frames. Resources used by sandboxed pages (e.g. stylesheets or
888 JavaScript source files) do not need to appear in the
889 <code>sandboxed_page</code> list, they will use the sandbox of the page
890 that embeds them.
891 </p>
892
893 <p>
894 <a href="sandboxingEval.html">"Using eval in Chrome Extensions. Safely."</a>
895 goes into more detail about implementing a sandboxing workflow that enables use
896 of libraries that would otherwise have issues executing under extension's
897 <a href="../extensions/contentSecurityPolicy.html">default Content Security
898 Policy</a>.
899 </p>
900
901 <p>
902 Sandboxed page may only be specified when using
903 <a href="#manifest_version"><code>manifest_version</code></a> 2 or above.
904 </p>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698