| OLD | NEW |
| 1 // This file is generated | 1 // This file is generated |
| 2 | 2 |
| 3 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 3 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| 4 // Use of this source code is governed by a BSD-style license that can be | 4 // Use of this source code is governed by a BSD-style license that can be |
| 5 // found in the LICENSE file. | 5 // found in the LICENSE file. |
| 6 | 6 |
| 7 #ifndef HEADLESS_PUBLIC_DOMAINS_{{domain.domain | camelcase_to_hacker_style | up
per}}_H_ | 7 #ifndef HEADLESS_PUBLIC_DOMAINS_{{domain.domain | camelcase_to_hacker_style | up
per}}_H_ |
| 8 #define HEADLESS_PUBLIC_DOMAINS_{{domain.domain | camelcase_to_hacker_style | up
per}}_H_ | 8 #define HEADLESS_PUBLIC_DOMAINS_{{domain.domain | camelcase_to_hacker_style | up
per}}_H_ |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 void {{method_name}}(base::Callback<void()> callback = base::Callback<void()>(
)); | 42 void {{method_name}}(base::Callback<void()> callback = base::Callback<void()>(
)); |
| 43 {% endif %} | 43 {% endif %} |
| 44 {# Generate convenience methods that take the required parameters directly.
#} | 44 {# Generate convenience methods that take the required parameters directly.
#} |
| 45 {% if not "parameters" in command %}{% continue %}{% endif %} | 45 {% if not "parameters" in command %}{% continue %}{% endif %} |
| 46 void {{method_name}}({##} | 46 void {{method_name}}({##} |
| 47 {% for parameter in command.parameters -%} | 47 {% for parameter in command.parameters -%} |
| 48 {% if parameter.get("optional", False) -%} | 48 {% if parameter.get("optional", False) -%} |
| 49 {% break %} | 49 {% break %} |
| 50 {% endif %} | 50 {% endif %} |
| 51 {% if not loop.first %}, {% endif %} | 51 {% if not loop.first %}, {% endif %} |
| 52 {{resolve_type(parameter).pass_type}} {{parameter.name -}} | 52 {{resolve_type(parameter).pass_type}} {{parameter.name | camelcase_to_hacker_sty
le -}} |
| 53 {% endfor %} | 53 {% endfor %} |
| 54 {% if "parameters" in command and not command.parameters[0].get("optional",
False) %}, {% endif %}{# -#} | 54 {% if "parameters" in command and not command.parameters[0].get("optional",
False) %}, {% endif %}{# -#} |
| 55 {% if "returns" in command -%} | 55 {% if "returns" in command -%} |
| 56 base::Callback<void(std::unique_ptr<{{method_name}}Result>)> callback = ba
se::Callback<void(std::unique_ptr<{{method_name}}Result>)>(){##} | 56 base::Callback<void(std::unique_ptr<{{method_name}}Result>)> callback = ba
se::Callback<void(std::unique_ptr<{{method_name}}Result>)>(){##} |
| 57 {% else -%} | 57 {% else -%} |
| 58 base::Callback<void()> callback = base::Callback<void()>(){##} | 58 base::Callback<void()> callback = base::Callback<void()>(){##} |
| 59 {% endif %}); | 59 {% endif %}); |
| 60 {% endfor %} | 60 {% endfor %} |
| 61 private: | 61 private: |
| 62 {# Generate response handlers for commands that need them. #} | 62 {# Generate response handlers for commands that need them. #} |
| 63 {% for command in domain.commands %} | 63 {% for command in domain.commands %} |
| 64 {% if not "returns" in command %}{% continue %}{% endif %} | 64 {% if not "returns" in command %}{% continue %}{% endif %} |
| 65 {% set method_name = command.name | to_title_case %} | 65 {% set method_name = command.name | to_title_case %} |
| 66 static void Handle{{method_name}}Response(base::Callback<void(std::unique_ptr<
{{method_name}}Result>)> callback, const base::Value& response); | 66 static void Handle{{method_name}}Response(base::Callback<void(std::unique_ptr<
{{method_name}}Result>)> callback, const base::Value& response); |
| 67 {% endfor %} | 67 {% endfor %} |
| 68 | 68 |
| 69 internal::MessageDispatcher* dispatcher_; // Not owned. | 69 internal::MessageDispatcher* dispatcher_; // Not owned. |
| 70 | 70 |
| 71 DISALLOW_COPY_AND_ASSIGN(Domain); | 71 DISALLOW_COPY_AND_ASSIGN(Domain); |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 } // namespace {{domain.domain | camelcase_to_hacker_style}} | 74 } // namespace {{domain.domain | camelcase_to_hacker_style}} |
| 75 } // namespace headless | 75 } // namespace headless |
| 76 | 76 |
| 77 #endif // HEADLESS_PUBLIC_DOMAINS_{{domain.domain | camelcase_to_hacker_style |
upper}}_H_ | 77 #endif // HEADLESS_PUBLIC_DOMAINS_{{domain.domain | camelcase_to_hacker_style |
upper}}_H_ |
| OLD | NEW |