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

Unified Diff: content/browser/devtools/protocol/devtools_protocol_handler_generator.py

Issue 1018983002: [DevTools] Support redirects in protocol handler generator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/devtools/protocol/devtools_protocol_handler_generator.py
diff --git a/content/browser/devtools/protocol/devtools_protocol_handler_generator.py b/content/browser/devtools/protocol/devtools_protocol_handler_generator.py
index 6707bee16cfc116ef9348663992e6b9f934f0ac2..87ffc136af9797ac139353e6027e4f37c0598558 100755
--- a/content/browser/devtools/protocol/devtools_protocol_handler_generator.py
+++ b/content/browser/devtools/protocol/devtools_protocol_handler_generator.py
@@ -311,7 +311,7 @@ ${initializations}\
tmpl_register = string.Template("""\
command_handlers_["${Domain}.${command}"] =
base::Bind(
- &DevToolsProtocolDispatcher::On${Domain}${Command},
+ &DevToolsProtocolDispatcher::On${TargetDomain}${Command},
base::Unretained(this));
""")
@@ -450,6 +450,8 @@ type_decls = []
type_impls = []
handler_methods = []
handler_method_impls = []
+domain_maps = []
+redirects = {}
all_domains = blink_protocol["domains"] + browser_protocol["domains"]
@@ -638,6 +640,15 @@ for json_domain in all_domains:
command_map["command"] = json_command["name"]
command_map["Command"] = Capitalize(json_command["name"])
+ if "redirect" in json_command:
+ redirect_domain = json_command["redirect"]
+ if not (redirect_domain in redirects):
+ redirects[redirect_domain] = []
+ command_map["TargetDomain"] = redirect_domain
+ redirects[redirect_domain].append(tmpl_register.substitute(command_map))
+ continue
+
+ command_map["TargetDomain"] = command_map["Domain"]
prep = []
args = []
@@ -735,9 +746,14 @@ for json_domain in all_domains:
initializations.append(tmpl_init_client.substitute(domain_map))
type_impls.append(tmpl_client_impl.substitute(domain_map,
methods = "\n".join(client_method_impls)))
- handler_method_impls.append(tmpl_setter_impl.substitute(domain_map,
- initializations = "".join(initializations)))
-
+ domain_map["initializations"] = "".join(initializations)
+ domain_maps.append(domain_map)
+
+for domain_map in domain_maps:
+ domain = domain_map["Domain"]
+ if domain in redirects:
+ domain_map["initializations"] += "".join(redirects[domain])
+ handler_method_impls.append(tmpl_setter_impl.substitute(domain_map))
output_h_file = open(output_h_path, "w")
output_cc_file = open(output_cc_path, "w")
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698