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

Unified Diff: tools/json_schema_compiler/schema_bundle_generator.py

Issue 10659021: Move chrome.appWindow to chrome.app.window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased and resolved conflicts Created 8 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/schema_bundle_generator.py
diff --git a/tools/json_schema_compiler/schema_bundle_generator.py b/tools/json_schema_compiler/schema_bundle_generator.py
index 21e453cfb90ac27a2b36ce17bec4feead8cf77a6..c8491509b46c7cec3491dca796b5e1bec3289b2b 100644
--- a/tools/json_schema_compiler/schema_bundle_generator.py
+++ b/tools/json_schema_compiler/schema_bundle_generator.py
@@ -12,6 +12,10 @@ import re
# TODO(miket/asargent) - parameterize this.
SOURCE_BASE_PATH = 'chrome/common/extensions/api'
+
+def CapitalizeFirstLetter(value):
+ return value[0].capitalize() + value[1:]
+
class SchemaBundleGenerator(object):
"""This class contains methods to generate code based on multiple schemas.
"""
@@ -69,9 +73,6 @@ class SchemaBundleGenerator(object):
c.Append()
return self.GenerateHeader('generated_api', c)
- def CapitalizeFirstLetter(self, value):
- return value[0].capitalize() + value[1:]
-
def GenerateFunctionRegistry(self):
c = code.Code()
c.Sblock("class GeneratedFunctionRegistry {")
@@ -81,10 +82,17 @@ class SchemaBundleGenerator(object):
for function in namespace.functions.values():
if function.nocompile:
continue
- namespace_name = self.CapitalizeFirstLetter(namespace.name.replace(
- "experimental.", ""))
- function_name = namespace_name + self.CapitalizeFirstLetter(
- function.name)
+
+ # Transform a fully qualified function name like foo.bar.baz into
Mihai Parparita -not on Chrome 2012/06/26 05:19:16 Move into a function so that it can be unit tested
asargent_no_longer_on_chrome 2012/07/20 00:11:46 Done.
Mihai Parparita -not on Chrome 2012/07/20 00:36:52 Not seeing this change in the current patch.
+ # FooBarBaz, stripping any leading 'Experimental' prefix.
+ parts = []
+ function_name = namespace.name + "." + function.name
+ for part in function_name.split("."):
+ parts.append(CapitalizeFirstLetter(part))
+ if parts[0] == "Experimental":
+ del parts[0]
+ function_name = "".join(parts)
+
c.Append("registry->RegisterFunction<%sFunction>();" % (
function_name))
c.Eblock("}")

Powered by Google App Engine
This is Rietveld 408576698