2018-09-13 23:04:55 +03:00
|
|
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2015-09-14 05:39:57 +03:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
2016-10-17 03:19:00 +03:00
|
|
|
*
|
|
|
|
* The origin of this IDL file is
|
|
|
|
* https://w3c.github.io/presentation-api/#interface-presentationrequest
|
2015-09-14 05:39:57 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
[Constructor(DOMString url),
|
2016-09-05 02:17:00 +03:00
|
|
|
Constructor(sequence<DOMString> urls),
|
2016-06-03 14:50:30 +03:00
|
|
|
Pref="dom.presentation.controller.enabled"]
|
2015-09-14 05:39:57 +03:00
|
|
|
interface PresentationRequest : EventTarget {
|
|
|
|
/*
|
2015-10-12 05:36:31 +03:00
|
|
|
* A requesting page use start() to start a new connection, and it will be
|
|
|
|
* returned with the promise. UA may show a prompt box with a list of
|
2015-09-14 05:39:57 +03:00
|
|
|
* available devices and ask the user to grant permission, choose a device, or
|
|
|
|
* cancel the operation.
|
|
|
|
*
|
|
|
|
* The promise is resolved when the presenting page is successfully loaded and
|
2015-10-12 05:36:31 +03:00
|
|
|
* the communication channel is established, i.e., the connection state is
|
2015-09-14 05:39:57 +03:00
|
|
|
* "connected".
|
|
|
|
*
|
|
|
|
* The promise may be rejected duo to one of the following reasons:
|
|
|
|
* - "OperationError": Unexpected error occurs.
|
|
|
|
* - "NotFoundError": No available device.
|
|
|
|
* - "AbortError": User dismiss/cancel the device prompt box.
|
|
|
|
* - "NetworkError": Failed to establish the control channel or data channel.
|
|
|
|
* - "TimeoutError": Presenting page takes too long to load.
|
2016-08-02 20:11:00 +03:00
|
|
|
* - "SecurityError": This operation is insecure.
|
2015-09-14 05:39:57 +03:00
|
|
|
*/
|
|
|
|
[Throws]
|
2015-10-12 05:36:31 +03:00
|
|
|
Promise<PresentationConnection> start();
|
2015-09-14 05:39:57 +03:00
|
|
|
|
2016-08-02 20:11:00 +03:00
|
|
|
/*
|
|
|
|
* A requesting page can use reconnect(presentationId) to reopen a
|
|
|
|
* non-terminated presentation connection.
|
|
|
|
*
|
|
|
|
* The promise is resolved when a new presentation connection is created.
|
|
|
|
* The connection state is "connecting".
|
|
|
|
*
|
|
|
|
* The promise may be rejected duo to one of the following reasons:
|
|
|
|
* - "OperationError": Unexpected error occurs.
|
|
|
|
* - "NotFoundError": Can not find a presentation connection with the presentationId.
|
|
|
|
* - "SecurityError": This operation is insecure.
|
|
|
|
*/
|
|
|
|
[Throws]
|
|
|
|
Promise<PresentationConnection> reconnect(DOMString presentationId);
|
|
|
|
|
2015-09-14 05:39:57 +03:00
|
|
|
/*
|
|
|
|
* UA triggers device discovery mechanism periodically and monitor device
|
|
|
|
* availability.
|
|
|
|
*
|
|
|
|
* The promise may be rejected duo to one of the following reasons:
|
|
|
|
* - "NotSupportedError": Unable to continuously monitor the availability.
|
2016-08-31 05:31:15 +03:00
|
|
|
* - "SecurityError": This operation is insecure.
|
2015-09-14 05:39:57 +03:00
|
|
|
*/
|
|
|
|
[Throws]
|
|
|
|
Promise<PresentationAvailability> getAvailability();
|
|
|
|
|
|
|
|
/*
|
2015-10-12 05:36:31 +03:00
|
|
|
* It is called when a connection associated with a PresentationRequest is created.
|
|
|
|
* The event is fired for all connections that are created for the controller.
|
2015-09-14 05:39:57 +03:00
|
|
|
*/
|
2015-10-12 05:36:31 +03:00
|
|
|
attribute EventHandler onconnectionavailable;
|
2016-01-13 14:21:25 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* A chrome page, or page which has presentation-device-manage permissiongs,
|
|
|
|
* uses startWithDevice() to start a new connection with specified device,
|
|
|
|
* and it will be returned with the promise. UA may show a prompt box with a
|
|
|
|
* list of available devices and ask the user to grant permission, choose a
|
|
|
|
* device, or cancel the operation.
|
|
|
|
*
|
|
|
|
* The promise is resolved when the presenting page is successfully loaded and
|
|
|
|
* the communication channel is established, i.e., the connection state is
|
|
|
|
* "connected".
|
|
|
|
*
|
|
|
|
* The promise may be rejected duo to one of the following reasons:
|
|
|
|
* - "OperationError": Unexpected error occurs.
|
|
|
|
* - "NotFoundError": No available device.
|
|
|
|
* - "NetworkError": Failed to establish the control channel or data channel.
|
|
|
|
* - "TimeoutError": Presenting page takes too long to load.
|
|
|
|
*/
|
2016-04-21 16:48:59 +03:00
|
|
|
[ChromeOnly, Throws]
|
2016-01-13 14:21:25 +03:00
|
|
|
Promise<PresentationConnection> startWithDevice(DOMString deviceId);
|
2015-09-14 05:39:57 +03:00
|
|
|
};
|