summaryrefslogtreecommitdiffstats
path: root/tools/json_schema_compiler/schema_util.py
diff options
context:
space:
mode:
authorasargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-20 20:14:50 +0000
committerasargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-20 20:14:50 +0000
commitf0233ffea6d5be7a10fe4ffaa4a9d037e4f718d8 (patch)
tree4eb47227593dcf06a1ab8445cc3c2ea30ca49303 /tools/json_schema_compiler/schema_util.py
parent7226735bad88a543ede72db621bb1fe618fc20b6 (diff)
downloadchromium_src-f0233ffea6d5be7a10fe4ffaa4a9d037e4f718d8.zip
chromium_src-f0233ffea6d5be7a10fe4ffaa4a9d037e4f718d8.tar.gz
chromium_src-f0233ffea6d5be7a10fe4ffaa4a9d037e4f718d8.tar.bz2
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
Diffstat (limited to 'tools/json_schema_compiler/schema_util.py')
-rw-r--r--tools/json_schema_compiler/schema_util.py16
1 files changed, 16 insertions, 0 deletions
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