chromium/chrome/browser/media/output_protection_proxy.cc

// Copyright 2016 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/output_protection_proxy.h"

#include <optional>
#include <utility>

#include "base/functional/bind.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
#include "ui/display/types/display_constants.h"

#if BUILDFLAG(IS_CHROMEOS_LACROS)
#include "chromeos/lacros/lacros_service.h"
#include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h"
#endif  // BUILDFLAG(IS_CHROMEOS_LACROS)

namespace {

gfx::NativeView GetRenderFrameView(int render_process_id, int render_frame_id) {}

#if BUILDFLAG(IS_CHROMEOS_LACROS)
std::optional<std::string> GetWindowId(int render_process_id,
                                       int render_frame_id) {
  gfx::NativeView native_view =
      GetRenderFrameView(render_process_id, render_frame_id);
  if (!native_view)
    return std::nullopt;

  aura::Window* root_window = native_view->GetRootWindow();
  if (!root_window)
    return std::nullopt;

  aura::WindowTreeHost* window_tree_host = root_window->GetHost();
  DCHECK(window_tree_host);

  return window_tree_host->GetUniqueId();
}
#endif  // BUILDFLAG(IS_CHROMEOS_LACROS)

}  // namespace

OutputProtectionProxy::OutputProtectionProxy(int render_process_id,
                                             int render_frame_id)
    :{}

OutputProtectionProxy::~OutputProtectionProxy() {}

void OutputProtectionProxy::QueryStatus(QueryStatusCallback callback) {}

void OutputProtectionProxy::EnableProtection(
    uint32_t desired_method_mask,
    EnableProtectionCallback callback) {}

void OutputProtectionProxy::ProcessQueryStatusResult(
    QueryStatusCallback callback,
    bool success,
    uint32_t link_mask,
    uint32_t protection_mask) {}

#if BUILDFLAG(IS_CHROMEOS_LACROS)
void OutputProtectionProxy::ProcessQueryStatusResultLacros(
    QueryStatusCallback callback,
    crosapi::mojom::ContentProtectionWindowStatusPtr window_status) {
  if (window_status) {
    ProcessQueryStatusResult(std::move(callback), /*success=*/true,
                             window_status->link_mask,
                             window_status->protection_mask);
  } else {
    ProcessQueryStatusResult(std::move(callback), /*success=*/false, 0, 0);
  }
}
#endif