| 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 #include "platform/inspector_protocol/{{class_name}}.h" | 7 #include "platform/inspector_protocol/{{class_name}}.h" |
| 8 | 8 |
| 9 #include "platform/inspector_protocol/String16.h" | 9 #include "platform/inspector_protocol/String16.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 namespace protocol { | 12 namespace protocol { |
| 13 | 13 |
| 14 Frontend::Frontend(FrontendChannel* frontendChannel) | 14 Frontend::Frontend(FrontendChannel* frontendChannel) |
| 15 : m_frontendChannel(frontendChannel) | 15 : m_frontendChannel(frontendChannel) |
| 16 {% for domain in api.domains %} | 16 {% for domain in api.domains %} |
| 17 , m_{{domain.domain | lower}}(frontendChannel) | 17 , m_{{domain.domain | lower}}(frontendChannel) |
| 18 {% endfor %} | 18 {% endfor %} |
| 19 { | 19 { |
| 20 } | 20 } |
| 21 {% for domain in api.domains %} |
| 21 | 22 |
| 22 {% for domain in api.domains %} | 23 {{domain.domain}}::Frontend* {{domain.domain}}::Frontend::from(protocol::Fronten
d* frontend) |
| 24 { |
| 25 return &(frontend->m_{{domain.domain | lower}}); |
| 26 } |
| 23 {% for event in domain.events %} | 27 {% for event in domain.events %} |
| 24 {% if "handlers" in event and not ("renderer" in event["handlers"]) %}{% con
tinue %}{% endif %} | 28 {% if "handlers" in event and not ("renderer" in event["handlers"]) %}{% con
tinue %}{% endif %} |
| 25 void Frontend::{{domain.domain}}::{{event.name}}( | 29 |
| 30 void {{domain.domain}}::Frontend::{{event.name}}( |
| 26 {%- for parameter in event.parameters %} | 31 {%- for parameter in event.parameters %} |
| 27 {% if "optional" in parameter -%} | 32 {% if "optional" in parameter -%} |
| 28 const Maybe<{{resolve_type(parameter).raw_type}}>& | 33 const Maybe<{{resolve_type(parameter).raw_type}}>& |
| 29 {%- else -%} | 34 {%- else -%} |
| 30 {{resolve_type(parameter).pass_type}} | 35 {{resolve_type(parameter).pass_type}} |
| 31 {%- endif %} {{parameter.name}}{%- if not loop.last -%}, {% endif -%} | 36 {%- endif %} {{parameter.name}}{%- if not loop.last -%}, {% endif -%} |
| 32 {% endfor -%}) | 37 {% endfor -%}) |
| 33 { | 38 { |
| 34 std::unique_ptr<protocol::DictionaryValue> jsonMessage = DictionaryValue::cr
eate(); | 39 std::unique_ptr<protocol::DictionaryValue> jsonMessage = DictionaryValue::cr
eate(); |
| 35 jsonMessage->setString("method", "{{domain.domain}}.{{event.name}}"); | 40 jsonMessage->setString("method", "{{domain.domain}}.{{event.name}}"); |
| 36 std::unique_ptr<protocol::DictionaryValue> paramsObject = DictionaryValue::c
reate(); | 41 std::unique_ptr<protocol::DictionaryValue> paramsObject = DictionaryValue::c
reate(); |
| 37 {% for parameter in event.parameters %} | 42 {% for parameter in event.parameters %} |
| 38 {% if "optional" in parameter %} | 43 {% if "optional" in parameter %} |
| 39 if ({{parameter.name}}.isJust()) | 44 if ({{parameter.name}}.isJust()) |
| 40 paramsObject->setValue("{{parameter.name}}", toValue({{parameter.name}}.
fromJust())); | 45 paramsObject->setValue("{{parameter.name}}", toValue({{parameter.name}}.
fromJust())); |
| 41 {% else %} | 46 {% else %} |
| 42 paramsObject->setValue("{{parameter.name}}", toValue({{resolve_type(paramete
r).to_raw_type % parameter.name}})); | 47 paramsObject->setValue("{{parameter.name}}", toValue({{resolve_type(paramete
r).to_raw_type % parameter.name}})); |
| 43 {% endif %} | 48 {% endif %} |
| 44 {% endfor %} | 49 {% endfor %} |
| 45 jsonMessage->setObject("params", std::move(paramsObject)); | 50 jsonMessage->setObject("params", std::move(paramsObject)); |
| 46 if (m_frontendChannel) | 51 if (m_frontendChannel) |
| 47 m_frontendChannel->sendProtocolNotification(jsonMessage->toJSONString())
; | 52 m_frontendChannel->sendProtocolNotification(jsonMessage->toJSONString())
; |
| 48 } | 53 } |
| 49 {% endfor %} | 54 {% endfor %} |
| 50 {% endfor %} | 55 {% endfor %} |
| 51 | 56 |
| 52 } // namespace protocol | 57 } // namespace protocol |
| 53 } // namespace blink | 58 } // namespace blink |
| OLD | NEW |