1 // Copyright 2021 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 #ifndef MEDIA_MOJO_SERVICES_CDM_SERVICE_BROKER_H_
6 #define MEDIA_MOJO_SERVICES_CDM_SERVICE_BROKER_H_
10 #include "build/build_config.h"
11 #include "media/mojo/mojom/cdm_service.mojom.h"
12 #include "media/mojo/services/cdm_service.h"
13 #include "media/mojo/services/media_mojo_export.h"
14 #include "mojo/public/cpp/bindings/pending_receiver.h"
15 #include "mojo/public/cpp/bindings/pending_remote.h"
16 #include "mojo/public/cpp/bindings/receiver.h"
20 class MEDIA_MOJO_EXPORT CdmServiceBroker final
21 : public mojom::CdmServiceBroker {
23 CdmServiceBroker(std::unique_ptr<CdmService::Client> client,
24 mojo::PendingReceiver<mojom::CdmServiceBroker> receiver);
25 CdmServiceBroker(const CdmServiceBroker&) = delete;
26 CdmServiceBroker operator=(const CdmServiceBroker&) = delete;
27 ~CdmServiceBroker() final;
29 // mojom::CdmServiceBroker implementation:
31 const base::FilePath& cdm_path,
33 mojo::PendingRemote<mojom::SeatbeltExtensionTokenProvider> token_provider,
34 #endif // BUILDFLAG(IS_MAC)
35 mojo::PendingReceiver<mojom::CdmService> service_receiver) final;
38 // Initializes CdmModule and make sure the sandbox is sealed. Returns whether
39 // the initialization succeeded or not. In all cases, the process is sandboxed
41 bool InitializeAndEnsureSandboxed(
43 mojo::PendingRemote<mojom::SeatbeltExtensionTokenProvider> token_provider,
44 #endif // BUILDFLAG(IS_MAC)
45 const base::FilePath& cdm_path);
47 std::unique_ptr<CdmService::Client> client_;
48 mojo::Receiver<mojom::CdmServiceBroker> receiver_;
49 std::unique_ptr<CdmService> cdm_service_;
54 #endif // MEDIA_MOJO_SERVICES_CDM_SERVICE_BROKER_H_