chromium/components/mirroring/mojom/mirroring_service.mojom

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

module mirroring.mojom;

import "components/mirroring/mojom/cast_message_channel.mojom";
import "components/mirroring/mojom/resource_provider.mojom";
import "components/mirroring/mojom/session_observer.mojom";
import "components/mirroring/mojom/session_parameters.mojom";
import "sandbox/policy/mojom/context.mojom";
import "sandbox/policy/mojom/sandbox.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";
import "mojo/public/mojom/base/values.mojom";

[EnableIf=is_mac]
const sandbox.mojom.Sandbox kMirroringSandbox
  = sandbox.mojom.Sandbox.kMirroring;
[EnableIfNot=is_mac]
const sandbox.mojom.Sandbox kMirroringSandbox = sandbox.mojom.Sandbox.kService;

// This interface is used to control a Cast mirroring session.
[ServiceSandbox=kMirroringSandbox]
interface MirroringService {
  // Starts a mirroring session. |max_resolution| is the maximium video
  // capturing resolution. |observer| will get notifications about lifecycle
  // events. |outbound_channel| is to handle the cast messages from this service
  // to the mirroring receiver. |inbound_channel| receives the cast messages
  // from the mirroring receiver to this service.
  // To stop the session, just close the message pipe.
  [AllowedContext=sandbox.mojom.Context.kBrowser]
  Start(SessionParameters params,
        gfx.mojom.Size max_resolution,
        pending_remote<SessionObserver> observer,
        pending_remote<ResourceProvider> resource_provider,
        pending_remote<CastMessageChannel> outbound_channel,
        pending_receiver<CastMessageChannel> inbound_channel);

  // Switch the source tab of the current mirroring session.
  SwitchMirroringSourceTab();

  // Fetches the current RTCP stats of the current mirroring session.
  // The stats are returned as base::Value::Dict.
  GetMirroringStats() => (mojo_base.mojom.Value json_stats);
};