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 57 58 59
|
// 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";
// The `kMirroring` sandbox type is only defined on macOS, and enables access to
// the IOSurface system calls.
[EnableIf=is_mac]
const sandbox.mojom.Sandbox kMirroringSandbox =
sandbox.mojom.Sandbox.kMirroring;
// On ChromeOS, we need a more permissive sandbox for hardware encoding video,
// including calls to ioctl and other system methods.
[EnableIf=is_chromeos_with_video_accelerators]
const sandbox.mojom.Sandbox kMirroringSandbox =
sandbox.mojom.Sandbox.kHardwareVideoEncoding;
// On all other platforms, the standard, restrictive service sandbox seems to be
// permissive enough for our use case.
//
// NOTE: we don't support hardware encoding on Linux currently. If support is
// added, its sandbox will likely have to be updated to match ChromeOS.
[EnableIfNot=is_mac|is_chromeos_with_video_accelerators]
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);
};
|