1 // Copyright 2023 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "media/mojo/services/media_foundation_preferences.h"
9 #include "base/functional/callback.h"
10 #include "base/logging.h"
11 #include "mojo/public/cpp/bindings/self_owned_receiver.h"
13 MediaFoundationPreferencesImpl::MediaFoundationPreferencesImpl(
15 IsHardwareSecureDecryptionAllowedCB cb)
16 : site_(site), is_hardware_secure_decryption_allowed_cb_(cb) {}
17 MediaFoundationPreferencesImpl::~MediaFoundationPreferencesImpl() = default;
20 void MediaFoundationPreferencesImpl::Create(
22 IsHardwareSecureDecryptionAllowedCB cb,
23 mojo::PendingReceiver<media::mojom::MediaFoundationPreferences> receiver) {
26 mojo::MakeSelfOwnedReceiver(
27 std::make_unique<MediaFoundationPreferencesImpl>(site, cb),
31 void MediaFoundationPreferencesImpl::IsHardwareSecureDecryptionAllowed(
32 IsHardwareSecureDecryptionAllowedCallback cb) {
35 if (!is_hardware_secure_decryption_allowed_cb_) {
36 std::move(cb).Run(true);
40 std::move(cb).Run(is_hardware_secure_decryption_allowed_cb_.Run(site_));