mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 1192101 - Part 4 -Support PresentationRequest / PresentationAvailability / getSession(s). Part 4 - Rename PresentationSessionInfo relevant classes. r=smaug
This commit is contained in:
parent
2484876e88
commit
258942501c
@ -315,7 +315,7 @@ PresentationService::HandleSessionRequest(nsIPresentationSessionRequest* aReques
|
||||
return NS_ERROR_DOM_ABORT_ERR;
|
||||
}
|
||||
|
||||
info = new PresentationResponderInfo(url, sessionId, device);
|
||||
info = new PresentationPresentingInfo(url, sessionId, device);
|
||||
rv = info->Init(ctrlChannel);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
ctrlChannel->Close(rv);
|
||||
@ -338,7 +338,7 @@ PresentationService::HandleSessionRequest(nsIPresentationSessionRequest* aReques
|
||||
return info->ReplyError(NS_ERROR_DOM_OPERATION_ERR);
|
||||
}
|
||||
nsCOMPtr<Promise> realPromise = do_QueryInterface(promise);
|
||||
static_cast<PresentationResponderInfo*>(info.get())->SetPromise(realPromise);
|
||||
static_cast<PresentationPresentingInfo*>(info.get())->SetPromise(realPromise);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -392,8 +392,8 @@ PresentationService::StartSession(const nsAString& aUrl,
|
||||
|
||||
// Create session info and set the callback. The callback is called when the
|
||||
// request is finished.
|
||||
nsRefPtr<PresentationRequesterInfo> info =
|
||||
new PresentationRequesterInfo(aUrl, aSessionId, aCallback);
|
||||
nsRefPtr<PresentationSessionInfo> info =
|
||||
new PresentationControllingInfo(aUrl, aSessionId, aCallback);
|
||||
mSessionInfo.Put(aSessionId, info);
|
||||
|
||||
// Pop up a prompt and ask user to select a device.
|
||||
@ -558,7 +558,7 @@ PresentationService::NotifyReceiverReady(const nsAString& aSessionId,
|
||||
mRespondingWindowIds.Put(aSessionId, aWindowId);
|
||||
}
|
||||
|
||||
return static_cast<PresentationResponderInfo*>(info.get())->NotifyResponderReady();
|
||||
return static_cast<PresentationPresentingInfo*>(info.get())->NotifyResponderReady();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -343,7 +343,7 @@ PresentationSessionInfo::NotifyData(const nsACString& aData)
|
||||
}
|
||||
|
||||
/*
|
||||
* Implementation of PresentationRequesterInfo
|
||||
* Implementation of PresentationControllingInfo
|
||||
*
|
||||
* During presentation session establishment, the sender expects the following
|
||||
* after trying to establish the control channel: (The order between step 3 and
|
||||
@ -364,12 +364,12 @@ PresentationSessionInfo::NotifyData(const nsACString& aData)
|
||||
* So notify the listener of CONNECTED state.
|
||||
*/
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED(PresentationRequesterInfo,
|
||||
NS_IMPL_ISUPPORTS_INHERITED(PresentationControllingInfo,
|
||||
PresentationSessionInfo,
|
||||
nsIServerSocketListener)
|
||||
|
||||
nsresult
|
||||
PresentationRequesterInfo::Init(nsIPresentationControlChannel* aControlChannel)
|
||||
PresentationControllingInfo::Init(nsIPresentationControlChannel* aControlChannel)
|
||||
{
|
||||
PresentationSessionInfo::Init(aControlChannel);
|
||||
|
||||
@ -394,7 +394,7 @@ PresentationRequesterInfo::Init(nsIPresentationControlChannel* aControlChannel)
|
||||
}
|
||||
|
||||
void
|
||||
PresentationRequesterInfo::Shutdown(nsresult aReason)
|
||||
PresentationControllingInfo::Shutdown(nsresult aReason)
|
||||
{
|
||||
PresentationSessionInfo::Shutdown(aReason);
|
||||
|
||||
@ -406,7 +406,7 @@ PresentationRequesterInfo::Shutdown(nsresult aReason)
|
||||
}
|
||||
|
||||
nsresult
|
||||
PresentationRequesterInfo::GetAddress(nsACString& aAddress)
|
||||
PresentationControllingInfo::GetAddress(nsACString& aAddress)
|
||||
{
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
nsCOMPtr<nsINetworkManager> networkManager =
|
||||
@ -452,14 +452,14 @@ PresentationRequesterInfo::GetAddress(nsACString& aAddress)
|
||||
|
||||
// nsIPresentationControlChannelListener
|
||||
NS_IMETHODIMP
|
||||
PresentationRequesterInfo::OnOffer(nsIPresentationChannelDescription* aDescription)
|
||||
PresentationControllingInfo::OnOffer(nsIPresentationChannelDescription* aDescription)
|
||||
{
|
||||
MOZ_ASSERT(false, "Sender side should not receive offer.");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresentationRequesterInfo::OnAnswer(nsIPresentationChannelDescription* aDescription)
|
||||
PresentationControllingInfo::OnAnswer(nsIPresentationChannelDescription* aDescription)
|
||||
{
|
||||
mIsResponderReady = true;
|
||||
|
||||
@ -479,7 +479,7 @@ PresentationRequesterInfo::OnAnswer(nsIPresentationChannelDescription* aDescript
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresentationRequesterInfo::NotifyOpened()
|
||||
PresentationControllingInfo::NotifyOpened()
|
||||
{
|
||||
// Prepare and send the offer.
|
||||
int32_t port;
|
||||
@ -500,7 +500,7 @@ PresentationRequesterInfo::NotifyOpened()
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresentationRequesterInfo::NotifyClosed(nsresult aReason)
|
||||
PresentationControllingInfo::NotifyClosed(nsresult aReason)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
@ -525,7 +525,7 @@ PresentationRequesterInfo::NotifyClosed(nsresult aReason)
|
||||
|
||||
// nsIServerSocketListener
|
||||
NS_IMETHODIMP
|
||||
PresentationRequesterInfo::OnSocketAccepted(nsIServerSocket* aServerSocket,
|
||||
PresentationControllingInfo::OnSocketAccepted(nsIServerSocket* aServerSocket,
|
||||
nsISocketTransport* aTransport)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
@ -550,7 +550,7 @@ PresentationRequesterInfo::OnSocketAccepted(nsIServerSocket* aServerSocket,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresentationRequesterInfo::OnStopListening(nsIServerSocket* aServerSocket,
|
||||
PresentationControllingInfo::OnStopListening(nsIServerSocket* aServerSocket,
|
||||
nsresult aStatus)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
@ -576,7 +576,7 @@ PresentationRequesterInfo::OnStopListening(nsIServerSocket* aServerSocket,
|
||||
}
|
||||
|
||||
/*
|
||||
* Implementation of PresentationResponderInfo
|
||||
* Implementation of PresentationPresentingInfo
|
||||
*
|
||||
* During presentation session establishment, the receiver expects the following
|
||||
* after trying to launch the app by notifying "presentation-launch-receiver":
|
||||
@ -594,12 +594,12 @@ PresentationRequesterInfo::OnStopListening(nsIServerSocket* aServerSocket,
|
||||
* of CONNECTED state.
|
||||
*/
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED(PresentationResponderInfo,
|
||||
NS_IMPL_ISUPPORTS_INHERITED(PresentationPresentingInfo,
|
||||
PresentationSessionInfo,
|
||||
nsITimerCallback)
|
||||
|
||||
nsresult
|
||||
PresentationResponderInfo::Init(nsIPresentationControlChannel* aControlChannel)
|
||||
PresentationPresentingInfo::Init(nsIPresentationControlChannel* aControlChannel)
|
||||
{
|
||||
PresentationSessionInfo::Init(aControlChannel);
|
||||
|
||||
@ -621,7 +621,7 @@ PresentationResponderInfo::Init(nsIPresentationControlChannel* aControlChannel)
|
||||
}
|
||||
|
||||
void
|
||||
PresentationResponderInfo::Shutdown(nsresult aReason)
|
||||
PresentationPresentingInfo::Shutdown(nsresult aReason)
|
||||
{
|
||||
PresentationSessionInfo::Shutdown(aReason);
|
||||
|
||||
@ -635,7 +635,7 @@ PresentationResponderInfo::Shutdown(nsresult aReason)
|
||||
}
|
||||
|
||||
nsresult
|
||||
PresentationResponderInfo::InitTransportAndSendAnswer()
|
||||
PresentationPresentingInfo::InitTransportAndSendAnswer()
|
||||
{
|
||||
// Establish a data transport channel |mTransport| to the sender and use
|
||||
// |this| as the callback.
|
||||
@ -680,7 +680,7 @@ PresentationResponderInfo::InitTransportAndSendAnswer()
|
||||
}
|
||||
|
||||
nsresult
|
||||
PresentationResponderInfo::UntrackFromService()
|
||||
PresentationPresentingInfo::UntrackFromService()
|
||||
{
|
||||
// Remove the OOP responding info (if it has never been used).
|
||||
if (mContentParent) {
|
||||
@ -699,7 +699,7 @@ PresentationResponderInfo::UntrackFromService()
|
||||
}
|
||||
|
||||
bool
|
||||
PresentationResponderInfo::IsAccessible(base::ProcessId aProcessId)
|
||||
PresentationPresentingInfo::IsAccessible(base::ProcessId aProcessId)
|
||||
{
|
||||
// Only the specific content process should access the responder info.
|
||||
return (mContentParent) ?
|
||||
@ -708,7 +708,7 @@ PresentationResponderInfo::IsAccessible(base::ProcessId aProcessId)
|
||||
}
|
||||
|
||||
nsresult
|
||||
PresentationResponderInfo::NotifyResponderReady()
|
||||
PresentationPresentingInfo::NotifyResponderReady()
|
||||
{
|
||||
if (mTimer) {
|
||||
mTimer->Cancel();
|
||||
@ -731,7 +731,7 @@ PresentationResponderInfo::NotifyResponderReady()
|
||||
|
||||
// nsIPresentationControlChannelListener
|
||||
NS_IMETHODIMP
|
||||
PresentationResponderInfo::OnOffer(nsIPresentationChannelDescription* aDescription)
|
||||
PresentationPresentingInfo::OnOffer(nsIPresentationChannelDescription* aDescription)
|
||||
{
|
||||
if (NS_WARN_IF(!aDescription)) {
|
||||
return ReplyError(NS_ERROR_DOM_OPERATION_ERR);
|
||||
@ -752,21 +752,21 @@ PresentationResponderInfo::OnOffer(nsIPresentationChannelDescription* aDescripti
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresentationResponderInfo::OnAnswer(nsIPresentationChannelDescription* aDescription)
|
||||
PresentationPresentingInfo::OnAnswer(nsIPresentationChannelDescription* aDescription)
|
||||
{
|
||||
MOZ_ASSERT(false, "Receiver side should not receive answer.");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresentationResponderInfo::NotifyOpened()
|
||||
PresentationPresentingInfo::NotifyOpened()
|
||||
{
|
||||
// Do nothing.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PresentationResponderInfo::NotifyClosed(nsresult aReason)
|
||||
PresentationPresentingInfo::NotifyClosed(nsresult aReason)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
@ -791,7 +791,7 @@ PresentationResponderInfo::NotifyClosed(nsresult aReason)
|
||||
|
||||
// nsITimerCallback
|
||||
NS_IMETHODIMP
|
||||
PresentationResponderInfo::Notify(nsITimer* aTimer)
|
||||
PresentationPresentingInfo::Notify(nsITimer* aTimer)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
NS_WARNING("The receiver page fails to become ready before timeout.");
|
||||
@ -802,7 +802,7 @@ PresentationResponderInfo::Notify(nsITimer* aTimer)
|
||||
|
||||
// PromiseNativeHandler
|
||||
void
|
||||
PresentationResponderInfo::ResolvedCallback(JSContext* aCx,
|
||||
PresentationPresentingInfo::ResolvedCallback(JSContext* aCx,
|
||||
JS::Handle<JS::Value> aValue)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
@ -866,7 +866,7 @@ PresentationResponderInfo::ResolvedCallback(JSContext* aCx,
|
||||
}
|
||||
|
||||
void
|
||||
PresentationResponderInfo::RejectedCallback(JSContext* aCx,
|
||||
PresentationPresentingInfo::RejectedCallback(JSContext* aCx,
|
||||
JS::Handle<JS::Value> aValue)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
@ -123,18 +123,18 @@ protected:
|
||||
nsCOMPtr<nsIPresentationControlChannel> mControlChannel;
|
||||
};
|
||||
|
||||
// Session info with sender side behaviors.
|
||||
class PresentationRequesterInfo final : public PresentationSessionInfo
|
||||
, public nsIServerSocketListener
|
||||
// Session info with controlling browsing context (sender side) behaviors.
|
||||
class PresentationControllingInfo final : public PresentationSessionInfo
|
||||
, public nsIServerSocketListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIPRESENTATIONCONTROLCHANNELLISTENER
|
||||
NS_DECL_NSISERVERSOCKETLISTENER
|
||||
|
||||
PresentationRequesterInfo(const nsAString& aUrl,
|
||||
const nsAString& aSessionId,
|
||||
nsIPresentationServiceCallback* aCallback)
|
||||
PresentationControllingInfo(const nsAString& aUrl,
|
||||
const nsAString& aSessionId,
|
||||
nsIPresentationServiceCallback* aCallback)
|
||||
: PresentationSessionInfo(aUrl, aSessionId, aCallback)
|
||||
{
|
||||
MOZ_ASSERT(mCallback);
|
||||
@ -143,7 +143,7 @@ public:
|
||||
nsresult Init(nsIPresentationControlChannel* aControlChannel) override;
|
||||
|
||||
private:
|
||||
~PresentationRequesterInfo()
|
||||
~PresentationControllingInfo()
|
||||
{
|
||||
Shutdown(NS_OK);
|
||||
}
|
||||
@ -155,19 +155,19 @@ private:
|
||||
nsCOMPtr<nsIServerSocket> mServerSocket;
|
||||
};
|
||||
|
||||
// Session info with receiver side behaviors.
|
||||
class PresentationResponderInfo final : public PresentationSessionInfo
|
||||
, public PromiseNativeHandler
|
||||
, public nsITimerCallback
|
||||
// Session info with presenting browsing context (receiver side) behaviors.
|
||||
class PresentationPresentingInfo final : public PresentationSessionInfo
|
||||
, public PromiseNativeHandler
|
||||
, public nsITimerCallback
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIPRESENTATIONCONTROLCHANNELLISTENER
|
||||
NS_DECL_NSITIMERCALLBACK
|
||||
|
||||
PresentationResponderInfo(const nsAString& aUrl,
|
||||
const nsAString& aSessionId,
|
||||
nsIPresentationDevice* aDevice)
|
||||
PresentationPresentingInfo(const nsAString& aUrl,
|
||||
const nsAString& aSessionId,
|
||||
nsIPresentationDevice* aDevice)
|
||||
: PresentationSessionInfo(aUrl, aSessionId, nullptr)
|
||||
{
|
||||
MOZ_ASSERT(aDevice);
|
||||
@ -192,7 +192,7 @@ public:
|
||||
bool IsAccessible(base::ProcessId aProcessId) override;
|
||||
|
||||
private:
|
||||
~PresentationResponderInfo()
|
||||
~PresentationPresentingInfo()
|
||||
{
|
||||
Shutdown(NS_OK);
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ namespace dom {
|
||||
* initialized with an |InitWithSocketTransport| call if at the presenting sender
|
||||
* side; whereas it's initialized with an |InitWithChannelDescription| if at the
|
||||
* presenting receiver side. The lifetime is managed in either
|
||||
* |PresentationRequesterInfo| (sender side) or |PresentationResponderInfo|
|
||||
* |PresentationControllingInfo| (sender side) or |PresentationPresentingInfo|
|
||||
* (receiver side) in PresentationSessionInfo.cpp.
|
||||
*
|
||||
* TODO bug 1148307 Implement PresentationSessionTransport with DataChannel.
|
||||
|
Loading…
Reference in New Issue
Block a user