mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 802590 - patch 2: IPC implementation, r=qdot
This commit is contained in:
parent
bf2e07fff1
commit
99997a7a1d
@ -883,9 +883,10 @@ BluetoothAdapter::ConfirmReceivingFile(const nsAString& aDeviceAddress,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsRefPtr<BluetoothVoidReplyRunnable> results =
|
||||
nsRefPtr<BluetoothVoidReplyRunnable> result =
|
||||
new BluetoothVoidReplyRunnable(req);
|
||||
//bs->ConfirmReceivingFile(aDeviceAddress, aConfirmation, result);
|
||||
bs->ConfirmReceivingFile(aDeviceAddress, aConfirmation, result);
|
||||
|
||||
req.forget(aRequest);
|
||||
|
||||
return NS_OK;
|
||||
|
@ -215,6 +215,13 @@ BluetoothOppManager::StopSendingFile(BluetoothReplyRunnable* aRunnable)
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothOppManager::ConfirmReceivingFile(bool aConfirm,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
// FIXME(Eric): Will implement in the third patch
|
||||
}
|
||||
|
||||
// Virtual function of class SocketConsumer
|
||||
void
|
||||
BluetoothOppManager::ReceiveSocketData(UnixSocketRawData* aMessage)
|
||||
|
@ -51,6 +51,7 @@ public:
|
||||
bool SendFile(BlobParent* aBlob,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
bool StopSendingFile(BluetoothReplyRunnable* aRunnable);
|
||||
void ConfirmReceivingFile(bool aConfirm, BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
void SendConnectRequest();
|
||||
void SendPutHeaderRequest(const nsAString& aFileName, int aFileSize);
|
||||
|
@ -290,6 +290,10 @@ public:
|
||||
bool aEncrypt,
|
||||
mozilla::ipc::UnixSocketConsumer* aConsumer) = 0;
|
||||
|
||||
virtual void
|
||||
ConfirmReceivingFile(const nsAString& aDeviceAddress, bool aConfirm,
|
||||
BluetoothReplyRunnable* aRunnable) = 0;
|
||||
|
||||
bool
|
||||
IsEnabled() const
|
||||
{
|
||||
|
@ -221,6 +221,10 @@ BluetoothParent::RecvPBluetoothRequestConstructor(
|
||||
return actor->DoRequest(aRequest.get_SendFileRequest());
|
||||
case Request::TStopSendingFileRequest:
|
||||
return actor->DoRequest(aRequest.get_StopSendingFileRequest());
|
||||
case Request::TConfirmReceivingFileRequest:
|
||||
return actor->DoRequest(aRequest.get_ConfirmReceivingFileRequest());
|
||||
case Request::TDenyReceivingFileRequest:
|
||||
return actor->DoRequest(aRequest.get_DenyReceivingFileRequest());
|
||||
default:
|
||||
MOZ_NOT_REACHED("Unknown type!");
|
||||
return false;
|
||||
@ -540,3 +544,27 @@ BluetoothRequestParent::DoRequest(const StopSendingFileRequest& aRequest)
|
||||
return mService->StopSendingFile(aRequest.devicePath(),
|
||||
mReplyRunnable.get());
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothRequestParent::DoRequest(const ConfirmReceivingFileRequest& aRequest)
|
||||
{
|
||||
MOZ_ASSERT(mService);
|
||||
MOZ_ASSERT(mRequestType == Request::TConfirmReceivingFileRequest);
|
||||
|
||||
mService->ConfirmReceivingFile(aRequest.devicePath(),
|
||||
true,
|
||||
mReplyRunnable.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
BluetoothRequestParent::DoRequest(const DenyReceivingFileRequest& aRequest)
|
||||
{
|
||||
MOZ_ASSERT(mService);
|
||||
MOZ_ASSERT(mRequestType == Request::TDenyReceivingFileRequest);
|
||||
|
||||
mService->ConfirmReceivingFile(aRequest.devicePath(),
|
||||
false,
|
||||
mReplyRunnable.get());
|
||||
return true;
|
||||
}
|
||||
|
@ -177,6 +177,12 @@ protected:
|
||||
|
||||
bool
|
||||
DoRequest(const StopSendingFileRequest& aRequest);
|
||||
|
||||
bool
|
||||
DoRequest(const ConfirmReceivingFileRequest& aRequest);
|
||||
|
||||
bool
|
||||
DoRequest(const DenyReceivingFileRequest& aRequest);
|
||||
};
|
||||
|
||||
END_BLUETOOTH_NAMESPACE
|
||||
|
@ -345,6 +345,22 @@ BluetoothServiceChildProcess::StopSendingFile(
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceChildProcess::ConfirmReceivingFile(
|
||||
const nsAString& aDeviceAddress,
|
||||
bool aConfirm,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
if(aConfirm) {
|
||||
SendRequest(aRunnable,
|
||||
ConfirmReceivingFileRequest(nsString(aDeviceAddress)));
|
||||
return;
|
||||
}
|
||||
|
||||
SendRequest(aRunnable,
|
||||
DenyReceivingFileRequest(nsString(aDeviceAddress)));
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothServiceChildProcess::HandleStartup()
|
||||
{
|
||||
|
@ -149,6 +149,10 @@ public:
|
||||
StopSendingFile(const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
|
||||
|
||||
virtual void
|
||||
ConfirmReceivingFile(const nsAString& aDeviceAddress,
|
||||
bool aConfirm,
|
||||
BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
|
||||
protected:
|
||||
BluetoothServiceChildProcess();
|
||||
virtual ~BluetoothServiceChildProcess();
|
||||
|
@ -121,6 +121,16 @@ struct StopSendingFileRequest
|
||||
nsString devicePath;
|
||||
};
|
||||
|
||||
struct ConfirmReceivingFileRequest
|
||||
{
|
||||
nsString devicePath;
|
||||
};
|
||||
|
||||
struct DenyReceivingFileRequest
|
||||
{
|
||||
nsString devicePath;
|
||||
};
|
||||
|
||||
union Request
|
||||
{
|
||||
DefaultAdapterPathRequest;
|
||||
@ -141,6 +151,8 @@ union Request
|
||||
DisconnectRequest;
|
||||
SendFileRequest;
|
||||
StopSendingFileRequest;
|
||||
ConfirmReceivingFileRequest;
|
||||
DenyReceivingFileRequest;
|
||||
};
|
||||
|
||||
protocol PBluetooth
|
||||
|
@ -2527,6 +2527,8 @@ BluetoothDBusService::SendFile(const nsAString& aDeviceAddress,
|
||||
BlobChild* aBlobChild,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Must be called from main thread!");
|
||||
|
||||
// Currently we only support one device sending one file at a time,
|
||||
// so we don't need aDeviceAddress here because the target device
|
||||
// has been determined when calling 'Connect()'. Nevertheless, keep
|
||||
@ -2541,6 +2543,8 @@ bool
|
||||
BluetoothDBusService::StopSendingFile(const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Must be called from main thread!");
|
||||
|
||||
// Currently we only support one device sending one file at a time,
|
||||
// so we don't need aDeviceAddress here because the target device
|
||||
// has been determined when calling 'Connect()'. Nevertheless, keep
|
||||
@ -2551,6 +2555,21 @@ BluetoothDBusService::StopSendingFile(const nsAString& aDeviceAddress,
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDBusService::ConfirmReceivingFile(const nsAString& aDeviceAddress,
|
||||
bool aConfirm,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Must be called from main thread!");
|
||||
|
||||
// Currently we only support one device sending one file at a time,
|
||||
// so we don't need aDeviceAddress here because the target device
|
||||
// has been determined when calling 'Connect()'. Nevertheless, keep
|
||||
// it for future use.
|
||||
BluetoothOppManager* opp = BluetoothOppManager::Get();
|
||||
opp->ConfirmReceivingFile(aConfirm, aRunnable);
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothDBusService::ListenSocketViaService(int aChannel,
|
||||
BluetoothSocketType aType,
|
||||
|
@ -152,6 +152,10 @@ public:
|
||||
StopSendingFile(const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
virtual void
|
||||
ConfirmReceivingFile(const nsAString& aDeviceAddress, bool aConfirm,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
private:
|
||||
nsresult SendGetPropertyMessage(const nsAString& aPath,
|
||||
const char* aInterface,
|
||||
|
Loading…
Reference in New Issue
Block a user