chromium/chromecast/mojo/mojom/remote_interfaces.mojom

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module chromecast.mojom;

// Note for reviewers: Never allow an instance of RemoteInterfaces to be exposed
// to a sandboxed process (e.g. render process).
//
// Generic interface for binding a message pipe |pipe| to an interface with type
// |interface_name|. As a generic binding surface, this interface will never be
// provided to an unprivileged process. When implementing or using this
// interface, keep in mind the following:
//
// 1. This interface is accessible only to unsandboxed, privileged processes
//    running trusted code.
// 2. Trusted clients are free to pass and wrap this interface around as they
//    see fit. Therefore, make no assumptions about which trusted system
//    components have access to it, since there is no programmatic enforcement.
//
// This interface is only used on Cast devices. This offers an easy way to move
// off of the Service Manager. For example, an instance of RemoteInterfaces can
// be injected into a process that uses the service_manager::Connector to bind
// Remotes to other services.
interface RemoteInterfaces {
  // Requests to bind |pipe| to a named interface type.
  BindInterface(string interface_name, handle<message_pipe> pipe);

  // Binds a remote client to the implementation.
  AddClient(pending_receiver<RemoteInterfaces> receiver);
};