Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <div id="pageData-name" class="pageData">Context Menus</div> | 1 <div id="pageData-name" class="pageData">Context Menus</div> |
| 2 | 2 |
| 3 <!-- BEGIN AUTHORED CONTENT --> | 3 <!-- BEGIN AUTHORED CONTENT --> |
| 4 <p> | 4 <p> |
| 5 The context menus module allows you | 5 The context menus module allows you |
| 6 to add items to Google Chrome's context menu. | 6 to add items to Google Chrome's context menu. |
| 7 </p> | 7 </p> |
| 8 | 8 |
| 9 <p> | 9 <p> |
| 10 You can choose what types of objects | 10 You can choose what types of objects |
| 11 your context menu additions apply to, | 11 your context menu additions apply to, |
| 12 such as images, hyperlinks, and pages. | 12 such as images, hyperlinks, and pages. |
| 13 </P> | 13 </P> |
| 14 | 14 |
| 15 <p> | 15 <p> |
| 16 You can create as many context menu items | 16 You can create as many context menu items |
| 17 as you need, but if more than one | 17 as you need, but if more than one |
| 18 from your extension is visible at once, | 18 from your extension is visible at once, |
| 19 Google Chrome automatically collapses them | 19 Google Chrome automatically collapses them |
| 20 into a single parent menu. | 20 into a single parent menu. |
| 21 </p> | 21 </p> |
| 22 | 22 |
| 23 <p>When we originally released the contextMenus API out of | |
| 24 experimental, we limited items to only appear on documents (or frames within doc uments) whose url had a scheme of http/https. We've recently removed that restri ction, so your items can appear on any document such as file:// urls, etc. If yo u'd like to control which pages your items appear on, see the targetUrlPatterns parameter to the create and update methods.</p> | |
|
kathyw
2011/07/12 22:17:54
We can tighten this up a bit, plus add line breaks
asargent_no_longer_on_chrome
2011/07/14 17:33:30
> * Should targetUrlPatterns be documentUrlPattern
| |
| 25 | |
| 23 <h2 id="manifest">Manifest</h2> | 26 <h2 id="manifest">Manifest</h2> |
| 24 <p>You must declare the "contextMenus" permission | 27 <p>You must declare the "contextMenus" permission |
| 25 in your extension's manifest to use the API. | 28 in your extension's manifest to use the API. |
| 26 Also, you should specify a 16x16-pixel icon | 29 Also, you should specify a 16x16-pixel icon |
| 27 for display next to your menu item. | 30 for display next to your menu item. |
| 28 For example: | 31 For example: |
| 29 </p> | 32 </p> |
| 30 | 33 |
| 31 <pre>{ | 34 <pre>{ |
| 32 "name": "My extension", | 35 "name": "My extension", |
| 33 ... | 36 ... |
| 34 "permissions": [ | 37 "permissions": [ |
| 35 <b>"contextMenus"</b> | 38 <b>"contextMenus"</b> |
| 36 ], | 39 ], |
| 37 "icons": { | 40 "icons": { |
| 38 <b>"16": "icon-bitty.png",</b> | 41 <b>"16": "icon-bitty.png",</b> |
| 39 "48": "icon-small.png", | 42 "48": "icon-small.png", |
| 40 "128": "icon-large.png" | 43 "128": "icon-large.png" |
| 41 }, | 44 }, |
| 42 ... | 45 ... |
| 43 }</pre> | 46 }</pre> |
| 44 | 47 |
| 45 <h2 id="examples">Examples</h2> | 48 <h2 id="examples">Examples</h2> |
| 46 | 49 |
| 47 <p> | 50 <p> |
| 48 You can find samples of this API on the | 51 You can find samples of this API on the |
| 49 <a href="samples.html#contextMenus">sample page</a>. | 52 <a href="samples.html#contextMenus">sample page</a>. |
| 50 | 53 |
| 51 <!-- END AUTHORED CONTENT --> | 54 <!-- END AUTHORED CONTENT --> |
| OLD | NEW |