1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56

media / mojo / mojom / cdm_service.mojom [blame]

// Copyright 2017 The Chromium Authors
// 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);
};