mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 925638 - Patch 2/3: implement new webidl functions, r=echou
This commit is contained in:
parent
fb3b6b0e37
commit
d551eb0740
@ -878,6 +878,75 @@ BluetoothAdapter::IsScoConnected(ErrorResult& aRv)
|
|||||||
return request.forget();
|
return request.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
already_AddRefed<DOMRequest>
|
||||||
|
BluetoothAdapter::AnswerWaitingCall(ErrorResult& aRv)
|
||||||
|
{
|
||||||
|
nsCOMPtr<nsPIDOMWindow> win = GetOwner();
|
||||||
|
if (!win) {
|
||||||
|
aRv.Throw(NS_ERROR_FAILURE);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsRefPtr<DOMRequest> request = new DOMRequest(win);
|
||||||
|
nsRefPtr<BluetoothVoidReplyRunnable> results =
|
||||||
|
new BluetoothVoidReplyRunnable(request);
|
||||||
|
|
||||||
|
BluetoothService* bs = BluetoothService::Get();
|
||||||
|
if (!bs) {
|
||||||
|
aRv.Throw(NS_ERROR_FAILURE);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
bs->AnswerWaitingCall(results);
|
||||||
|
|
||||||
|
return request.forget();
|
||||||
|
}
|
||||||
|
|
||||||
|
already_AddRefed<DOMRequest>
|
||||||
|
BluetoothAdapter::IgnoreWaitingCall(ErrorResult& aRv)
|
||||||
|
{
|
||||||
|
nsCOMPtr<nsPIDOMWindow> win = GetOwner();
|
||||||
|
if (!win) {
|
||||||
|
aRv.Throw(NS_ERROR_FAILURE);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsRefPtr<DOMRequest> request = new DOMRequest(win);
|
||||||
|
nsRefPtr<BluetoothVoidReplyRunnable> results =
|
||||||
|
new BluetoothVoidReplyRunnable(request);
|
||||||
|
|
||||||
|
BluetoothService* bs = BluetoothService::Get();
|
||||||
|
if (!bs) {
|
||||||
|
aRv.Throw(NS_ERROR_FAILURE);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
bs->IgnoreWaitingCall(results);
|
||||||
|
|
||||||
|
return request.forget();
|
||||||
|
}
|
||||||
|
|
||||||
|
already_AddRefed<DOMRequest>
|
||||||
|
BluetoothAdapter::ToggleCalls(ErrorResult& aRv)
|
||||||
|
{
|
||||||
|
nsCOMPtr<nsPIDOMWindow> win = GetOwner();
|
||||||
|
if (!win) {
|
||||||
|
aRv.Throw(NS_ERROR_FAILURE);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsRefPtr<DOMRequest> request = new DOMRequest(win);
|
||||||
|
nsRefPtr<BluetoothVoidReplyRunnable> results =
|
||||||
|
new BluetoothVoidReplyRunnable(request);
|
||||||
|
|
||||||
|
BluetoothService* bs = BluetoothService::Get();
|
||||||
|
if (!bs) {
|
||||||
|
aRv.Throw(NS_ERROR_FAILURE);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
bs->ToggleCalls(results);
|
||||||
|
|
||||||
|
return request.forget();
|
||||||
|
}
|
||||||
|
|
||||||
already_AddRefed<DOMRequest>
|
already_AddRefed<DOMRequest>
|
||||||
BluetoothAdapter::SendMediaMetaData(const MediaMetaData& aMediaMetaData, ErrorResult& aRv)
|
BluetoothAdapter::SendMediaMetaData(const MediaMetaData& aMediaMetaData, ErrorResult& aRv)
|
||||||
{
|
{
|
||||||
|
@ -137,6 +137,10 @@ public:
|
|||||||
already_AddRefed<DOMRequest> DisconnectSco(ErrorResult& aRv);
|
already_AddRefed<DOMRequest> DisconnectSco(ErrorResult& aRv);
|
||||||
already_AddRefed<DOMRequest> IsScoConnected(ErrorResult& aRv);
|
already_AddRefed<DOMRequest> IsScoConnected(ErrorResult& aRv);
|
||||||
|
|
||||||
|
already_AddRefed<DOMRequest> AnswerWaitingCall(ErrorResult& aRv);
|
||||||
|
already_AddRefed<DOMRequest> IgnoreWaitingCall(ErrorResult& aRv);
|
||||||
|
already_AddRefed<DOMRequest> ToggleCalls(ErrorResult& aRv);
|
||||||
|
|
||||||
already_AddRefed<DOMRequest>
|
already_AddRefed<DOMRequest>
|
||||||
SendMediaMetaData(const MediaMetaData& aMediaMetaData, ErrorResult& aRv);
|
SendMediaMetaData(const MediaMetaData& aMediaMetaData, ErrorResult& aRv);
|
||||||
already_AddRefed<DOMRequest>
|
already_AddRefed<DOMRequest>
|
||||||
|
@ -1493,6 +1493,42 @@ BluetoothHfpManager::UpdateSecondNumber(const nsAString& aNumber)
|
|||||||
UpdateCIND(CINDType::CALLSETUP, CallSetupState::INCOMING, true);
|
UpdateCIND(CINDType::CALLSETUP, CallSetupState::INCOMING, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
BluetoothHfpManager::AnswerWaitingCall()
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
MOZ_ASSERT(mPhoneType == PhoneType::CDMA);
|
||||||
|
|
||||||
|
// Pick up second call. First call is held now.
|
||||||
|
mCdmaSecondCall.mState = nsITelephonyProvider::CALL_STATE_CONNECTED;
|
||||||
|
UpdateCIND(CINDType::CALLSETUP, CallSetupState::NO_CALLSETUP, true);
|
||||||
|
|
||||||
|
sCINDItems[CINDType::CALLHELD].value = CallHeldState::ONHOLD_ACTIVE;
|
||||||
|
SendCommand("+CIEV: ", CINDType::CALLHELD);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
BluetoothHfpManager::IgnoreWaitingCall()
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
MOZ_ASSERT(mPhoneType == PhoneType::CDMA);
|
||||||
|
|
||||||
|
mCdmaSecondCall.Reset();
|
||||||
|
UpdateCIND(CINDType::CALLSETUP, CallSetupState::NO_CALLSETUP, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
BluetoothHfpManager::ToggleCalls()
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
MOZ_ASSERT(mPhoneType == PhoneType::CDMA);
|
||||||
|
|
||||||
|
// Toggle acitve and held calls
|
||||||
|
mCdmaSecondCall.mState = (mCdmaSecondCall.IsActive()) ?
|
||||||
|
nsITelephonyProvider::CALL_STATE_HELD :
|
||||||
|
nsITelephonyProvider::CALL_STATE_CONNECTED;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BluetoothHfpManager::OnSocketConnectSuccess(BluetoothSocket* aSocket)
|
BluetoothHfpManager::OnSocketConnectSuccess(BluetoothSocket* aSocket)
|
||||||
{
|
{
|
||||||
|
@ -123,6 +123,9 @@ public:
|
|||||||
|
|
||||||
// CDMA-specific functions
|
// CDMA-specific functions
|
||||||
void UpdateSecondNumber(const nsAString& aNumber);
|
void UpdateSecondNumber(const nsAString& aNumber);
|
||||||
|
void AnswerWaitingCall();
|
||||||
|
void IgnoreWaitingCall();
|
||||||
|
void ToggleCalls();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class CloseScoTask;
|
class CloseScoTask;
|
||||||
|
@ -266,6 +266,15 @@ public:
|
|||||||
virtual void
|
virtual void
|
||||||
IsScoConnected(BluetoothReplyRunnable* aRunnable) = 0;
|
IsScoConnected(BluetoothReplyRunnable* aRunnable) = 0;
|
||||||
|
|
||||||
|
virtual void
|
||||||
|
AnswerWaitingCall(BluetoothReplyRunnable* aRunnable) = 0;
|
||||||
|
|
||||||
|
virtual void
|
||||||
|
IgnoreWaitingCall(BluetoothReplyRunnable* aRunnable) = 0;
|
||||||
|
|
||||||
|
virtual void
|
||||||
|
ToggleCalls(BluetoothReplyRunnable* aRunnable) = 0;
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
SendMetaData(const nsAString& aTitle,
|
SendMetaData(const nsAString& aTitle,
|
||||||
const nsAString& aArtist,
|
const nsAString& aArtist,
|
||||||
|
@ -226,6 +226,12 @@ BluetoothParent::RecvPBluetoothRequestConstructor(
|
|||||||
return actor->DoRequest(aRequest.get_DisconnectScoRequest());
|
return actor->DoRequest(aRequest.get_DisconnectScoRequest());
|
||||||
case Request::TIsScoConnectedRequest:
|
case Request::TIsScoConnectedRequest:
|
||||||
return actor->DoRequest(aRequest.get_IsScoConnectedRequest());
|
return actor->DoRequest(aRequest.get_IsScoConnectedRequest());
|
||||||
|
case Request::TAnswerWaitingCallRequest:
|
||||||
|
return actor->DoRequest(aRequest.get_AnswerWaitingCallRequest());
|
||||||
|
case Request::TIgnoreWaitingCallRequest:
|
||||||
|
return actor->DoRequest(aRequest.get_IgnoreWaitingCallRequest());
|
||||||
|
case Request::TToggleCallsRequest:
|
||||||
|
return actor->DoRequest(aRequest.get_ToggleCallsRequest());
|
||||||
case Request::TSendMetaDataRequest:
|
case Request::TSendMetaDataRequest:
|
||||||
return actor->DoRequest(aRequest.get_SendMetaDataRequest());
|
return actor->DoRequest(aRequest.get_SendMetaDataRequest());
|
||||||
case Request::TSendPlayStatusRequest:
|
case Request::TSendPlayStatusRequest:
|
||||||
@ -575,6 +581,39 @@ BluetoothRequestParent::DoRequest(const IsScoConnectedRequest& aRequest)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
BluetoothRequestParent::DoRequest(const AnswerWaitingCallRequest& aRequest)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(mService);
|
||||||
|
MOZ_ASSERT(mRequestType == Request::TAnswerWaitingCallRequest);
|
||||||
|
|
||||||
|
mService->AnswerWaitingCall(mReplyRunnable.get());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
BluetoothRequestParent::DoRequest(const IgnoreWaitingCallRequest& aRequest)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(mService);
|
||||||
|
MOZ_ASSERT(mRequestType == Request::TAnswerWaitingCallRequest);
|
||||||
|
|
||||||
|
mService->IgnoreWaitingCall(mReplyRunnable.get());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
BluetoothRequestParent::DoRequest(const ToggleCallsRequest& aRequest)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(mService);
|
||||||
|
MOZ_ASSERT(mRequestType == Request::TAnswerWaitingCallRequest);
|
||||||
|
|
||||||
|
mService->ToggleCalls(mReplyRunnable.get());
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
BluetoothRequestParent::DoRequest(const SendMetaDataRequest& aRequest)
|
BluetoothRequestParent::DoRequest(const SendMetaDataRequest& aRequest)
|
||||||
{
|
{
|
||||||
|
@ -190,6 +190,15 @@ protected:
|
|||||||
bool
|
bool
|
||||||
DoRequest(const IsScoConnectedRequest& aRequest);
|
DoRequest(const IsScoConnectedRequest& aRequest);
|
||||||
|
|
||||||
|
bool
|
||||||
|
DoRequest(const AnswerWaitingCallRequest& aRequest);
|
||||||
|
|
||||||
|
bool
|
||||||
|
DoRequest(const IgnoreWaitingCallRequest& aRequest);
|
||||||
|
|
||||||
|
bool
|
||||||
|
DoRequest(const ToggleCallsRequest& aRequest);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
DoRequest(const SendMetaDataRequest& aRequest);
|
DoRequest(const SendMetaDataRequest& aRequest);
|
||||||
|
|
||||||
|
@ -328,6 +328,27 @@ BluetoothServiceChildProcess::IsScoConnected(BluetoothReplyRunnable* aRunnable)
|
|||||||
SendRequest(aRunnable, IsScoConnectedRequest());
|
SendRequest(aRunnable, IsScoConnectedRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
BluetoothServiceChildProcess::AnswerWaitingCall(
|
||||||
|
BluetoothReplyRunnable* aRunnable)
|
||||||
|
{
|
||||||
|
SendRequest(aRunnable, AnswerWaitingCallRequest());
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
BluetoothServiceChildProcess::IgnoreWaitingCall(
|
||||||
|
BluetoothReplyRunnable* aRunnable)
|
||||||
|
{
|
||||||
|
SendRequest(aRunnable, IgnoreWaitingCallRequest());
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
BluetoothServiceChildProcess::ToggleCalls(
|
||||||
|
BluetoothReplyRunnable* aRunnable)
|
||||||
|
{
|
||||||
|
SendRequest(aRunnable, ToggleCallsRequest());
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BluetoothServiceChildProcess::SendMetaData(const nsAString& aTitle,
|
BluetoothServiceChildProcess::SendMetaData(const nsAString& aTitle,
|
||||||
const nsAString& aArtist,
|
const nsAString& aArtist,
|
||||||
|
@ -149,6 +149,15 @@ public:
|
|||||||
virtual void
|
virtual void
|
||||||
IsScoConnected(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
|
IsScoConnected(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
|
||||||
|
|
||||||
|
virtual void
|
||||||
|
AnswerWaitingCall(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
|
||||||
|
|
||||||
|
virtual void
|
||||||
|
IgnoreWaitingCall(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
|
||||||
|
|
||||||
|
virtual void
|
||||||
|
ToggleCalls(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
SendMetaData(const nsAString& aTitle,
|
SendMetaData(const nsAString& aTitle,
|
||||||
const nsAString& aArtist,
|
const nsAString& aArtist,
|
||||||
|
@ -134,6 +134,18 @@ struct IsScoConnectedRequest
|
|||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct AnswerWaitingCallRequest
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
struct IgnoreWaitingCallRequest
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ToggleCallsRequest
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
struct SendMetaDataRequest
|
struct SendMetaDataRequest
|
||||||
{
|
{
|
||||||
nsString title;
|
nsString title;
|
||||||
@ -175,6 +187,9 @@ union Request
|
|||||||
ConnectScoRequest;
|
ConnectScoRequest;
|
||||||
DisconnectScoRequest;
|
DisconnectScoRequest;
|
||||||
IsScoConnectedRequest;
|
IsScoConnectedRequest;
|
||||||
|
AnswerWaitingCallRequest;
|
||||||
|
IgnoreWaitingCallRequest;
|
||||||
|
ToggleCallsRequest;
|
||||||
SendMetaDataRequest;
|
SendMetaDataRequest;
|
||||||
SendPlayStatusRequest;
|
SendPlayStatusRequest;
|
||||||
};
|
};
|
||||||
|
@ -2631,6 +2631,39 @@ BluetoothDBusService::IsConnected(const uint16_t aServiceUuid)
|
|||||||
return profile->IsConnected();
|
return profile->IsConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
BluetoothDBusService::AnswerWaitingCall(BluetoothReplyRunnable* aRunnable)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
|
BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
|
||||||
|
hfp->AnswerWaitingCall();
|
||||||
|
|
||||||
|
DispatchBluetoothReply(aRunnable, BluetoothValue(true), EmptyString());
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
BluetoothDBusService::IgnoreWaitingCall(BluetoothReplyRunnable* aRunnable)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
|
BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
|
||||||
|
hfp->IgnoreWaitingCall();
|
||||||
|
|
||||||
|
DispatchBluetoothReply(aRunnable, BluetoothValue(true), EmptyString());
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
BluetoothDBusService::ToggleCalls(BluetoothReplyRunnable* aRunnable)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
|
BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
|
||||||
|
hfp->ToggleCalls();
|
||||||
|
|
||||||
|
DispatchBluetoothReply(aRunnable, BluetoothValue(true), EmptyString());
|
||||||
|
}
|
||||||
|
|
||||||
class OnUpdateSdpRecordsRunnable : public nsRunnable
|
class OnUpdateSdpRecordsRunnable : public nsRunnable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -132,6 +132,15 @@ public:
|
|||||||
virtual void
|
virtual void
|
||||||
IsScoConnected(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
|
IsScoConnected(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
|
||||||
|
|
||||||
|
virtual void
|
||||||
|
AnswerWaitingCall(BluetoothReplyRunnable* aRunnable);
|
||||||
|
|
||||||
|
virtual void
|
||||||
|
IgnoreWaitingCall(BluetoothReplyRunnable* aRunnable);
|
||||||
|
|
||||||
|
virtual void
|
||||||
|
ToggleCalls(BluetoothReplyRunnable* aRunnable);
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
SendMetaData(const nsAString& aTitle,
|
SendMetaData(const nsAString& aTitle,
|
||||||
const nsAString& aArtist,
|
const nsAString& aArtist,
|
||||||
|
Loading…
Reference in New Issue
Block a user