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

Unified Diff: chrome/renderer/resources/extensions/notifications_custom_bindings.js

Issue 20136004: Allow partial update for notification update API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add more tests per feedback Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/extensions/api/notifications.idl ('k') | ui/message_center/notification.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/resources/extensions/notifications_custom_bindings.js
diff --git a/chrome/renderer/resources/extensions/notifications_custom_bindings.js b/chrome/renderer/resources/extensions/notifications_custom_bindings.js
index 5150a4fb1e4b1a8ee3d7a63f052b9e1394c4e216..e56a98bdd37800376a0c970c71b76bd08c406086 100644
--- a/chrome/renderer/resources/extensions/notifications_custom_bindings.js
+++ b/chrome/renderer/resources/extensions/notifications_custom_bindings.js
@@ -22,17 +22,20 @@ function replaceNotificationOptionURLs(notification_details, callback) {
// width: (optional) The maximum width of the image to be downloaded.
// height: (optional) The maximum height of the image to be downloaded.
// callback: A function to be called when the URL is complete. It
- // should accept an ImageData object and set the appropriate
- // field in the output of create.
-
- // TODO(dewittj): Try to remove hard-coding of image sizes.
- // |iconUrl| is required.
- var url_specs = [{
- path: notification_details.iconUrl,
- width: 80,
- height: 80,
- callback: image_data_setter(notification_details, 'iconBitmap')
- }];
+ // should accept an ImageData object and set the appropriate
+ // field in the output of create.
+
+ // TODO(dewittj): Try to remove hard-coding of image sizes.
+ // |iconUrl| might be optional for notification updates.
+ var url_specs = [];
+ if (notification_details.iconUrl) {
+ $Array.push(url_specs, {
+ path: notification_details.iconUrl,
+ width: 80,
+ height: 80,
+ callback: image_data_setter(notification_details, 'iconBitmap')
+ });
+ }
// |imageUrl| is optional.
if (notification_details.imageUrl) {
@@ -57,7 +60,12 @@ function replaceNotificationOptionURLs(notification_details, callback) {
callback: image_data_setter(button_list[i], 'iconBitmap')
});
}
- }
+ }
+ }
+
+ if (!url_specs.length) {
+ callback(true);
+ return;
}
var errors = 0;
« no previous file with comments | « chrome/common/extensions/api/notifications.idl ('k') | ui/message_center/notification.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698