blob: cb10ff26f23cc4d92783d8d1517af1f9a1c4fdf5 [file] [log] [blame]
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module media.mojom;
import "media/mojo/mojom/content_decryption_module.mojom";
import "media/mojo/mojom/frame_interface_factory.mojom";
import "mojo/public/mojom/base/file_path.mojom";
import "sandbox/policy/mojom/sandbox.mojom";
import "services/service_manager/public/mojom/interface_provider.mojom";
[EnableIf=is_mac]
import "sandbox/mac/mojom/seatbelt_extension_token.mojom";
// A service to create a CdmFactory that can provide CDM service, typically
// to the media pipeline running in the renderer process. The service itself
// runs in the CDM (utility) process. The service is always connected from the
// browser process.
interface CdmService {
// Requests an CdmFactory. `frame_interfaces` can optionally be used to
// provide interfaces hosted by the caller to the remote CdmFactory
// implementation.
CreateCdmFactory(pending_receiver<CdmFactory> factory,
pending_remote<FrameInterfaceFactory> frame_interfaces);
};
// An interface to provide a sandbox seatbelt extension token synchronously.
[EnableIf=is_mac]
interface SeatbeltExtensionTokenProvider {
[Sync]
GetTokens() => (array<sandbox.mac.mojom.SeatbeltExtensionToken> tokens);
};
// A broker service to get the `CdmService`, needed to pass necessary parameters
// to preload the CDM before creating the `CdmService`. The `CdmServiceBroker`
// runs in the CDM (utility) process and is connected from the browser process
// (see content/browser/media/service_factory.cc). In the process there should
// only be one `CdmServiceBroker` and one `CdmService` instance running. As such
// the `GetService()` should only be called once and the subsequent calls will
// simply fail.
//
// Notes on CDM preloading and sandbox:
// - On Windows, when `CdmServiceBroker` is connected the CDM was not sandboxed
// to allow CDM preloading. After `GetService()` the process is fully sandboxed.
// - On Mac, the process is fully sandboxed when launched, and `token_provider`
// is needed to help load the CDM in the process.
// - On Linux/ChromeOS, the CDM is preloaded in the zygote sandbox.
[ServiceSandbox=sandbox.mojom.Sandbox.kCdm]
interface CdmServiceBroker {
// Loads the CDM at `cdm_path` into the process and returns the `CdmService`.
GetService(mojo_base.mojom.FilePath cdm_path,
[EnableIf=is_mac]
pending_remote<SeatbeltExtensionTokenProvider>? token_provider,
pending_receiver<CdmService> receiver);
};