11cb0ef41Sopenharmony_ci// This file is generated by FrontendChannel_h.template. 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ci// Copyright 2016 The Chromium Authors. All rights reserved. 41cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be 51cb0ef41Sopenharmony_ci// found in the LICENSE file. 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ci#ifndef {{"_".join(config.protocol.namespace)}}_FrontendChannel_h 81cb0ef41Sopenharmony_ci#define {{"_".join(config.protocol.namespace)}}_FrontendChannel_h 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ci{% for namespace in config.protocol.namespace %} 111cb0ef41Sopenharmony_cinamespace {{namespace}} { 121cb0ef41Sopenharmony_ci{% endfor %} 131cb0ef41Sopenharmony_ci 141cb0ef41Sopenharmony_ciclass {{config.lib.export_macro}} Serializable { 151cb0ef41Sopenharmony_cipublic: 161cb0ef41Sopenharmony_ci ProtocolMessage serialize(bool binary) { 171cb0ef41Sopenharmony_ci if (binary) 181cb0ef41Sopenharmony_ci return StringUtil::binaryToMessage(serializeToBinary()); 191cb0ef41Sopenharmony_ci else 201cb0ef41Sopenharmony_ci return StringUtil::jsonToMessage(serializeToJSON()); 211cb0ef41Sopenharmony_ci } 221cb0ef41Sopenharmony_ci virtual String serializeToJSON() = 0; 231cb0ef41Sopenharmony_ci virtual std::vector<uint8_t> serializeToBinary() = 0; 241cb0ef41Sopenharmony_ci virtual ~Serializable() = default; 251cb0ef41Sopenharmony_ci}; 261cb0ef41Sopenharmony_ci 271cb0ef41Sopenharmony_ciclass {{config.lib.export_macro}} FrontendChannel { 281cb0ef41Sopenharmony_cipublic: 291cb0ef41Sopenharmony_ci virtual ~FrontendChannel() { } 301cb0ef41Sopenharmony_ci virtual void sendProtocolResponse(int callId, std::unique_ptr<Serializable> message) = 0; 311cb0ef41Sopenharmony_ci virtual void sendProtocolNotification(std::unique_ptr<Serializable> message) = 0; 321cb0ef41Sopenharmony_ci virtual void fallThrough(int callId, const String& method, const ProtocolMessage& message) = 0; 331cb0ef41Sopenharmony_ci virtual void flushProtocolNotifications() = 0; 341cb0ef41Sopenharmony_ci}; 351cb0ef41Sopenharmony_ci 361cb0ef41Sopenharmony_ci{% for namespace in config.protocol.namespace %} 371cb0ef41Sopenharmony_ci} // namespace {{namespace}} 381cb0ef41Sopenharmony_ci{% endfor %} 391cb0ef41Sopenharmony_ci 401cb0ef41Sopenharmony_ci#endif // !defined({{"_".join(config.protocol.namespace)}}_FrontendChannel_h) 41