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

media / mojo / mojom / media_drm_storage.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 "mojo/public/mojom/base/unguessable_token.mojom";

struct SessionData {
  // see media::MediaDrmKeyType
  [Native]
  enum KeyType;

  array<uint8> key_set_id;
  string mime_type;
  KeyType key_type;
};

// Allows MediaDrmBridge to store and retrieve persistent data. This is needed
// for features like per-origin provisioning and persistent license support.
// The persistent data stored by MediaDrmStorage is auxiliary data, which will
// be used by MediaDrmBridge to retrieve the actual license. MediaDrm in media
// service is the true source for the persistent license and origin
// provisioning.
interface MediaDrmStorage {
  // Initializes |this| and if successful (|success| = true) returns an origin
  // ID that can be used to identify the current origin. If |origin_id| is
  // not empty, then it must be valid and unique among all origins. The
  // implementation will persist the information (e.g. origin ID, provision
  // time) in the storage. If |origin_id| is empty, then device-wide
  // provisioning is to be used. If Initialize() fails or returns an empty
  // origin ID then the other methods below should not be called, and will
  // fail if they are called.
  Initialize() => (bool success, mojo_base.mojom.UnguessableToken? origin_id);

  // Saves origin information (e.g. origin ID, provision time) in the storage
  // after MediaDrm is provisioned for current origin. It will clear all
  // existing persistent session data for the origin.
  OnProvisioned() => (bool success);

  // Saves persistent session data for |session_id|.
  SavePersistentSession(
    string session_id, SessionData session_data) => (bool success);

  // Loads persistent session data for |session_id|.
  // Upon failure, null |session_data| will be returned.
  LoadPersistentSession(string session_id) => (SessionData? session_data);

  // Removes the persistent session data for |session_id|.
  RemovePersistentSession(string session_id) => (bool success);
};