diff options
author | rdevlin.cronin <rdevlin.cronin@chromium.org> | 2015-04-06 10:19:18 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-06 17:35:43 +0000 |
commit | 00f1fc22bfcc653b47d62778170af3eee9855720 (patch) | |
tree | 2386d4a7e984d7db6f9cfa0c07409a715832993e /tools/json_schema_compiler/cc_generator.py | |
parent | 86b507da14efeb641795641b24c49f57a07ae879 (diff) | |
download | chromium_src-00f1fc22bfcc653b47d62778170af3eee9855720.zip chromium_src-00f1fc22bfcc653b47d62778170af3eee9855720.tar.gz chromium_src-00f1fc22bfcc653b47d62778170af3eee9855720.tar.bz2 |
[Extensions API] Remove inline enums
Remove all inlined enums from extension APIs.
BUG=472279
TBR=derat@chromium.org (mechanical changes to chrome/browser/chromeos/app_mode/kiosk_app_update_service.cc and chrome/browser/ui/ash/ash_keyboard_controller_proxy.cc)
Review URL: https://codereview.chromium.org/1055673002
Cr-Commit-Position: refs/heads/master@{#323912}
Diffstat (limited to 'tools/json_schema_compiler/cc_generator.py')
-rw-r--r-- | tools/json_schema_compiler/cc_generator.py | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/tools/json_schema_compiler/cc_generator.py b/tools/json_schema_compiler/cc_generator.py index 3e2a1be..73413ef 100644 --- a/tools/json_schema_compiler/cc_generator.py +++ b/tools/json_schema_compiler/cc_generator.py @@ -148,9 +148,12 @@ class _Generator(object): 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))) + namespace_prefix = ('%s::' % real_t.namespace.unix_name + if real_t.namespace != self._namespace + else '') + items.append('%s(%s%s)' % (prop.unix_name, + namespace_prefix, + self._type_helper.GetEnumNoneValue(t))) elif prop.optional: continue elif t.property_type == PropertyType.INTEGER: @@ -289,9 +292,13 @@ class _Generator(object): prop, value_var, dst, 'false'))) underlying_type = self._type_helper.FollowRef(prop.type_) if underlying_type.property_type == PropertyType.ENUM: + namespace_prefix = ('%s::' % underlying_type.namespace.unix_name + if underlying_type.namespace != self._namespace + else '') (c.Append('} else {') - .Append('%%(dst)s->%%(name)s = %s;' % - self._type_helper.GetEnumNoneValue(prop.type_))) + .Append('%%(dst)s->%%(name)s = %s%s;' % + (namespace_prefix, + self._type_helper.GetEnumNoneValue(prop.type_)))) c.Eblock('}') else: (c.Sblock( @@ -1027,9 +1034,13 @@ class _Generator(object): underlying_type = self._type_helper.FollowRef(prop.type_) if (underlying_type.property_type == PropertyType.ENUM and prop.optional): - c.Append('%s->%s = %s;' % ( + namespace_prefix = ('%s::' % underlying_type.namespace.unix_name + if underlying_type.namespace != self._namespace + else '') + c.Append('%s->%s = %s%s;' % ( dst, prop.unix_name, + namespace_prefix, self._type_helper.GetEnumNoneValue(prop.type_))) return c |