chromium/chrome/browser/media/router/discovery/mdns/cast_media_sink_service_impl.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 "chrome/browser/media/router/discovery/mdns/cast_media_sink_service_impl.h"

#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/rand_util.h"
#include "base/ranges/algorithm.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/time/default_clock.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/media/router/discovery/mdns/media_sink_util.h"
#include "chrome/browser/media/router/media_router_feature.h"
#include "chrome/browser/net/system_network_context_manager.h"  // nogncheck
#include "components/media_router/common/discovery/media_sink_internal.h"
#include "components/media_router/common/media_sink.h"
#include "components/media_router/common/mojom/media_router.mojom.h"
#include "components/media_router/common/providers/cast/channel/cast_channel_enum.h"
#include "components/media_router/common/providers/cast/channel/cast_device_capability.h"
#include "components/media_router/common/providers/cast/channel/cast_socket_service.h"
#include "components/net_log/chrome_net_log.h"
#include "content/public/browser/browser_thread.h"
#include "net/base/backoff_entry.h"
#include "net/base/net_errors.h"

namespace media_router {

namespace {

constexpr char kLoggerComponent[] =;

MediaSinkInternal CreateCastSinkFromDialSink(
    const MediaSinkInternal& dial_sink) {}

std::string EnumToString(MediaRouterChannelError error) {}

MediaRouterChannelError RecordError(cast_channel::ChannelError channel_error,
                                    cast_channel::LastError last_error) {}

// Max allowed values
constexpr int kMaxConnectTimeoutInSeconds =;
constexpr int kMaxLivenessTimeoutInSeconds =;

// Max failure count allowed for a Cast channel.
constexpr int kMaxFailureCount =;

bool IsNetworkIdUnknownOrDisconnected(const std::string& network_id) {}

// Updates |existing_sink| with properties from |new_sink|. The relevant
// properties are sink name and capabilities (and icon type, by association).
// This method is only called with a |new_sink| discovered by mDNS. As such,
// |discovery_type| is also updated to kMdns.
void UpdateCastSink(const MediaSinkInternal& new_sink,
                    MediaSinkInternal* existing_sink) {}

}  // namespace

// static
constexpr int CastMediaSinkServiceImpl::kMaxDialSinkFailureCount;

// static
MediaSink::Id CastMediaSinkServiceImpl::GetCastSinkIdFromDial(
    const MediaSink::Id& dial_sink_id) {}

// static
MediaSink::Id CastMediaSinkServiceImpl::GetDialSinkIdFromCast(
    const MediaSink::Id& cast_sink_id) {}

CastMediaSinkServiceImpl::CastMediaSinkServiceImpl(
    const OnSinksDiscoveredCallback& callback,
    cast_channel::CastSocketService* cast_socket_service,
    DiscoveryNetworkMonitor* network_monitor,
    MediaSinkServiceBase* dial_media_sink_service,
    bool allow_all_ips)
    :{}

CastMediaSinkServiceImpl::~CastMediaSinkServiceImpl() {}

void CastMediaSinkServiceImpl::SetClockForTest(base::Clock* clock) {}

void CastMediaSinkServiceImpl::Start() {}

void CastMediaSinkServiceImpl::RecordDeviceCounts() {}

void CastMediaSinkServiceImpl::DiscoverSinksNow() {}

void CastMediaSinkServiceImpl::OpenChannelsWithRandomizedDelay(
    const std::vector<MediaSinkInternal>& cast_sinks,
    SinkSource sink_source) {}

void CastMediaSinkServiceImpl::OpenChannels(
    const std::vector<MediaSinkInternal>& cast_sinks,
    SinkSource sink_source) {}

void CastMediaSinkServiceImpl::OnError(const cast_channel::CastSocket& socket,
                                       cast_channel::ChannelError error_state) {}

void CastMediaSinkServiceImpl::OnMessage(
    const cast_channel::CastSocket& socket,
    const openscreen::cast::proto::CastMessage& message) {}

void CastMediaSinkServiceImpl::OnReadyStateChanged(
    const cast_channel::CastSocket& socket) {}

void CastMediaSinkServiceImpl::OnNetworksChanged(
    const std::string& network_id) {}

cast_channel::CastSocketOpenParams
CastMediaSinkServiceImpl::CreateCastSocketOpenParams(
    const MediaSinkInternal& sink) {}

void CastMediaSinkServiceImpl::OpenChannel(
    const MediaSinkInternal& cast_sink,
    std::unique_ptr<net::BackoffEntry> backoff_entry,
    SinkSource sink_source,
    ChannelOpenedCallback callback,
    cast_channel::CastSocketOpenParams open_params) {}

void CastMediaSinkServiceImpl::OnChannelOpened(
    const MediaSinkInternal& cast_sink,
    std::unique_ptr<net::BackoffEntry> backoff_entry,
    SinkSource sink_source,
    base::Time start_time,
    ChannelOpenedCallback callback,
    cast_channel::CastSocketOpenParams open_params,
    cast_channel::CastSocket* socket) {}

void CastMediaSinkServiceImpl::OnChannelErrorMayRetry(
    MediaSinkInternal cast_sink,
    std::unique_ptr<net::BackoffEntry> backoff_entry,
    cast_channel::ChannelError error_state,
    SinkSource sink_source,
    ChannelOpenedCallback callback,
    cast_channel::CastSocketOpenParams open_params) {}

void CastMediaSinkServiceImpl::OnChannelOpenSucceeded(
    MediaSinkInternal cast_sink,
    cast_channel::CastSocket* socket,
    SinkSource sink_source,
    ChannelOpenedCallback callback) {}

void CastMediaSinkServiceImpl::OnChannelOpenFailed(
    const net::IPEndPoint& ip_endpoint,
    const MediaSinkInternal& sink,
    ChannelOpenedCallback callback) {}

void CastMediaSinkServiceImpl::OnSinkAddedOrUpdated(
    const MediaSinkInternal& sink) {}

void CastMediaSinkServiceImpl::OnSinkRemoved(const MediaSinkInternal& sink) {}

void CastMediaSinkServiceImpl::TryConnectDialDiscoveredSink(
    const MediaSinkInternal& dial_sink) {}

bool CastMediaSinkServiceImpl::IsProbablyNonCastDevice(
    const MediaSinkInternal& dial_sink) const {}

void CastMediaSinkServiceImpl::OpenChannelsNow(
    const std::vector<MediaSinkInternal>& cast_sinks) {}

void CastMediaSinkServiceImpl::SetCastAllowAllIPs(bool allow_all_ips) {}

bool CastMediaSinkServiceImpl::HasSink(const MediaSink::Id& sink_id) {}

void CastMediaSinkServiceImpl::DisconnectAndRemoveSink(
    const MediaSinkInternal& sink) {}

bool CastMediaSinkServiceImpl::HasSinkWithIPAddress(
    const net::IPAddress& ip_address) const {}

}  // namespace media_router