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

Side by Side Diff: chrome/common/extensions/docs/templates/articles/richNotifications.html

Issue 2842293002: Adding macOS notes on the rich notification article (Closed)
Patch Set: Correcting based on feedback Created 3 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <h1 id="richNotifications">Rich Notifications</h1> 1 <h1 id="richNotifications">Rich Notifications</h1>
2 2
3 <p class="note">
4 <strong>Platform difference:</strong> In Chrome version 59 the appearance of
5 notifications will be different for Mac OS X users. Instead of Chrome's own
mkearney1 2017/04/26 23:29:37 Small nit: missing comma. In Chrome version 59,
6 notification UI, native Mac OS X notifications will be used.
7 <a href="https://developers.google.com/web/updates/2017/04/native-mac-os-notific ations">Learn more in this article</a>.
mkearney1 2017/04/26 23:29:37 Another small nit-- active rather than passive voi
8 </p>
9
3 <p>The <a href="https://developer.chrome.com/apps/notifications">rich notificati ons API</a> 10 <p>The <a href="https://developer.chrome.com/apps/notifications">rich notificati ons API</a>
4 lets you create notifications using templates and 11 lets you create notifications using templates and
5 show these notifications to users in the user's system tray: 12 show these notifications to users in the user's system tray:
6 </p> 13 </p>
7 14
8 <p><img src="{{static}}/images/notifications.png" 15 <p><img src="{{static}}/images/notifications.png"
9 alt="Notifications in system user tray"> 16 alt="Notifications in system user tray">
10 </p> 17 </p>
11 18
12 <h2 id="look">How they look</h2> 19 <h2 id="look">How they look</h2>
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 70
64 <p> 71 <p>
65 Notifications can be assigned a priority between -2 to 2. 72 Notifications can be assigned a priority between -2 to 2.
66 Priorities < 0 are shown in the ChromeOS notification center, and produce an 73 Priorities < 0 are shown in the ChromeOS notification center, and produce an
67 error on other platforms. 74 error on other platforms.
68 Priority 0 is the default priority. 75 Priority 0 is the default priority.
69 Priorities > 0 are shown for increasing duration and 76 Priorities > 0 are shown for increasing duration and
70 more high priority notifications can be displayed in the system tray. 77 more high priority notifications can be displayed in the system tray.
71 </p> 78 </p>
72 79
80 <p class="note">
81 <strong>Platform difference:</strong> The <code>priority</code> will not
82 affect the order of notifications in Chrome version 59+ on Mac OS X.
83 </p>
mkearney1 2017/04/26 23:29:37 Small nit-- a bit more active: The priority does
84
73 <p> 85 <p>
74 In addition to displaying information, 86 In addition to displaying information,
75 all notification types can include up to two action items. 87 all notification types can include up to two action items.
76 When users click on an action item, 88 When users click on an action item,
77 your app can respond with the appropriate action. 89 your app can respond with the appropriate action.
78 For example, 90 For example,
79 when the user clicks on "Reply", 91 when the user clicks on "Reply",
80 the email app opens and the user can complete the reply: 92 the email app opens and the user can complete the reply:
81 </p> 93 </p>
82 94
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 </pre> 148 </pre>
137 149
138 <h3 id="image">Create image notification</h3> 150 <h3 id="image">Create image notification</h3>
139 151
140 <p> 152 <p>
141 The <code>image</code> 153 The <code>image</code>
142 template type also includes an <code>imageUrl</code>, which is a link to 154 template type also includes an <code>imageUrl</code>, which is a link to
143 an image that is previewed within the notification: 155 an image that is previewed within the notification:
144 </p> 156 </p>
145 157
158 <p class="note">
159 <strong>Platform difference:</strong> Images will not be display to users using
160 Chrome version 59+ on Mac OS X.
161 </p>
162
146 <pre> 163 <pre>
147 var opt = { 164 var opt = {
148 type: "basic", 165 type: "basic",
149 title: "Primary Title", 166 title: "Primary Title",
150 message: "Primary message to display", 167 message: "Primary message to display",
151 iconUrl: "url_to_small_icon", 168 iconUrl: "url_to_small_icon",
152 imageUrl: "url_to_preview_image" 169 imageUrl: "url_to_preview_image"
153 } 170 }
154 </pre> 171 </pre>
155 172
156 <p> 173 <p>
157 In Chrome Apps, due to a strict <a href="contentSecurityPolicy">Content Security Policy</a> 174 In Chrome Apps, due to a strict <a href="contentSecurityPolicy">Content Security Policy</a>
158 these URLs must point to a local resource or use a 175 these URLs must point to a local resource or use a
159 <a href="app_external">blob or data URL</a>. 176 <a href="app_external">blob or data URL</a>.
160 Use a 3:2 ratio for your image; otherwise a black border frames the image. 177 Use a 3:2 ratio for your image; otherwise a black border frames the image.
161 </p> 178 </p>
162 179
163 <h3 id="list">Create list notification</h3> 180 <h3 id="list">Create list notification</h3>
164 181
165 <p> 182 <p>
166 The <code>list</code> template displays <code>items</code> 183 The <code>list</code> template displays <code>items</code>
167 in a list format: 184 in a list format:
168 </p> 185 </p>
169 186
187 <p class="note">
188 <strong>Platform difference:</strong> Only the first list item will be
189 displayed to users in Chrome version 59+ on Mac OS X.
190 </p>
191
mkearney1 2017/04/26 23:29:37 Small nit, more active... "Only the first list ite
170 <pre> 192 <pre>
171 var opt = { 193 var opt = {
172 type: "list", 194 type: "list",
173 title: "Primary Title", 195 title: "Primary Title",
174 message: "Primary message to display", 196 message: "Primary message to display",
175 iconUrl: "url_to_small_icon", 197 iconUrl: "url_to_small_icon",
176 items: [{ title: "Item1", message: "This is item 1."}, 198 items: [{ title: "Item1", message: "This is item 1."},
177 { title: "Item2", message: "This is item 2."}, 199 { title: "Item2", message: "This is item 2."},
178 { title: "Item3", message: "This is item 3."}] 200 { title: "Item3", message: "This is item 3."}]
179 } 201 }
180 </pre> 202 </pre>
181 203
182 <h3 id="list">Create progress notification</h3> 204 <h3 id="list">Create progress notification</h3>
183 205
184 <p> 206 <p>
185 The <code>progress</code> template displays a progress bar where current 207 The <code>progress</code> template displays a progress bar where current
186 progress ranges from 0 to 100: 208 progress ranges from 0 to 100:
187 </p> 209 </p>
188 210
211 <p class="note">
212 <strong>Platform difference:</strong> In Chrome version 59+ on Mac OS X the
213 progress bar display as a percentage value in the title of the notification
214 instead of displaying a progress bar.
215 </p>
216
mkearney1 2017/04/26 23:29:37 Small nit (typo and more active): In Chrome vers
189 <pre> 217 <pre>
190 var opt = { 218 var opt = {
191 type: "progress", 219 type: "progress",
192 title: "Primary Title", 220 title: "Primary Title",
193 message: "Primary message to display", 221 message: "Primary message to display",
194 iconUrl: "url_to_small_icon", 222 iconUrl: "url_to_small_icon",
195 progress: 42 223 progress: 42
196 } 224 }
197 </pre> 225 </pre>
198 226
199
200 <h2 id="events">Listening for and responding to events</h2> 227 <h2 id="events">Listening for and responding to events</h2>
201 228
202 <p> 229 <p>
203 All notifications can include event listeners and event handlers 230 All notifications can include event listeners and event handlers
204 that respond to user actions (see <a href="events">chrome.events</a>). 231 that respond to user actions (see <a href="events">chrome.events</a>).
205 For example, 232 For example,
206 you can write an event handler to respond to an 233 you can write an event handler to respond to an
207 $(ref:notifications.onButtonClicked) event. 234 $(ref:notifications.onButtonClicked) event.
208 </p> 235 </p>
209 236
210 <p>Event listener:</p> 237 <p>Event listener:</p>
211 238
212 <pre> 239 <pre>
213 chrome.notifications.onButtonClicked.addListener(replyBtnClick); 240 chrome.notifications.onButtonClicked.addListener(replyBtnClick);
214 </pre> 241 </pre>
215 242
216 <p>Event handler:</p> 243 <p>Event handler:</p>
217 244
218 <pre> 245 <pre>
219 function replyBtnClick { 246 function replyBtnClick {
220 //Write function to respond to user action. 247 //Write function to respond to user action.
221 } 248 }
222 </pre> 249 </pre>
223 250
224 <p>Consider including event listeners and handlers within the 251 <p>Consider including event listeners and handlers within the
225 <a href="app_lifecycle#create_event_page">event page</a>, 252 <a href="app_lifecycle#create_event_page">event page</a>,
226 so that notifications can pop-up even when the app or extension isn't running. 253 so that notifications can pop-up even when the app or extension isn't running.
227 </p> 254 </p>
228
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698