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 ba7c5ca133a27b4a4ebc5e87089b5a77071a143c..930d577379d35753cb5a711032338c4093022373 100644 |
--- a/tools/json_schema_compiler/h_generator.py |
+++ b/tools/json_schema_compiler/h_generator.py |
@@ -35,6 +35,7 @@ class HGenerator(object): |
.Append('#include <vector>') |
.Append() |
.Append('#include "base/basictypes.h"') |
+ .Append('#include "base/json/json_writer.h"') |
not at google - send to devlin
2012/07/25 23:28:41
you can remove this
mitchellwrosen
2012/07/26 02:01:17
Done.
|
.Append('#include "base/logging.h"') |
.Append('#include "base/memory/linked_ptr.h"') |
.Append('#include "base/memory/scoped_ptr.h"') |
@@ -229,7 +230,7 @@ class HGenerator(object): |
""" |
c = Code() |
(c.Sblock('namespace %s {' % cpp_util.Classname(event.name)) |
- .Concat(self._GenerateCreateCallbackArguments(event)) |
+ .Concat(self._GenerateCreateCallbackArguments(event, True)) |
not at google - send to devlin
2012/07/25 23:28:41
same comment throughout this file as in cc file
mitchellwrosen
2012/07/26 02:01:17
Done.
|
.Eblock('};') |
) |
return c |
@@ -323,7 +324,7 @@ class HGenerator(object): |
cpp_util.Classname(prop.name))) |
return c |
- def _GenerateCreateCallbackArguments(self, function): |
+ def _GenerateCreateCallbackArguments(self, function, is_event): |
"""Generates functions for passing paramaters to a callback. |
""" |
c = Code() |
@@ -340,6 +341,8 @@ class HGenerator(object): |
param, self._cpp_type_generator.GetType(param))) |
c.Append('scoped_ptr<base::ListValue> Create(%s);' % |
', '.join(declaration_list)) |
+ if is_event: |
+ c.Append('std::string ToJson(%s);' % ', '.join(declaration_list)) |
return c |
def _GenerateFunctionResults(self, callback): |
@@ -347,7 +350,7 @@ class HGenerator(object): |
""" |
c = Code() |
(c.Sblock('namespace Results {') |
- .Concat(self._GenerateCreateCallbackArguments(callback)) |
+ .Concat(self._GenerateCreateCallbackArguments(callback, False)) |
.Eblock('};') |
) |
return c |