chromium/extensions/browser/api/sockets_udp/udp_socket_event_dispatcher.cc

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

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "extensions/browser/api/sockets_udp/udp_socket_event_dispatcher.h"

#include <utility>

#include "base/functional/bind.h"
#include "base/lazy_instance.h"
#include "base/task/single_thread_task_runner.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/api/socket/udp_socket.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extensions_browser_client.h"
#include "extensions/common/extension_id.h"
#include "net/base/net_errors.h"

namespace extensions {
namespace api {

BrowserThread;

static base::LazyInstance<
    BrowserContextKeyedAPIFactory<UDPSocketEventDispatcher>>::DestructorAtExit
    g_factory =;

// static
BrowserContextKeyedAPIFactory<UDPSocketEventDispatcher>*
UDPSocketEventDispatcher::GetFactoryInstance() {}

// static
UDPSocketEventDispatcher* UDPSocketEventDispatcher::Get(
    content::BrowserContext* context) {}

UDPSocketEventDispatcher::UDPSocketEventDispatcher(
    content::BrowserContext* context)
    :{}

UDPSocketEventDispatcher::~UDPSocketEventDispatcher() = default;

UDPSocketEventDispatcher::ReceiveParams::ReceiveParams() = default;

UDPSocketEventDispatcher::ReceiveParams::ReceiveParams(
    const ReceiveParams& other) = default;

UDPSocketEventDispatcher::ReceiveParams::~ReceiveParams() = default;

void UDPSocketEventDispatcher::OnSocketBind(const ExtensionId& extension_id,
                                            int socket_id) {}

void UDPSocketEventDispatcher::OnSocketResume(const ExtensionId& extension_id,
                                              int socket_id) {}

/* static */
void UDPSocketEventDispatcher::StartReceive(const ReceiveParams& params) {}

/* static */
void UDPSocketEventDispatcher::ReceiveCallback(
    const ReceiveParams& params,
    int bytes_read,
    scoped_refptr<net::IOBuffer> io_buffer,
    bool socket_destroying,
    const std::string& address,
    uint16_t port) {}

/* static */
void UDPSocketEventDispatcher::PostEvent(const ReceiveParams& params,
                                         std::unique_ptr<Event> event) {}

/*static*/
void UDPSocketEventDispatcher::DispatchEvent(void* browser_context_id,
                                             const ExtensionId& extension_id,
                                             std::unique_ptr<Event> event) {}

}  // namespace api
}  // namespace extensions