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

Unified Diff: chrome/test/data/extensions/api_test/notification/galore/app/controller.js

Issue 12212037: Update notifications API after review. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge conflict resolved Created 7 years, 10 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
Index: chrome/test/data/extensions/api_test/notification/galore/app/controller.js
diff --git a/chrome/test/data/extensions/api_test/notification/galore/app/controller.js b/chrome/test/data/extensions/api_test/notification/galore/app/controller.js
index 54e6084ac2e1684ae40cbf27ee37da7e3ac4685a..3a4d95cb5708a36c9d1aceb3c9dcde3020122838 100644
--- a/chrome/test/data/extensions/api_test/notification/galore/app/controller.js
+++ b/chrome/test/data/extensions/api_test/notification/galore/app/controller.js
@@ -33,10 +33,10 @@ Galore.controller = {
Galore.NOTIFICATIONS.forEach(function (type) {
type.notifications.forEach(function (options) {
this.view.addNotificationButton(
- type.type,
+ type.templateType,
type.name,
this.replace_(options.iconUrl, this.BUTTON_IMAGE_SIZE),
- this.notify_.bind(this, type.type, options));
+ this.notify_.bind(this, type.templateType, options));
}, this);
}, this);
},
@@ -67,7 +67,7 @@ Galore.controller = {
/** @private */
expand_: function(options, type, priority) {
- var expanded = {type: type, priority: priority};
+ var expanded = {templateType: type, priority: priority};
Object.keys(options).forEach(function (key) {
expanded[key] = this.replace_(options[key], this.NOTIFICATION_ICON_SIZE);
}, this);
@@ -76,11 +76,21 @@ Galore.controller = {
/** @private */
replace_: function(option, size) {
- var replaced = option;
- if (typeof replaced === 'string') {
- replaced = replaced.replace(/\$#/g, this.counter);
+ var replaced;
+ if (typeof option === 'string') {
+ replaced = option.replace(/\$#/g, this.counter);
replaced = replaced.replace(/\$@/g, this.prefix);
replaced = replaced.replace(/\$%/g, size);
+ } else if (Array.isArray(option)) {
+ replaced = [];
+ option.forEach(function(element) {
+ replaced.push(this.replace_(element, size));
+ }, this);
+ } else {
+ replaced = {};
+ Object.keys(option).forEach(function (key) {
+ replaced[key] = this.replace_(option[key], size);
+ }, this);
}
return replaced;
},

Powered by Google App Engine
This is Rietveld 408576698