OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** | 7 /** |
8 * Show/hide trigger in a card. | 8 * Show/hide trigger in a card. |
9 * | 9 * |
10 * @typedef {{ | 10 * @typedef {{ |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // Try updating the notification. | 137 // Try updating the notification. |
138 instrumented.notifications.update( | 138 instrumented.notifications.update( |
139 chromeNotificationId, | 139 chromeNotificationId, |
140 receivedNotification.chromeNotificationOptions, | 140 receivedNotification.chromeNotificationOptions, |
141 function(wasUpdated) { | 141 function(wasUpdated) { |
142 if (!wasUpdated) { | 142 if (!wasUpdated) { |
143 // If the notification wasn't updated, it probably didn't exist. | 143 // If the notification wasn't updated, it probably didn't exist. |
144 // Create it. | 144 // Create it. |
145 console.log( | 145 console.log( |
146 'cardManager.updateNotification ' + chromeNotificationId + | 146 'cardManager.updateNotification ' + chromeNotificationId + |
147 ' failed to update, creating'); | 147 ' not updated, creating instead'); |
148 instrumented.notifications.create( | 148 instrumented.notifications.create( |
149 chromeNotificationId, | 149 chromeNotificationId, |
150 receivedNotification.chromeNotificationOptions, | 150 receivedNotification.chromeNotificationOptions, |
151 function(newChromeNotificationId) { | 151 function(newChromeNotificationId) { |
152 if (!newChromeNotificationId || chrome.runtime.lastError) { | 152 if (!newChromeNotificationId || chrome.runtime.lastError) { |
153 var errorMessage = chrome.runtime.lastError && | 153 var errorMessage = chrome.runtime.lastError && |
154 chrome.runtime.lastError.message; | 154 chrome.runtime.lastError.message; |
155 console.error('notifications.create: ID=' + | 155 console.error('notifications.create: ID=' + |
156 newChromeNotificationId + ', ERROR=' + errorMessage); | 156 newChromeNotificationId + ', ERROR=' + errorMessage); |
157 return; | 157 return; |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 }); | 378 }); |
379 }); | 379 }); |
380 } | 380 } |
381 }); | 381 }); |
382 | 382 |
383 return { | 383 return { |
384 update: update, | 384 update: update, |
385 onDismissal: onDismissal | 385 onDismissal: onDismissal |
386 }; | 386 }; |
387 } | 387 } |
OLD | NEW |