// 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 observer, pending_remote resource_provider, pending_remote outbound_channel, pending_receiver 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::DictValue. GetMirroringStats() => (mojo_base.mojom.Value json_stats); };