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