| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import sys | 6 import sys |
| 7 import string | 7 import string |
| 8 import json | 8 import json |
| 9 | 9 |
| 10 blink_protocol_path = sys.argv[1] | 10 blink_protocol_path = sys.argv[1] |
| (...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 "DOM.setFileInputFiles", | 650 "DOM.setFileInputFiles", |
| 651 "Network.enable", | 651 "Network.enable", |
| 652 "Network.disable", | 652 "Network.disable", |
| 653 "Network.clearBrowserCache", | 653 "Network.clearBrowserCache", |
| 654 "Network.clearBrowserCookies", | 654 "Network.clearBrowserCookies", |
| 655 "Network.getCookies", | 655 "Network.getCookies", |
| 656 "Network.deleteCookie", | 656 "Network.deleteCookie", |
| 657 "Network.setCookie", | 657 "Network.setCookie", |
| 658 "Network.canEmulateNetworkConditions", | 658 "Network.canEmulateNetworkConditions", |
| 659 "Network.emulateNetworkConditions"] | 659 "Network.emulateNetworkConditions"] |
| 660 async_commands_list = [ |
| 661 "Page.getResourceContent", |
| 662 "Page.searchInResource", |
| 663 "Page.captureScreenshot", |
| 664 "Network.getCookies", |
| 665 "Network.deleteCookie", |
| 666 "Network.setCookie", |
| 667 "IO.read", |
| 668 "Input.synthesizePinchGesture", |
| 669 "Input.synthesizeScrollGesture", |
| 670 "Input.synthesizeTapGesture", |
| 671 "Tracing.start", |
| 672 "Tracing.end", |
| 673 "Tracing.getCategories", |
| 674 "Tracing.requestMemoryDump", |
| 675 "SystemInfo.getInfo", |
| 676 "Tethering.bind", |
| 677 "Tethering.unbind"] |
| 660 | 678 |
| 661 for json_domain in all_domains: | 679 for json_domain in all_domains: |
| 662 domain_map = {} | 680 domain_map = {} |
| 663 domain_map["Domain"] = json_domain["domain"] | 681 domain_map["Domain"] = json_domain["domain"] |
| 664 domain_map["domain"] = Uncamelcase(json_domain["domain"]) | 682 domain_map["domain"] = Uncamelcase(json_domain["domain"]) |
| 665 | 683 |
| 666 initializations = [] | 684 initializations = [] |
| 667 client_methods = [] | 685 client_methods = [] |
| 668 client_method_impls = [] | 686 client_method_impls = [] |
| 669 domain_empty = True | 687 domain_empty = True |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 args.append( | 730 args.append( |
| 713 tmpl_arg_opt.substitute(param_map, param_pass=param_pass)) | 731 tmpl_arg_opt.substitute(param_map, param_pass=param_pass)) |
| 714 else: | 732 else: |
| 715 prep.append(param_map["prep_req"]) | 733 prep.append(param_map["prep_req"]) |
| 716 param_pass = param_map["pass_template"].substitute( | 734 param_pass = param_map["pass_template"].substitute( |
| 717 name=tmpl_arg_name.substitute(param_map), | 735 name=tmpl_arg_name.substitute(param_map), |
| 718 opt="") | 736 opt="") |
| 719 args.append( | 737 args.append( |
| 720 tmpl_arg_req.substitute(param_map, param_pass=param_pass)) | 738 tmpl_arg_req.substitute(param_map, param_pass=param_pass)) |
| 721 | 739 |
| 722 if json_command.get("async"): | 740 if full_command_name in async_commands_list: |
| 723 domain_needs_client = True | 741 domain_needs_client = True |
| 724 json_returns = [] | 742 json_returns = [] |
| 725 if "returns" in json_command: | 743 if "returns" in json_command: |
| 726 json_returns = json_command["returns"] | 744 json_returns = json_command["returns"] |
| 727 command_map["declared_name"] = "%sResponse" % command_map["Command"] | 745 command_map["declared_name"] = "%sResponse" % command_map["Command"] |
| 728 DeclareStruct(json_returns, command_map) | 746 DeclareStruct(json_returns, command_map) |
| 729 # TODO(vkuzkokov) Pass async callback instance similar to how | 747 # TODO(vkuzkokov) Pass async callback instance similar to how |
| 730 # InspectorBackendDispatcher does it. This, however, can work | 748 # InspectorBackendDispatcher does it. This, however, can work |
| 731 # only if Blink and Chrome are in the same repo. | 749 # only if Blink and Chrome are in the same repo. |
| 732 args.insert(0, "command_id") | 750 args.insert(0, "command_id") |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 output_h_file.close() | 836 output_h_file.close() |
| 819 | 837 |
| 820 output_cc_file.write(template_cc.substitute({}, | 838 output_cc_file.write(template_cc.substitute({}, |
| 821 major = blink_protocol["version"]["major"], | 839 major = blink_protocol["version"]["major"], |
| 822 minor = blink_protocol["version"]["minor"], | 840 minor = blink_protocol["version"]["minor"], |
| 823 includes = "".join(sorted(includes)), | 841 includes = "".join(sorted(includes)), |
| 824 fields_init = ",\n ".join(fields_init), | 842 fields_init = ",\n ".join(fields_init), |
| 825 methods = "\n".join(handler_method_impls), | 843 methods = "\n".join(handler_method_impls), |
| 826 types = "\n".join(type_impls))) | 844 types = "\n".join(type_impls))) |
| 827 output_cc_file.close() | 845 output_cc_file.close() |
| OLD | NEW |