mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset a471c7c73409 (bug 1036234) for build bustage on A CLOSED TREE
This commit is contained in:
parent
54c0424a9f
commit
da90530683
@ -706,8 +706,6 @@ GK_ATOM(ondeleted, "ondeleted")
|
||||
GK_ATOM(ondeliverysuccess, "ondeliverysuccess")
|
||||
GK_ATOM(ondeliveryerror, "ondeliveryerror")
|
||||
GK_ATOM(ondevicefound, "ondevicefound")
|
||||
GK_ATOM(ondevicepaired, "ondevicepaired")
|
||||
GK_ATOM(ondeviceunpaired, "ondeviceunpaired")
|
||||
GK_ATOM(ondialing, "ondialing")
|
||||
GK_ATOM(ondisabled, "ondisabled")
|
||||
GK_ATOM(ondischargingtimechange, "ondischargingtimechange")
|
||||
@ -801,6 +799,7 @@ GK_ATOM(onoverflowchanged, "onoverflowchanged")
|
||||
GK_ATOM(onpagehide, "onpagehide")
|
||||
GK_ATOM(onpageshow, "onpageshow")
|
||||
GK_ATOM(onpaint, "onpaint")
|
||||
GK_ATOM(onpairedstatuschanged, "onpairedstatuschanged")
|
||||
GK_ATOM(onpairingconfirmationreq, "onpairingconfirmationreq")
|
||||
GK_ATOM(onpairingconsentreq, "onpairingconsentreq")
|
||||
GK_ATOM(onpaste, "onpaste")
|
||||
|
@ -299,7 +299,7 @@ BluetoothAdapter::SetPropertyByValue(const BluetoothNamedValue& aValue)
|
||||
BT_APPEND_NAMED_VALUE(props, "Address", pairedDeviceAddresses[i]);
|
||||
BT_APPEND_NAMED_VALUE(props, "Paired", true);
|
||||
|
||||
// Create paired device with 'address' and 'paired' attributes
|
||||
// Create paired device with address and paired attributes
|
||||
nsRefPtr<BluetoothDevice> pairedDevice =
|
||||
BluetoothDevice::Create(GetOwner(), BluetoothValue(props));
|
||||
|
||||
@ -351,11 +351,8 @@ BluetoothAdapter::Notify(const BluetoothSignal& aData)
|
||||
}
|
||||
} else if (aData.name().EqualsLiteral("PairingRequest")) {
|
||||
HandlePairingRequest(v);
|
||||
} else if (aData.name().EqualsLiteral(DEVICE_PAIRED_ID)) {
|
||||
HandleDevicePaired(aData.value());
|
||||
} else if (aData.name().EqualsLiteral(DEVICE_UNPAIRED_ID)) {
|
||||
HandleDeviceUnpaired(aData.value());
|
||||
} else if (aData.name().EqualsLiteral(HFP_STATUS_CHANGED_ID) ||
|
||||
} else if (aData.name().EqualsLiteral(PAIRED_STATUS_CHANGED_ID) ||
|
||||
aData.name().EqualsLiteral(HFP_STATUS_CHANGED_ID) ||
|
||||
aData.name().EqualsLiteral(SCO_STATUS_CHANGED_ID) ||
|
||||
aData.name().EqualsLiteral(A2DP_STATUS_CHANGED_ID)) {
|
||||
MOZ_ASSERT(v.type() == BluetoothValue::TArrayOfBluetoothNamedValue);
|
||||
@ -895,79 +892,6 @@ BluetoothAdapter::DispatchAttributeEvent(const nsTArray<nsString>& aTypes)
|
||||
DispatchTrustedEvent(event);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothAdapter::HandleDevicePaired(const BluetoothValue& aValue)
|
||||
{
|
||||
MOZ_ASSERT(aValue.type() == BluetoothValue::TArrayOfBluetoothNamedValue);
|
||||
|
||||
if (mState != BluetoothAdapterState::Enabled) {
|
||||
BT_WARNING("HandleDevicePaired() is called when adapter isn't enabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Create paired device with 'address' and 'paired' attributes
|
||||
nsRefPtr<BluetoothDevice> pairedDevice =
|
||||
BluetoothDevice::Create(GetOwner(), aValue);
|
||||
|
||||
size_t index = mDevices.IndexOf(pairedDevice,
|
||||
0, /* aStart */
|
||||
BluetoothDeviceComparator());
|
||||
|
||||
if (index != mDevices.NoIndex) {
|
||||
pairedDevice = mDevices[index];
|
||||
} else {
|
||||
mDevices.AppendElement(pairedDevice);
|
||||
}
|
||||
|
||||
// Notify application of paired device
|
||||
BluetoothDeviceEventInit init;
|
||||
init.mDevice = pairedDevice.
|
||||
DispatchDeviceEvent(NS_LITERAL_STRING("devicepaired"), init);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothAdapter::HandleDeviceUnpaired(const BluetoothValue& aValue)
|
||||
{
|
||||
MOZ_ASSERT(aValue.type() == BluetoothValue::TArrayOfBluetoothNamedValue);
|
||||
|
||||
if (mState != BluetoothAdapterState::Enabled) {
|
||||
BT_WARNING("HandleDeviceUnpaired() is called when adapter isn't enabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Create unpaired device with 'address' and 'paired' attributes
|
||||
nsRefPtr<BluetoothDevice> unpairedDevice =
|
||||
BluetoothDevice::Create(GetOwner(), aValue);
|
||||
|
||||
size_t index = mDevices.IndexOf(unpairedDevice,
|
||||
0, /* aStart */
|
||||
BluetoothDeviceComparator());
|
||||
|
||||
nsString deviceAddress;
|
||||
if (index != mDevices.NoIndex) {
|
||||
mDevices[index]->GetAddress(deviceAddress);
|
||||
mDevices.RemoveElementAt(index);
|
||||
} else {
|
||||
unpairedDevice->GetAddress(deviceAddress);
|
||||
}
|
||||
|
||||
// Notify application of unpaired device
|
||||
BluetoothDeviceEventInit init;
|
||||
init.mAddress = deviceAddress;
|
||||
DispatchDeviceEvent(NS_LITERAL_STRING("deviceunpaired"), init);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothAdapter::DispatchDeviceEvent(const nsAString& aType,
|
||||
const BluetoothDeviceEventInit& aInit)
|
||||
{
|
||||
BT_API2_LOGR("aType (%s)", NS_ConvertUTF16toUTF8(aType).get());
|
||||
|
||||
nsRefPtr<BluetoothDeviceEvent> event =
|
||||
BluetoothDeviceEvent::Constructor(this, aType, aInit);
|
||||
DispatchTrustedEvent(event);
|
||||
}
|
||||
|
||||
already_AddRefed<DOMRequest>
|
||||
BluetoothAdapter::Connect(BluetoothDevice& aDevice,
|
||||
const Optional<short unsigned int>& aServiceUuid,
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/DOMEventTargetHelper.h"
|
||||
#include "mozilla/dom/BluetoothAdapter2Binding.h"
|
||||
#include "mozilla/dom/BluetoothDeviceEvent.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "BluetoothCommon.h"
|
||||
#include "nsCOMPtr.h"
|
||||
@ -150,11 +149,10 @@ public:
|
||||
|
||||
IMPL_EVENT_HANDLER(a2dpstatuschanged);
|
||||
IMPL_EVENT_HANDLER(hfpstatuschanged);
|
||||
IMPL_EVENT_HANDLER(pairedstatuschanged);
|
||||
IMPL_EVENT_HANDLER(requestmediaplaystatus);
|
||||
IMPL_EVENT_HANDLER(scostatuschanged);
|
||||
IMPL_EVENT_HANDLER(attributechanged);
|
||||
IMPL_EVENT_HANDLER(devicepaired);
|
||||
IMPL_EVENT_HANDLER(deviceunpaired);
|
||||
|
||||
nsPIDOMWindow* GetParentObject() const
|
||||
{
|
||||
@ -184,36 +182,6 @@ private:
|
||||
void HandleDeviceFound(const BluetoothValue& aValue);
|
||||
void HandlePairingRequest(const BluetoothValue& aValue);
|
||||
|
||||
/**
|
||||
* Handle DEVICE_PAIRED_ID bluetooth signal.
|
||||
*
|
||||
* @param aValue [in] Properties array of the paired device.
|
||||
* The array should contain two properties:
|
||||
* - nsString 'Address'
|
||||
* - bool 'Paired'
|
||||
*/
|
||||
void HandleDevicePaired(const BluetoothValue& aValue);
|
||||
|
||||
/**
|
||||
* Handle DEVICE_UNPAIRED_ID bluetooth signal.
|
||||
*
|
||||
* @param aValue [in] Properties array of the unpaired device.
|
||||
* The array should contain two properties:
|
||||
* - nsString 'Address'
|
||||
* - bool 'Paired'
|
||||
*/
|
||||
void HandleDeviceUnpaired(const BluetoothValue& aValue);
|
||||
|
||||
/**
|
||||
* Fire BluetoothDeviceEvent to trigger
|
||||
* ondeviceparied/ondeviceunpaired event handler.
|
||||
*
|
||||
* @param aType [in] Event type to fire
|
||||
* @param aInit [in] Event initialization value
|
||||
*/
|
||||
void DispatchDeviceEvent(const nsAString& aType,
|
||||
const BluetoothDeviceEventInit& aInit);
|
||||
|
||||
/**
|
||||
* mDevices holds references of all created device objects.
|
||||
* It is an empty array when the adapter state is disabled.
|
||||
|
@ -158,11 +158,10 @@ extern bool gBluetoothDebugFlag;
|
||||
#define PAIRING_REQ_TYPE_CONSENT "pairingconsentreq"
|
||||
|
||||
/**
|
||||
* When a remote device gets paired / unpaired with local bluetooth adapter,
|
||||
* we'll dispatch an event.
|
||||
* When the pair status of a Bluetooth device is changed, we'll dispatch an
|
||||
* event.
|
||||
*/
|
||||
#define DEVICE_PAIRED_ID "devicepaired"
|
||||
#define DEVICE_UNPAIRED_ID "deviceunpaired"
|
||||
#define PAIRED_STATUS_CHANGED_ID "pairedstatuschanged"
|
||||
|
||||
/**
|
||||
* When receiving a query about current play status from remote device, we'll
|
||||
|
@ -762,14 +762,11 @@ BondStateChangedCallback(bt_status_t aStatus, bt_bdaddr_t* aRemoteBdAddress,
|
||||
|
||||
props.Clear();
|
||||
|
||||
// Append signal properties and notify adapter.
|
||||
BT_APPEND_NAMED_VALUE(props, "Address", remoteBdAddress);
|
||||
BT_APPEND_NAMED_VALUE(props, "Paired", bonded);
|
||||
// Update bonding status to BluetoothAdapter
|
||||
BT_APPEND_NAMED_VALUE(props, "address", remoteBdAddress);
|
||||
BT_APPEND_NAMED_VALUE(props, "status", bonded);
|
||||
|
||||
nsString signalName = bonded ? NS_LITERAL_STRING(DEVICE_PAIRED_ID)
|
||||
: NS_LITERAL_STRING(DEVICE_UNPAIRED_ID);
|
||||
|
||||
BluetoothSignal adapterSignal(signalName,
|
||||
BluetoothSignal adapterSignal(NS_LITERAL_STRING(PAIRED_STATUS_CHANGED_ID),
|
||||
NS_LITERAL_STRING(KEY_ADAPTER),
|
||||
BluetoothValue(props));
|
||||
NS_DispatchToMainThread(new DistributeBluetoothSignalTask(adapterSignal));
|
||||
|
@ -61,6 +61,9 @@ interface BluetoothAdapter : EventTarget {
|
||||
[AvailableIn=CertifiedApps]
|
||||
readonly attribute BluetoothPairingListener pairingReqs;
|
||||
|
||||
// Fired when pairing process is completed
|
||||
attribute EventHandler onpairedstatuschanged;
|
||||
|
||||
// Fired when a2dp connection status changed
|
||||
attribute EventHandler ona2dpstatuschanged;
|
||||
|
||||
@ -76,12 +79,6 @@ interface BluetoothAdapter : EventTarget {
|
||||
// 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.
|
||||
|
Loading…
Reference in New Issue
Block a user