| OLD | NEW |
| 1 <!-- BEGIN AUTHORED CONTENT --> | 1 |
| 2 |
| 3 |
| 2 <p>Use browser actions to put icons | 4 <p>Use browser actions to put icons |
| 3 in the main Google Chrome toolbar, | 5 in the main Google Chrome toolbar, |
| 4 to the right of the address bar. | 6 to the right of the address bar. |
| 5 In addition to its <a href="#icon">icon</a>, | 7 In addition to its <a href="#icon">icon</a>, |
| 6 a browser action can also have | 8 a browser action can also have |
| 7 a <a href="#tooltip">tooltip</a>, | 9 a <a href="#tooltip">tooltip</a>, |
| 8 a <a href="#badge">badge</a>, | 10 a <a href="#badge">badge</a>, |
| 9 and a <a href="#popups">popup</a>. | 11 and a <a href="#popups">popup</a>. |
| 10 </p> | 12 </p> |
| 13 |
| 11 <p> | 14 <p> |
| 12 In the following figure, | 15 In the following figure, |
| 13 the multicolored square | 16 the multicolored square |
| 14 to the right of the address bar | 17 to the right of the address bar |
| 15 is the icon for a browser action. | 18 is the icon for a browser action. |
| 16 A popup is below the icon. | 19 A popup is below the icon. |
| 17 </p> | 20 </p> |
| 21 |
| 18 <img src="{{static}}/images/browser-action.png" | 22 <img src="{{static}}/images/browser-action.png" |
| 19 width="363" height="226" /> | 23 width="363" height="226" /> |
| 24 |
| 20 <p> | 25 <p> |
| 21 If you want to create an icon that isn't always visible, | 26 If you want to create an icon that isn't always visible, |
| 22 use a <a href="pageAction.html">page action</a> | 27 use a <a href="pageAction.html">page action</a> |
| 23 instead of a browser action. | 28 instead of a browser action. |
| 24 </p> | 29 </p> |
| 30 |
| 25 <p class="caution"> | 31 <p class="caution"> |
| 26 <strong>Note:</strong> | 32 <strong>Note:</strong> |
| 27 Packaged apps cannot use browser actions. | 33 Packaged apps cannot use browser actions. |
| 28 </p> | 34 </p> |
| 29 <!-- [PENDING: We should show tooltips and badges, as well.] --> | 35 |
| 36 |
| 37 |
| 30 <h2 id="manifest">Manifest</h2> | 38 <h2 id="manifest">Manifest</h2> |
| 39 |
| 31 <p> | 40 <p> |
| 32 Register your browser action in the | 41 Register your browser action in the |
| 33 <a href="manifest.html">extension manifest</a> | 42 <a href="manifest.html">extension manifest</a> |
| 34 like this: | 43 like this: |
| 35 </p> | 44 </p> |
| 45 |
| 36 <pre>{ | 46 <pre>{ |
| 37 "name": "My extension", | 47 "name": "My extension", |
| 38 ... | 48 ... |
| 39 <b>"browser_action": { | 49 <b>"browser_action": { |
| 40 "default_icon": "images/icon19.png", <em>// optional</em> | 50 "default_icon": "images/icon19.png", <em>// optional</em> |
| 41 "default_title": "Google Mail", <em>// optional; shown in tooltip</em> | 51 "default_title": "Google Mail", <em>// optional; shown in tooltip</em> |
| 42 "default_popup": "popup.html" <em>// optional</em> | 52 "default_popup": "popup.html" <em>// optional</em> |
| 43 }</b>, | 53 }</b>, |
| 44 ... | 54 ... |
| 45 }</pre> | 55 }</pre> |
| 56 |
| 46 <h2 id="ui">Parts of the UI</h2> | 57 <h2 id="ui">Parts of the UI</h2> |
| 58 |
| 47 <p> | 59 <p> |
| 48 A browser action can have an <a href="#icon">icon</a>, | 60 A browser action can have an <a href="#icon">icon</a>, |
| 49 a <a href="#tooltip">tooltip</a>, | 61 a <a href="#tooltip">tooltip</a>, |
| 50 a <a href="#badge">badge</a>, | 62 a <a href="#badge">badge</a>, |
| 51 and a <a href="#popups">popup</a>. | 63 and a <a href="#popups">popup</a>. |
| 52 </p> | 64 </p> |
| 65 |
| 53 <h3 id="icon">Icon</h3> | 66 <h3 id="icon">Icon</h3> |
| 67 |
| 54 <p>Browser action icons can be up to 19 pixels wide and high. | 68 <p>Browser action icons can be up to 19 pixels wide and high. |
| 55 Larger icons are resized to fit, but for best results, | 69 Larger icons are resized to fit, but for best results, |
| 56 use a 19-pixel square icon.</p> | 70 use a 19-pixel square icon.</p> |
| 71 |
| 57 <p>You can set the icon in two ways: | 72 <p>You can set the icon in two ways: |
| 58 using a static image or using the | 73 using a static image or using the |
| 59 HTML5 <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/the
-canvas-element.html">canvas element</a>. | 74 HTML5 <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/the
-canvas-element.html">canvas element</a>. |
| 60 Using static images is easier for simple applications, | 75 Using static images is easier for simple applications, |
| 61 but you can create more dynamic UIs — | 76 but you can create more dynamic UIs — |
| 62 such as smooth animation — | 77 such as smooth animation — |
| 63 using the canvas element. | 78 using the canvas element. |
| 64 </p> | 79 </p> |
| 80 |
| 65 <p>Static images can be in any format WebKit can display, | 81 <p>Static images can be in any format WebKit can display, |
| 66 including BMP, GIF, ICO, JPEG, or PNG. | 82 including BMP, GIF, ICO, JPEG, or PNG. |
| 67 </p> | 83 </p> |
| 84 |
| 68 <p>To set the icon, | 85 <p>To set the icon, |
| 69 use the <b>default_icon</b> field of <b>browser_action</b> | 86 use the <b>default_icon</b> field of <b>browser_action</b> |
| 70 in the <a href="#manifest">manifest</a>, | 87 in the <a href="#manifest">manifest</a>, |
| 71 or call the <a href="#method-setIcon">setIcon()</a> method. | 88 or call the <a href="#method-setIcon">setIcon()</a> method. |
| 89 |
| 90 |
| 72 <h3 id="tooltip">Tooltip</h3> | 91 <h3 id="tooltip">Tooltip</h3> |
| 92 |
| 73 <p> | 93 <p> |
| 74 To set the tooltip, | 94 To set the tooltip, |
| 75 use the <b>default_title</b> field of <b>browser_action</b> | 95 use the <b>default_title</b> field of <b>browser_action</b> |
| 76 in the <a href="#manifest">manifest</a>, | 96 in the <a href="#manifest">manifest</a>, |
| 77 or call the <a href="#method-setTitle">setTitle()</a> method. | 97 or call the <a href="#method-setTitle">setTitle()</a> method. |
| 78 You can specify locale-specific strings for the <b>default_title</b> field; | 98 You can specify locale-specific strings for the <b>default_title</b> field; |
| 79 see <a href="i18n.html">Internationalization</a> for details. | 99 see <a href="i18n.html">Internationalization</a> for details. |
| 80 </p> | 100 </p> |
| 101 |
| 81 <h3 id="badge">Badge</h3> | 102 <h3 id="badge">Badge</h3> |
| 103 |
| 82 <p>Browser actions can optionally display a <em>badge</em> — | 104 <p>Browser actions can optionally display a <em>badge</em> — |
| 83 a bit of text that is layered over the icon. | 105 a bit of text that is layered over the icon. |
| 84 Badges make it easy to update the browser action | 106 Badges make it easy to update the browser action |
| 85 to display a small amount of information | 107 to display a small amount of information |
| 86 about the state of the extension.</p> | 108 about the state of the extension.</p> |
| 109 |
| 87 <p>Because the badge has limited space, | 110 <p>Because the badge has limited space, |
| 88 it should have 4 characters or less. | 111 it should have 4 characters or less. |
| 89 </p> | 112 </p> |
| 113 |
| 90 <p> | 114 <p> |
| 91 Set the text and color of the badge using | 115 Set the text and color of the badge using |
| 92 <a href="#method-setBadgeText">setBadgeText()</a> and | 116 <a href="#method-setBadgeText">setBadgeText()</a> and |
| 93 <a href="#method-setBadgeBackgroundColor">setBadgeBackgroundColor()</a>, | 117 <a href="#method-setBadgeBackgroundColor">setBadgeBackgroundColor()</a>, |
| 94 respectively. | 118 respectively. |
| 95 <!-- [PENDING: if you have a color but no text, will anything display?] --> | 119 |
| 96 </p> | 120 </p> |
| 121 |
| 122 |
| 97 <h3 id="popups">Popup</h3> | 123 <h3 id="popups">Popup</h3> |
| 124 |
| 98 <p>If a browser action has a popup, | 125 <p>If a browser action has a popup, |
| 99 the popup appears when the user clicks the icon. | 126 the popup appears when the user clicks the icon. |
| 100 The popup can contain any HTML contents that you like, | 127 The popup can contain any HTML contents that you like, |
| 101 and it's automatically sized to fit its contents. | 128 and it's automatically sized to fit its contents. |
| 102 </p> | 129 </p> |
| 130 |
| 103 <p> | 131 <p> |
| 104 To add a popup to your browser action, | 132 To add a popup to your browser action, |
| 105 create an HTML file with the popup's contents. | 133 create an HTML file with the popup's contents. |
| 106 Specify the HTML file in the <b>default_popup</b> field of <b>browser_action</b> | 134 Specify the HTML file in the <b>default_popup</b> field of <b>browser_action</b> |
| 107 in the <a href="#manifest">manifest</a>, or call the | 135 in the <a href="#manifest">manifest</a>, or call the |
| 108 <a href="#method-setPopup">setPopup()</a> method. | 136 <a href="#method-setPopup">setPopup()</a> method. |
| 109 </p> | 137 </p> |
| 138 |
| 110 <h2>Tips</h2> | 139 <h2>Tips</h2> |
| 140 |
| 111 <p>For the best visual impact, | 141 <p>For the best visual impact, |
| 112 follow these guidelines:</p> | 142 follow these guidelines:</p> |
| 143 |
| 113 <ul> | 144 <ul> |
| 114 <li><b>Do</b> use browser actions for features | 145 <li><b>Do</b> use browser actions for features |
| 115 that make sense on most pages. | 146 that make sense on most pages. |
| 116 <li><b>Don't</b> use browser actions for features | 147 <li><b>Don't</b> use browser actions for features |
| 117 that make sense for only a few pages. | 148 that make sense for only a few pages. |
| 118 Use <a href="pageAction.html">page actions</a> instead. | 149 Use <a href="pageAction.html">page actions</a> instead. |
| 119 <li><b>Do</b> use big, colorful icons that make the most of | 150 <li><b>Do</b> use big, colorful icons that make the most of |
| 120 the 19x19-pixel space. | 151 the 19x19-pixel space. |
| 121 Browser action icons should seem a little bigger | 152 Browser action icons should seem a little bigger |
| 122 and heavier than page action icons. | 153 and heavier than page action icons. |
| 123 <li><b>Don't</b> attempt to mimic | 154 <li><b>Don't</b> attempt to mimic |
| 124 Google Chrome's monochrome "wrench" icon. | 155 Google Chrome's monochrome "wrench" icon. |
| 125 That doesn't work well with themes, and anyway, | 156 That doesn't work well with themes, and anyway, |
| 126 extensions should stand out a little. | 157 extensions should stand out a little. |
| 127 <li><b>Do</b> use alpha transparency | 158 <li><b>Do</b> use alpha transparency |
| 128 to add soft edges to your icon. | 159 to add soft edges to your icon. |
| 129 Because many people use themes, | 160 Because many people use themes, |
| 130 your icon should look nice | 161 your icon should look nice |
| 131 on a variety of background colors. | 162 on a variety of background colors. |
| 132 <li><b>Don't</b> constantly animate your icon. | 163 <li><b>Don't</b> constantly animate your icon. |
| 133 That's just annoying. | 164 That's just annoying. |
| 134 </ul> | 165 </ul> |
| 166 |
| 135 <h2 id="examples"> Examples </h2> | 167 <h2 id="examples"> Examples </h2> |
| 168 |
| 136 <p> | 169 <p> |
| 137 You can find simple examples of using browser actions in the | 170 You can find simple examples of using browser actions in the |
| 138 <a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extension
s/docs/examples/api/browserAction/">examples/api/browserAction</a> | 171 <a href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extension
s/docs/examples/api/browserAction/">examples/api/browserAction</a> |
| 139 directory. | 172 directory. |
| 140 For other examples and for help in viewing the source code, see | 173 For other examples and for help in viewing the source code, see |
| 141 <a href="samples.html">Samples</a>. | 174 <a href="samples.html">Samples</a>. |
| 142 </p> | 175 </p> |
| 143 <!-- END AUTHORED CONTENT --> | 176 |
| 177 |
| OLD | NEW |