Bug 802590 - patch 1: DOM API change, sr=mrbkap, r=qdot

This commit is contained in:
Eric Chou 2012-10-19 14:16:13 +08:00
parent d8b36d4a41
commit af77ac0c72
2 changed files with 36 additions and 1 deletions

View File

@ -857,6 +857,40 @@ BluetoothAdapter::StopSendingFile(const nsAString& aDeviceAddress,
return NS_OK;
}
nsresult
BluetoothAdapter::ConfirmReceivingFile(const nsAString& aDeviceAddress,
bool aConfirmation,
nsIDOMDOMRequest** aRequest)
{
BluetoothService* bs = BluetoothService::Get();
if (!bs) {
NS_WARNING("BluetoothService not available!");
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIDOMRequestService> rs =
do_GetService("@mozilla.org/dom/dom-request-service;1");
if (!rs) {
NS_WARNING("No DOMRequest Service!");
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIDOMDOMRequest> req;
nsresult rv = rs->CreateRequest(GetOwner(), getter_AddRefs(req));
if (NS_FAILED(rv)) {
NS_WARNING("Can't create DOMRequest!");
return NS_ERROR_FAILURE;
}
nsRefPtr<BluetoothVoidReplyRunnable> results =
new BluetoothVoidReplyRunnable(req);
//bs->ConfirmReceivingFile(aDeviceAddress, aConfirmation, result);
req.forget(aRequest);
return NS_OK;
}
NS_IMPL_EVENT_HANDLER(BluetoothAdapter, propertychanged)
NS_IMPL_EVENT_HANDLER(BluetoothAdapter, devicefound)
NS_IMPL_EVENT_HANDLER(BluetoothAdapter, devicedisappeared)

View File

@ -10,7 +10,7 @@ interface nsIDOMDOMRequest;
interface nsIDOMBlob;
interface nsIDOMBluetoothDevice;
[scriptable, builtinclass, uuid(ad42ba9f-4c30-4ed5-80c2-8b8520a50e0b)]
[scriptable, builtinclass, uuid(6a4a9415-cda3-4a19-b79e-05d9bc2c2700)]
interface nsIDOMBluetoothAdapter : nsIDOMEventTarget
{
readonly attribute DOMString address;
@ -56,6 +56,7 @@ interface nsIDOMBluetoothAdapter : nsIDOMEventTarget
// One device can only send one file at a time
nsIDOMDOMRequest sendFile(in DOMString aDeviceAddress, in nsIDOMBlob aBlob);
nsIDOMDOMRequest stopSendingFile(in DOMString aDeviceAddress);
nsIDOMDOMRequest confirmReceivingFile(in DOMString aDeviceAddress, in bool aConfirmation);
// Fired when discoverying and any device is discovered.
[implicit_jscontext] attribute jsval ondevicefound;