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

Unified Diff: tools/json_schema_compiler/h_generator.py

Issue 10907151: Extensions Docs Server: Enum values do not show up if enum is a type (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add back braces Created 8 years, 3 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: tools/json_schema_compiler/h_generator.py
diff --git a/tools/json_schema_compiler/h_generator.py b/tools/json_schema_compiler/h_generator.py
index c1df7ba221f773bef0d80cd19a9138cd85d1f0ce..c0c50ade190f6b3636a37c0bd16fbc726288f7ad 100644
--- a/tools/json_schema_compiler/h_generator.py
+++ b/tools/json_schema_compiler/h_generator.py
@@ -135,8 +135,7 @@ class HGenerator(object):
"""
c = Code()
c.Sblock('enum %s {' % enum_name)
- if prop.optional:
- c.Append(self._cpp_type_generator.GetEnumNoneValue(prop) + ',')
+ c.Append(self._cpp_type_generator.GetEnumNoneValue(prop) + ',')
for value in values:
c.Append(self._cpp_type_generator.GetEnumValue(prop, value) + ',')
(c.Eblock('};')
@@ -193,12 +192,15 @@ class HGenerator(object):
if type_.description:
c.Comment(type_.description)
c.Sblock('enum %(classname)s {')
+ c.Append('%s_NONE,' % classname.upper())
for value in type_.enum_values:
c.Append('%s_%s,' % (classname.upper(), value.upper()))
(c.Eblock('};')
.Append()
.Append('scoped_ptr<base::Value> CreateEnumValue(%s %s);' %
(classname, classname.lower()))
+ .Append('bool GetEnumFromString(const std::string& enum_string,'
+ ' %s* %s);' % (classname, classname.lower()))
)
else:
if type_.description:

Powered by Google App Engine
This is Rietveld 408576698