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

Unified Diff: tools/json_schema_compiler/cc_generator.py

Issue 320473002: Added the "unmodifiable" property to chrome.bookmarks.BookmarkTreeNode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebaes Created 6 years, 6 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/cc_generator.py
diff --git a/tools/json_schema_compiler/cc_generator.py b/tools/json_schema_compiler/cc_generator.py
index 96492ba103056ce8a07358a5b30ec9e3df5fc7c9..61f5bf1f04b87266d90e7854cf84a40f56d892e2 100644
--- a/tools/json_schema_compiler/cc_generator.py
+++ b/tools/json_schema_compiler/cc_generator.py
@@ -146,11 +146,16 @@ class _Generator(object):
def _GenerateInitializersAndBody(self, type_):
items = []
for prop in type_.properties.values():
- if prop.optional:
- continue
-
t = prop.type_
- if t.property_type == PropertyType.INTEGER:
+
+ real_t = self._type_helper.FollowRef(t)
+ if real_t.property_type == PropertyType.ENUM:
+ items.append('%s(%s)' % (
+ prop.unix_name,
+ self._type_helper.GetEnumNoneValue(t)))
+ elif prop.optional:
+ continue
+ elif t.property_type == PropertyType.INTEGER:
items.append('%s(0)' % prop.unix_name)
elif t.property_type == PropertyType.DOUBLE:
items.append('%s(0.0)' % prop.unix_name)
@@ -160,12 +165,11 @@ class _Generator(object):
t.property_type == PropertyType.ARRAY or
t.property_type == PropertyType.BINARY or # mapped to std::string
t.property_type == PropertyType.CHOICES or
- t.property_type == PropertyType.ENUM or
t.property_type == PropertyType.OBJECT or
t.property_type == PropertyType.FUNCTION or
t.property_type == PropertyType.REF or
t.property_type == PropertyType.STRING):
- # TODO(miket): It would be nice to initialize CHOICES and ENUM, but we
+ # TODO(miket): It would be nice to initialize CHOICES, but we
# don't presently have the semantics to indicate which one of a set
# should be the default.
continue
« no previous file with comments | « chrome/test/data/extensions/api_test/bookmarks/test.js ('k') | tools/json_schema_compiler/test/enums_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698