Index: extensions/renderer/resources/binding.js |
diff --git a/extensions/renderer/resources/binding.js b/extensions/renderer/resources/binding.js |
index b1a3efcaca5002bb03d2918acec145572dd74e81..9a4517629da6f9c8d34fe3914d165fd70e78ae0b 100644 |
--- a/extensions/renderer/resources/binding.js |
+++ b/extensions/renderer/resources/binding.js |
@@ -275,13 +275,30 @@ Binding.prototype = { |
mod = mod[name]; |
} |
- // Add types to global schemaValidator, the types we depend on from other |
- // namespaces will be added as needed. |
if (schema.types) { |
$Array.forEach(schema.types, function(t) { |
if (!isSchemaNodeSupported(t, platform, manifestVersion)) |
return; |
+ |
+ // Add types to global schemaValidator; the types we depend on from |
+ // other namespaces will be added as needed. |
schemaUtils.schemaValidator.addTypes(t); |
+ |
+ // Generate symbols for enums. |
+ var enumValues = t['enum']; |
+ if (enumValues) { |
+ // Type IDs are qualified with the namespace during compilation, |
+ // unfortunately, so remove it here. |
+ logging.DCHECK( |
+ t.id.substr(0, schema.namespace.length) == schema.namespace); |
+ // Note: + 1 because it ends in a '.', e.g., 'fooApi.Type'. |
+ var id = t.id.substr(schema.namespace.length + 1); |
+ mod[id] = {}; |
+ $Array.forEach(enumValues, function(enumValue) { |
+ enumValue = enumValue.name ? enumValue.name : enumValue; |
not at google - send to devlin
2015/03/02 22:20:16
// Note: enums can be declared either as a list of
Devlin
2015/03/02 23:32:35
Done.
|
+ mod[id][enumValue] = enumValue; |
+ }); |
+ } |
}, this); |
} |