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

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

Powered by Google App Engine
This is Rietveld 408576698