chromium/content/renderer/media/media_permission_dispatcher.cc

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

#include "content/renderer/media/media_permission_dispatcher.h"

#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/not_fatal_until.h"
#include "base/notreached.h"
#include "base/task/bind_post_task.h"
#include "base/task/single_thread_task_runner.h"
#include "base/types/cxx23_to_underlying.h"
#include "third_party/blink/public/web/web_local_frame.h"
#include "url/gurl.h"

#if BUILDFLAG(IS_WIN)
#include "base/functional/callback_forward.h"
#endif  // BUILDFLAG(IS_WIN)

namespace {

Type;

blink::mojom::PermissionDescriptorPtr MediaPermissionTypeToPermissionDescriptor(
    Type type) {}

}  // namespace

namespace content {

MediaPermissionDispatcher::MediaPermissionDispatcher(
    RenderFrameImpl* render_frame)
    :{}

MediaPermissionDispatcher::~MediaPermissionDispatcher() {}

void MediaPermissionDispatcher::OnNavigation() {}

void MediaPermissionDispatcher::HasPermission(
    Type type,
    PermissionStatusCB permission_status_cb) {}

void MediaPermissionDispatcher::RequestPermission(
    Type type,
    PermissionStatusCB permission_status_cb) {}

bool MediaPermissionDispatcher::IsEncryptedMediaEnabled() {}

uint32_t MediaPermissionDispatcher::RegisterCallback(
    PermissionStatusCB permission_status_cb) {}

blink::mojom::PermissionService*
MediaPermissionDispatcher::GetPermissionService() {}

void MediaPermissionDispatcher::OnPermissionStatus(
    uint32_t request_id,
    blink::mojom::PermissionStatus status) {}

#if BUILDFLAG(IS_WIN)
void MediaPermissionDispatcher::IsHardwareSecureDecryptionAllowed(
    IsHardwareSecureDecryptionAllowedCB cb) {
  GetMediaFoundationPreferences()->IsHardwareSecureDecryptionAllowed(
      std::move(cb));
}

media::mojom::MediaFoundationPreferences*
MediaPermissionDispatcher::GetMediaFoundationPreferences() {
  if (!mf_preferences_) {
    render_frame_->GetBrowserInterfaceBroker().GetInterface(
        mf_preferences_.BindNewPipeAndPassReceiver());
    mf_preferences_.set_disconnect_handler(base::BindOnce(
        &MediaPermissionDispatcher::OnMediaFoundationPreferencesConnectionError,
        base::Unretained(this)));
  }

  return mf_preferences_.get();
}

void MediaPermissionDispatcher::OnMediaFoundationPreferencesConnectionError() {
  mf_preferences_.reset();
}
#endif  // BUILDFLAG(IS_WIN)

void MediaPermissionDispatcher::OnPermissionServiceConnectionError() {}

}  // namespace content