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

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

Powered by Google App Engine
This is Rietveld 408576698