Bug 1061481 - Patch 1/3: Cleanup WebIDL files, r=bz

This commit is contained in:
Ben Tian 2014-09-11 10:03:40 +08:00
Родитель 188e69f86b
Коммит 4eca37ce95
4 изменённых файлов: 54 добавлений и 48 удалений

Просмотреть файл

@ -32,24 +32,6 @@ dictionary MediaPlayStatus
DOMString playStatus = "";
};
enum BluetoothAdapterState
{
"disabled",
"disabling",
"enabled",
"enabling"
};
enum BluetoothAdapterAttribute
{
"unknown",
"state",
"address",
"name",
"discoverable",
"discovering"
};
[CheckPermissions="bluetooth"]
interface BluetoothAdapter : EventTarget {
readonly attribute BluetoothAdapterState state;
@ -61,6 +43,15 @@ interface BluetoothAdapter : EventTarget {
[AvailableIn=CertifiedApps]
readonly attribute BluetoothPairingListener pairingReqs;
// Fired when attribute(s) of BluetoothAdapter changed
attribute EventHandler onattributechanged;
// Fired when a remote device gets paired with the adapter
attribute EventHandler ondevicepaired;
// Fired when a remote device gets unpaired from the adapter
attribute EventHandler ondeviceunpaired;
// Fired when a2dp connection status changed
attribute EventHandler ona2dpstatuschanged;
@ -73,22 +64,12 @@ interface BluetoothAdapter : EventTarget {
// Fired when remote devices query current media play status
attribute EventHandler onrequestmediaplaystatus;
// Fired when attributes of BluetoothAdapter changed
attribute EventHandler onattributechanged;
// Fired when a remote device gets paired with the adapter.
attribute EventHandler ondevicepaired;
// Fired when a remote device gets unpaired from the adapter.
attribute EventHandler ondeviceunpaired;
/**
* Enable/Disable a local bluetooth adapter by asynchronus methods and return
* its result through a Promise.
*
* Several onattributechanged events would be triggered during processing the
* request, and the last one would indicate adapter.state becomes
* enabled/disabled.
* request, and the last one indicates adapter.state becomes enabled/disabled.
*/
[NewObject, Throws]
Promise<void> enable();
@ -177,3 +158,22 @@ interface BluetoothAdapter : EventTarget {
[NewObject,Throws]
DOMRequest sendMediaPlayStatus(optional MediaPlayStatus mediaPlayStatus);
};
enum BluetoothAdapterState
{
"disabled",
"disabling",
"enabled",
"enabling"
};
enum BluetoothAdapterAttribute
{
"unknown",
"state",
"address",
"name",
"discoverable",
"discovering"
};

Просмотреть файл

@ -4,21 +4,6 @@
* 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/. */
/*
* Set of attributes that might be changed and reported by attributechanged
* event.
* Address is not included since it should not be changed once BluetoothDevice
* is created.
*/
enum BluetoothDeviceAttribute
{
"unknown",
"cod",
"name",
"paired",
"uuids"
};
[CheckPermissions="bluetooth"]
interface BluetoothDevice : EventTarget
{
@ -30,6 +15,7 @@ interface BluetoothDevice : EventTarget
[Cached, Pure]
readonly attribute sequence<DOMString> uuids;
// Fired when attribute(s) of BluetoothDevice changed
attribute EventHandler onattributechanged;
/**
@ -42,3 +28,18 @@ interface BluetoothDevice : EventTarget
[NewObject, Throws]
Promise<sequence<DOMString>> fetchUuids();
};
/*
* Possible device attributes that attributechanged event reports.
* Note "address" is excluded since it never changes once BluetoothDevice
* is created.
*/
enum BluetoothDeviceAttribute
{
"unknown",
"cod",
"name",
"paired",
"uuids"
};

Просмотреть файл

@ -8,8 +8,13 @@ interface BluetoothManager: EventTarget
{
readonly attribute BluetoothAdapter? defaultAdapter;
// Fired when attribute(s) of BluetoothManager changed
attribute EventHandler onattributechanged;
// Fired when a new adapter is plugged in
attribute EventHandler onadapteradded;
// Fired when an existing adapter is unplugged
attribute EventHandler onadapterremoved;
sequence<BluetoothAdapter> getAdapters();

Просмотреть файл

@ -9,12 +9,12 @@
optional BluetoothPairingEventInit eventInitDict)]
interface BluetoothPairingEvent : Event
{
readonly attribute BluetoothDevice? device;
readonly attribute BluetoothPairingHandle? handle;
readonly attribute BluetoothDevice device;
readonly attribute BluetoothPairingHandle handle;
};
dictionary BluetoothPairingEventInit : EventInit
{
BluetoothDevice? device = null;
BluetoothPairingHandle? handle = null;
required BluetoothDevice device;
required BluetoothPairingHandle handle;
};