chromium/chrome/browser/ui/webui/access_code_cast/access_code_cast_handler.cc

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

#include <numeric>

#include "chrome/browser/ui/webui/access_code_cast/access_code_cast_handler.h"

#include "base/containers/contains.h"
#include "base/metrics/histogram_functions.h"
#include "base/rand_util.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/media/router/discovery/access_code/access_code_cast_sink_service_factory.h"
#include "chrome/browser/media/router/discovery/access_code/access_code_media_sink_util.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/sync/sync_service_factory.h"
#include "components/access_code_cast/common/access_code_cast_metrics.h"
#include "components/media_router/browser/media_router.h"
#include "components/media_router/browser/media_router_factory.h"
#include "components/media_router/common/discovery/media_sink_internal.h"
#include "components/media_router/common/discovery/media_sink_service_base.h"
#include "components/media_router/common/mojom/media_router_mojom_traits.h"
#include "components/sessions/content/session_tab_helper.h"
#include "mojo/public/cpp/bindings/callback_helpers.h"

RouteRequestResultCode;
// TODO(b/213324920): Remove WebUI from the media_router namespace after
// expiration module has been completed.
namespace media_router {

namespace {

const char* AddSinkResultCodeToStringHelper(AddSinkResultCode value) {}

AccessCodeCastCastMode CastModeMetricsHelper(MediaCastMode mode) {}

AddSinkResultCode AddSinkMetricsCallback(AddSinkResultCode result) {}

std::string AddSinkResultCodeToString(AddSinkResultCode value) {}

constexpr char kLoggerComponent[] =;

std::string CastModeSetToString(
    const media_router::CastModeSet& cast_mode_set) {}

}  // namespace

AccessCodeCastHandler::AccessCodeCastHandler(
    mojo::PendingReceiver<access_code_cast::mojom::PageHandler> page_handler,
    mojo::PendingRemote<access_code_cast::mojom::Page> page,
    const media_router::CastModeSet& cast_mode_set,
    std::unique_ptr<MediaRouteStarter> media_route_starter)
    :{}

AccessCodeCastHandler::AccessCodeCastHandler(
    mojo::PendingReceiver<access_code_cast::mojom::PageHandler> page_handler,
    mojo::PendingRemote<access_code_cast::mojom::Page> page,
    const media_router::CastModeSet& cast_mode_set,
    std::unique_ptr<MediaRouteStarter> media_route_starter,
    AccessCodeCastSinkService* access_code_sink_service)
    :{}

AccessCodeCastHandler::~AccessCodeCastHandler() {}

void AccessCodeCastHandler::Init() {}

void AccessCodeCastHandler::AddSink(
    const std::string& access_code,
    access_code_cast::mojom::CastDiscoveryMethod discovery_method,
    AddSinkCallback callback) {}

bool AccessCodeCastHandler::IsCastModeAvailable(MediaCastMode mode) const {}

// Discovery is not complete until the sink is in QRM. This is because any
// attempt to create route parameters before the sink is in QRM will fail.
void AccessCodeCastHandler::CheckForDiscoveryCompletion() {}

void AccessCodeCastHandler::OnSinkAddedResult(
    access_code_cast::mojom::AddSinkResultCode add_sink_result,
    std::optional<MediaSink::Id> sink_id) {}

void AccessCodeCastHandler::SetSinkCallbackForTesting(
    AddSinkCallback callback) {}

// QueryManager observer that alerts the handler about the availability of
// newly discovered sinks, as well as what types of casting those sinks support.
void AccessCodeCastHandler::OnSinksUpdated(
    const std::vector<MediaSinkWithCastModes>& sinks) {}

void AccessCodeCastHandler::CastToSink(CastToSinkCallback callback) {}

void AccessCodeCastHandler::OnSinkAddedResultForTesting(
    access_code_cast::mojom::AddSinkResultCode add_sink_result,
    std::optional<MediaSink::Id> sink_id) {}

void AccessCodeCastHandler::OnSinksUpdatedForTesting(
    const std::vector<MediaSinkWithCastModes>& sinks) {}

// MediaRouter::CreateRoute callback handler - log the success / failure of the
// CreateRoute operation and return the result code to the dialog.
// If there is a presentation request, call the appropriate presentation
// callbacks with the presentation connection.
void AccessCodeCastHandler::OnRouteResponse(MediaCastMode cast_mode,
                                            int route_request_id,
                                            const MediaSink::Id& sink_id,
                                            CastToSinkCallback dialog_callback,
                                            const RouteRequestResult& result) {}

bool AccessCodeCastHandler::HasActiveRoute(const MediaSink::Id& sink_id) {}

void AccessCodeCastHandler::SetIdentityManagerForTesting(
    signin::IdentityManager* identity_manager) {}

void AccessCodeCastHandler::SetSyncServiceForTesting(
    syncer::SyncService* sync_service) {}

bool AccessCodeCastHandler::IsAccountSyncEnabled() {}

}  // namespace media_router