From f0233ffea6d5be7a10fe4ffaa4a9d037e4f718d8 Mon Sep 17 00:00:00 2001 From: "asargent@chromium.org" Date: Fri, 20 Jul 2012 20:14:50 +0000 Subject: Move chrome.appWindow to chrome.app.window. BUG=134573 TEST=In platform apps, you should be able to call all the same methods, etc. via the new chrome.app.window namespace that you used to be able to with chrome.appWindow. Review URL: https://chromiumcodereview.appspot.com/10659021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147710 0039d316-1c4b-4281-b951-d872f2087c98 --- tools/json_schema_compiler/schema_util.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tools/json_schema_compiler/schema_util.py') diff --git a/tools/json_schema_compiler/schema_util.py b/tools/json_schema_compiler/schema_util.py index 177e77f..046e2bd 100644 --- a/tools/json_schema_compiler/schema_util.py +++ b/tools/json_schema_compiler/schema_util.py @@ -4,6 +4,9 @@ """Utilies for the processing of schema python structures. """ +def CapitalizeFirstLetter(value): + return value[0].capitalize() + value[1:] + def GetNamespace(ref_type): if '.' in ref_type: return ref_type[:ref_type.rindex('.')] @@ -39,3 +42,16 @@ def _PrefixWithNamespace(namespace, schema): elif type(schema) == list: for s in schema: _PrefixWithNamespace(namespace, s) + +def JsFunctionNameToClassName(namespace_name, function_name): + """Transform a fully qualified function name like foo.bar.baz into FooBarBaz + + Also strips any leading 'Experimental' prefix.""" + parts = [] + full_name = namespace_name + "." + function_name + for part in full_name.split("."): + parts.append(CapitalizeFirstLetter(part)) + if parts[0] == "Experimental": + del parts[0] + class_name = "".join(parts) + return class_name -- cgit v1.1