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 {{"_".join(config.protocol.namespace)}}_{{domain.domain}}_h | 7 #ifndef {{"_".join(config.protocol.namespace)}}_{{domain.domain}}_h |
8 #define {{"_".join(config.protocol.namespace)}}_{{domain.domain}}_h | 8 #define {{"_".join(config.protocol.namespace)}}_{{domain.domain}}_h |
9 | 9 |
10 {% if config.protocol.export_header %} | 10 {% if config.protocol.export_header %} |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 {% endif %} | 178 {% endif %} |
179 {% endfor %} | 179 {% endfor %} |
180 }; | 180 }; |
181 | 181 |
182 {% endfor %} | 182 {% endfor %} |
183 | 183 |
184 // ------------- Backend interface. | 184 // ------------- Backend interface. |
185 | 185 |
186 class {{config.protocol.export_macro}} Backend { | 186 class {{config.protocol.export_macro}} Backend { |
187 public: | 187 public: |
| 188 virtual ~Backend() { } |
| 189 |
188 {% for command in domain.commands %} | 190 {% for command in domain.commands %} |
189 {% if "redirect" in command %}{% continue %}{% endif %} | 191 {% if "redirect" in command %}{% continue %}{% endif %} |
190 {% if ("handlers" in command) and not ("renderer" in command["handlers"]) %}
{% continue %}{% endif %} | 192 {% if ("handlers" in command) and not ("renderer" in command["handlers"]) %}
{% continue %}{% endif %} |
191 {% if "async" in command %} | 193 {% if "async" in command %} |
192 class {{config.protocol.export_macro}} {{command.name | to_title_case}}Callb
ack : public BackendCallback { | 194 class {{config.protocol.export_macro}} {{command.name | to_title_case}}Callb
ack : public BackendCallback { |
193 public: | 195 public: |
194 virtual void sendSuccess( | 196 virtual void sendSuccess( |
195 {%- for parameter in command.returns -%} | 197 {%- for parameter in command.returns -%} |
196 {%- if "optional" in parameter -%} | 198 {%- if "optional" in parameter -%} |
197 const Maybe<{{resolve_type(parameter).raw_type}}>& {{parameter.name}
} | 199 const Maybe<{{resolve_type(parameter).raw_type}}>& {{parameter.name}
} |
(...skipping 28 matching lines...) Expand all Loading... |
226 , {{resolve_type(parameter).type}}* out_{{parameter.name}} | 228 , {{resolve_type(parameter).type}}* out_{{parameter.name}} |
227 {%- endif -%} | 229 {%- endif -%} |
228 {%- endfor -%} | 230 {%- endfor -%} |
229 {%- endif -%} | 231 {%- endif -%} |
230 ) = 0; | 232 ) = 0; |
231 {% endfor %} | 233 {% endfor %} |
232 | 234 |
233 {% if not has_disable(domain.commands) %} | 235 {% if not has_disable(domain.commands) %} |
234 virtual void disable(ErrorString*) { } | 236 virtual void disable(ErrorString*) { } |
235 {% endif %} | 237 {% endif %} |
236 | |
237 protected: | |
238 virtual ~Backend() { } | |
239 }; | 238 }; |
240 | 239 |
241 // ------------- Frontend interface. | 240 // ------------- Frontend interface. |
242 | 241 |
243 class {{config.protocol.export_macro}} Frontend { | 242 class {{config.protocol.export_macro}} Frontend { |
244 public: | 243 public: |
245 Frontend(FrontendChannel* frontendChannel) : m_frontendChannel(frontendChann
el) { } | 244 Frontend(FrontendChannel* frontendChannel) : m_frontendChannel(frontendChann
el) { } |
246 {% for event in domain.events %} | 245 {% for event in domain.events %} |
247 {% if "handlers" in event and not ("renderer" in event["handlers"]) %}{% con
tinue %}{% endif %} | 246 {% if "handlers" in event and not ("renderer" in event["handlers"]) %}{% con
tinue %}{% endif %} |
248 void {{event.name}}( | 247 void {{event.name}}( |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 static const char commandPrefix[]; | 281 static const char commandPrefix[]; |
283 static const char version[]; | 282 static const char version[]; |
284 }; | 283 }; |
285 | 284 |
286 } // namespace {{domain.domain}} | 285 } // namespace {{domain.domain}} |
287 {% for namespace in config.protocol.namespace %} | 286 {% for namespace in config.protocol.namespace %} |
288 } // namespace {{namespace}} | 287 } // namespace {{namespace}} |
289 {% endfor %} | 288 {% endfor %} |
290 | 289 |
291 #endif // !defined({{"_".join(config.protocol.namespace)}}_{{domain.domain}}_h) | 290 #endif // !defined({{"_".join(config.protocol.namespace)}}_{{domain.domain}}_h) |
OLD | NEW |