Bug 795410 - patch 2: Complete call flow, r=qdot

From 9fb76c07818c989ec8edc26b54ba84e1e6ec41ed Mon Sep 17 00:00:00 2001
This commit is contained in:
Eric Chou 2012-09-28 19:42:04 +08:00
Родитель c95d365829
Коммит 3e4b2a49a1
5 изменённых файлов: 31 добавлений и 1 удалений

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

@ -221,6 +221,8 @@ BluetoothParent::RecvPBluetoothRequestConstructor(
return actor->DoRequest(aRequest.get_DisconnectHeadsetRequest());
case Request::TDisconnectObjectPushRequest:
return actor->DoRequest(aRequest.get_DisconnectObjectPushRequest());
case Request::TSendFileRequest:
return actor->DoRequest(aRequest.get_SendFileRequest());
default:
MOZ_NOT_REACHED("Unknown type!");
return false;
@ -538,3 +540,15 @@ BluetoothRequestParent::DoRequest(const DisconnectObjectPushRequest& aRequest)
return true;
}
bool
BluetoothRequestParent::DoRequest(const SendFileRequest& aRequest)
{
MOZ_ASSERT(mService);
MOZ_ASSERT(mRequestType == Request::TSendFileRequest);
return mService->SendFile(aRequest.devicePath(),
(BlobParent*)aRequest.blobParent(),
(BlobChild*)aRequest.blobChild(),
mReplyRunnable.get());
}

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

@ -177,6 +177,9 @@ protected:
bool
DoRequest(const DisconnectObjectPushRequest& aRequest);
bool
DoRequest(const SendFileRequest& aRequest);
};
END_BLUETOOTH_NAMESPACE

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

@ -333,7 +333,8 @@ BluetoothServiceChildProcess::SendFile(
BlobChild* aBlobChild,
BluetoothReplyRunnable* aRunnable)
{
// Will implement in another patch
SendRequest(aRunnable,
SendFileRequest(nsString(aDeviceAddress), nullptr, aBlobChild));
return true;
}

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

@ -4,6 +4,7 @@
* 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/. */
include protocol PBlob;
include protocol PBluetoothRequest;
include protocol PContent;
@ -115,6 +116,12 @@ struct DisconnectHeadsetRequest
struct DisconnectObjectPushRequest
{};
struct SendFileRequest
{
nsString devicePath;
PBlob blob;
};
union Request
{
DefaultAdapterPathRequest;
@ -135,6 +142,7 @@ union Request
ConnectObjectPushRequest;
DisconnectHeadsetRequest;
DisconnectObjectPushRequest;
SendFileRequest;
};
protocol PBluetooth

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

@ -2415,6 +2415,10 @@ BluetoothDBusService::SendFile(const nsAString& aDeviceAddress,
BlobChild* aBlobChild,
BluetoothReplyRunnable* aRunnable)
{
// 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->SendFile(aBlobParent, aRunnable);