chromium/chrome/browser/media/router/providers/cast/cast_media_route_provider.cc

// Copyright 2018 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/providers/cast/cast_media_route_provider.h"

#include <array>
#include <string_view>
#include <utility>
#include <vector>

#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/strings/string_split.h"
#include "base/task/bind_post_task.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/task_runner.h"
#include "chrome/browser/media/cast_mirroring_service_host.h"
#include "chrome/browser/media/router/media_router_feature.h"
#include "chrome/browser/media/router/providers/cast/cast_activity_manager.h"
#include "chrome/browser/media/router/providers/cast/cast_internal_message_util.h"
#include "chrome/browser/media/router/providers/cast/cast_media_route_provider_metrics.h"
#include "chrome/browser/media/router/providers/cast/cast_session_tracker.h"
#include "chrome/browser/media/router/providers/cast/mirroring_activity.h"
#include "components/media_router/browser/logger_impl.h"
#include "components/media_router/common/media_source.h"
#include "components/media_router/common/mojom/media_router.mojom.h"
#include "components/media_router/common/providers/cast/cast_media_source.h"
#include "components/media_router/common/providers/cast/channel/cast_message_handler.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "media/base/audio_codecs.h"
#include "media/base/media_switches.h"
#include "media/base/video_codecs.h"
#include "media/remoting/device_capability_checker.h"
#include "net/base/url_util.h"
#include "url/origin.h"

namespace media_router {

namespace {

constexpr char kLoggerComponent[] =;

// List of origins allowed to use a PresentationRequest to initiate mirroring.
constexpr std::array<std::string_view, 3> kPresentationApiAllowlist =;

// Returns a list of origins that are valid for |source_id|. An empty list
// means all origins are valid.
// TODO(takumif): Consider returning a nullopt instead of an empty vector to
// indicate all origins.
std::vector<url::Origin> GetOrigins(const MediaSource::Id& source_id) {}

std::optional<media::VideoCodec> ParseVideoCodec(
    const MediaSource& media_source) {}

std::optional<media::AudioCodec> ParseAudioCodec(
    const MediaSource& media_source) {}

std::vector<MediaSinkInternal> GetRemotePlaybackMediaSourceCompatibleSinks(
    const MediaSource& media_source,
    const std::vector<MediaSinkInternal>& sinks) {}

}  // namespace

CastMediaRouteProvider::CastMediaRouteProvider(
    mojo::PendingReceiver<mojom::MediaRouteProvider> receiver,
    mojo::PendingRemote<mojom::MediaRouter> media_router,
    MediaSinkServiceBase* media_sink_service,
    CastAppDiscoveryService* app_discovery_service,
    cast_channel::CastMessageHandler* message_handler,
    const std::string& hash_token,
    const scoped_refptr<base::SequencedTaskRunner>& task_runner)
    :{}

void CastMediaRouteProvider::Init(
    mojo::PendingReceiver<mojom::MediaRouteProvider> receiver,
    mojo::PendingRemote<mojom::MediaRouter> media_router,
    CastSessionTracker* session_tracker,
    const std::string& hash_token) {}

CastMediaRouteProvider::~CastMediaRouteProvider() {}

void CastMediaRouteProvider::CreateRoute(const std::string& source_id,
                                         const std::string& sink_id,
                                         const std::string& presentation_id,
                                         const url::Origin& origin,
                                         int32_t frame_tree_node_id,
                                         base::TimeDelta timeout,
                                         CreateRouteCallback callback) {}

void CastMediaRouteProvider::JoinRoute(const std::string& media_source,
                                       const std::string& presentation_id,
                                       const url::Origin& origin,
                                       int32_t frame_tree_node_id,
                                       base::TimeDelta timeout,
                                       JoinRouteCallback callback) {}

void CastMediaRouteProvider::TerminateRoute(const std::string& route_id,
                                            TerminateRouteCallback callback) {}

void CastMediaRouteProvider::SendRouteMessage(const std::string& media_route_id,
                                              const std::string& message) {}

void CastMediaRouteProvider::SendRouteBinaryMessage(
    const std::string& media_route_id,
    const std::vector<uint8_t>& data) {}

void CastMediaRouteProvider::StartObservingMediaSinks(
    const std::string& media_source) {}

void CastMediaRouteProvider::StopObservingMediaSinks(
    const std::string& media_source) {}

void CastMediaRouteProvider::StartObservingMediaRoutes() {}

void CastMediaRouteProvider::DetachRoute(const std::string& route_id) {}

void CastMediaRouteProvider::EnableMdnsDiscovery() {}

void CastMediaRouteProvider::DiscoverSinksNow() {}

void CastMediaRouteProvider::BindMediaController(
    const std::string& route_id,
    mojo::PendingReceiver<mojom::MediaController> media_controller,
    mojo::PendingRemote<mojom::MediaStatusObserver> observer,
    BindMediaControllerCallback callback) {}

void CastMediaRouteProvider::GetState(GetStateCallback callback) {}

void CastMediaRouteProvider::OnSinkQueryUpdated(
    const MediaSource::Id& source_id,
    const std::vector<MediaSinkInternal>& sinks) {}

}  // namespace media_router