chromium/extensions/browser/api/socket/socket.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/socket/socket.h"

#include "base/functional/bind.h"
#include "base/lazy_instance.h"
#include "extensions/browser/api/api_resource_manager.h"
#include "net/base/address_list.h"
#include "net/base/io_buffer.h"
#include "net/base/ip_address.h"
#include "net/base/ip_endpoint.h"
#include "net/base/net_errors.h"
#include "net/socket/socket.h"

namespace extensions {

const char kSocketTypeNotSupported[] =;

static base::LazyInstance<
    BrowserContextKeyedAPIFactory<ApiResourceManager<Socket>>>::DestructorAtExit
    g_factory =;

// static
template <>
BrowserContextKeyedAPIFactory<ApiResourceManager<Socket>>*
ApiResourceManager<Socket>::GetFactoryInstance() {}

Socket::Socket(const std::string& owner_extension_id)
    :{}

Socket::~Socket() {}

void Socket::Write(scoped_refptr<net::IOBuffer> io_buffer,
                   int byte_count,
                   net::CompletionOnceCallback callback) {}

void Socket::WriteData() {}

void Socket::OnWriteComplete(int result) {}

void Socket::SetKeepAlive(bool enable,
                          int delay,
                          SetKeepAliveCallback callback) {}

void Socket::SetNoDelay(bool no_delay, SetNoDelayCallback callback) {}

void Socket::Listen(const std::string& address,
                    uint16_t port,
                    int backlog,
                    ListenCallback callback) {}

void Socket::Accept(AcceptCompletionCallback callback) {}

// static
bool Socket::StringAndPortToIPEndPoint(const std::string& ip_address_str,
                                       uint16_t port,
                                       net::IPEndPoint* ip_end_point) {}

void Socket::IPEndPointToStringAndPort(const net::IPEndPoint& address,
                                       std::string* ip_address_str,
                                       uint16_t* port) {}

Socket::WriteRequest::WriteRequest(scoped_refptr<net::IOBuffer> io_buffer,
                                   int byte_count,
                                   net::CompletionOnceCallback callback)
    :{}

Socket::WriteRequest::WriteRequest(WriteRequest&& other) = default;

Socket::WriteRequest::~WriteRequest() = default;

// static
net::NetworkTrafficAnnotationTag Socket::GetNetworkTrafficAnnotationTag() {}

}  // namespace extensions