| OLD | NEW |
| 1 <table class="intro"> |
| 2 <tr> |
| 3 <th scope="col"></th> |
| 4 <th scope="col"></th> |
| 5 </tr> |
| 6 <tr> |
| 7 <td><strong>Description:</strong></td> |
| 8 <td>Use the <code>chrome.contextMenus</code> module |
| 9 to add items to Google Chrome's context menu. |
| 10 You can choose what types of objects |
| 11 your context menu additions apply to, |
| 12 such as images, hyperlinks, and pages. |
| 13 </td> |
| 14 </tr> |
| 15 <tr> |
| 16 <td><strong>Availability:</strong></td> |
| 17 <td>Google Chrome 6</td> |
| 18 </tr> |
| 19 <tr> |
| 20 <td><strong>Permissions:</strong></td> |
| 21 <td><code>"contextMenus"</code></td> |
| 22 </tr> |
| 23 </table> |
| 24 |
| 25 <h2 id="usage">Usage</h2> |
| 26 |
| 1 <p> | 27 <p> |
| 2 The context menus module allows you | 28 Context menu items can appear in any document |
| 3 to add items to Google Chrome's context menu. | 29 (or frame within a document), |
| 30 even those with file:// or chrome:// URLs. |
| 31 To control which documents your items can appear in, |
| 32 specify the documentUrlPatterns field |
| 33 when you call the create() or update() method. |
| 4 </p> | 34 </p> |
| 5 | 35 |
| 6 <p> | 36 <p> |
| 7 You can choose what types of objects | |
| 8 your context menu additions apply to, | |
| 9 such as images, hyperlinks, and pages. | |
| 10 </p> | |
| 11 | |
| 12 <p> | |
| 13 You can create as many context menu items | 37 You can create as many context menu items |
| 14 as you need, but if more than one | 38 as you need, but if more than one |
| 15 from your extension is visible at once, | 39 from your extension is visible at once, |
| 16 Google Chrome automatically collapses them | 40 Google Chrome automatically collapses them |
| 17 into a single parent menu. | 41 into a single parent menu. |
| 18 </p> | 42 </p> |
| 19 | 43 |
| 20 <p> | |
| 21 Context menu items can appear in any document | |
| 22 (or frame within a document), | |
| 23 even those with file:// or chrome:// URLs. | |
| 24 To control which documents your items can appear in, | |
| 25 specify the documentUrlPatterns field | |
| 26 when you call the create() or update() method. | |
| 27 </p> | |
| 28 | |
| 29 <h2 id="manifest">Manifest</h2> | 44 <h2 id="manifest">Manifest</h2> |
| 30 <p>You must declare the "contextMenus" permission | 45 <p>You must declare the "contextMenus" permission |
| 31 in your extension's manifest to use the API. | 46 in your extension's manifest to use the API. |
| 32 Also, you should specify a 16x16-pixel icon | 47 Also, you should specify a 16x16-pixel icon |
| 33 for display next to your menu item. | 48 for display next to your menu item. |
| 34 For example: | 49 For example: |
| 35 </p> | 50 </p> |
| 36 | 51 |
| 37 <pre>{ | 52 <pre>{ |
| 38 "name": "My extension", | 53 "name": "My extension", |
| 39 ... | 54 ... |
| 40 "permissions": [ | 55 "permissions": [ |
| 41 <b>"contextMenus"</b> | 56 <b>"contextMenus"</b> |
| 42 ], | 57 ], |
| 43 "icons": { | 58 "icons": { |
| 44 <b>"16": "icon-bitty.png",</b> | 59 <b>"16": "icon-bitty.png",</b> |
| 45 "48": "icon-small.png", | 60 "48": "icon-small.png", |
| 46 "128": "icon-large.png" | 61 "128": "icon-large.png" |
| 47 }, | 62 }, |
| 48 ... | 63 ... |
| 49 }</pre> | 64 }</pre> |
| 50 | 65 |
| 51 <h2 id="examples">Examples</h2> | 66 <h2 id="examples">Examples</h2> |
| 52 | 67 |
| 53 <p> | 68 <p> |
| 54 You can find samples of this API on the | 69 You can find samples of this API on the |
| 55 <a href="samples.html#contextMenus">sample page</a>. | 70 <a href="samples.html#contextMenus">sample page</a>. |
| OLD | NEW |