chromium/extensions/renderer/api/messaging/gin_port.cc

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "extensions/renderer/api/messaging/gin_port.h"

#include <cstring>
#include <string_view>

#include "base/functional/bind.h"
#include "extensions/common/api/messaging/message.h"
#include "extensions/common/mojom/event_dispatcher.mojom.h"
#include "extensions/common/mojom/message_port.mojom.h"
#include "extensions/renderer/api/messaging/messaging_util.h"
#include "extensions/renderer/bindings/api_binding_util.h"
#include "extensions/renderer/bindings/api_event_handler.h"
#include "extensions/renderer/bindings/event_emitter.h"
#include "extensions/renderer/console.h"
#include "extensions/renderer/get_script_context.h"
#include "gin/arguments.h"
#include "gin/converter.h"
#include "gin/object_template_builder.h"
#include "v8/include/v8-context.h"
#include "v8/include/v8-object.h"
#include "v8/include/v8-primitive.h"

namespace extensions {

namespace {

constexpr char kSenderKey[] =;
constexpr char kOnMessageEvent[] =;
constexpr char kOnDisconnectEvent[] =;
constexpr char kContextInvalidatedError[] =;

}  // namespace

GinPort::GinPort(v8::Local<v8::Context> context,
                 const PortId& port_id,
                 const std::string& name,
                 const mojom::ChannelType channel_type,
                 APIEventHandler* event_handler,
                 Delegate* delegate)
    :{}

GinPort::~GinPort() = default;

gin::WrapperInfo GinPort::kWrapperInfo =;

gin::ObjectTemplateBuilder GinPort::GetObjectTemplateBuilder(
    v8::Isolate* isolate) {}

const char* GinPort::GetTypeName() {}

void GinPort::DispatchOnMessage(v8::Local<v8::Context> context,
                                const Message& message) {}

void GinPort::DispatchOnDisconnect(v8::Local<v8::Context> context) {}

void GinPort::SetSender(v8::Local<v8::Context> context,
                        v8::Local<v8::Value> sender) {}

void GinPort::DisconnectHandler(gin::Arguments* arguments) {}

void GinPort::PostMessageHandler(gin::Arguments* arguments,
                                 v8::Local<v8::Value> v8_message) {}

std::string GinPort::GetName() {}

v8::Local<v8::Value> GinPort::GetOnDisconnectEvent(gin::Arguments* arguments) {}

v8::Local<v8::Value> GinPort::GetOnMessageEvent(gin::Arguments* arguments) {}

v8::Local<v8::Value> GinPort::GetSender(gin::Arguments* arguments) {}

v8::Local<v8::Object> GinPort::GetEvent(v8::Local<v8::Context> context,
                                        std::string_view event_name) {}

void GinPort::DispatchEvent(v8::Local<v8::Context> context,
                            v8::LocalVector<v8::Value>* args,
                            std::string_view event_name) {}

void GinPort::OnContextInvalidated() {}

void GinPort::InvalidateEvents(v8::Local<v8::Context> context) {}

void GinPort::ThrowError(v8::Isolate* isolate, std::string_view error) {}

}  // namespace extensions