Bug 1208417 - Part 1 - Add disconnect to nsIPresentationDevice & add a new nsIPresentationLocalDevice interface for 1-UA device, r=smaug
authorKuoE0 <kuoe0.tw@gmail.com>
Thu, 28 Apr 2016 15:05:16 +0800
changeset 357326 eaa9bd3a5d1b59b142dfaadab6ee3b43ffc11c7c
parent 357325 28f944410c7fdf27f7ddf16fc01be4eb0a6eade8
child 357327 4f95de9b438f19200f3399814348ea6dda563bc1
push id16755
push useryura.zenevich@gmail.com
push dateThu, 28 Apr 2016 15:12:20 +0000
reviewerssmaug
bugs1208417
milestone49.0a1
Bug 1208417 - Part 1 - Add disconnect to nsIPresentationDevice & add a new nsIPresentationLocalDevice interface for 1-UA device, r=smaug
dom/presentation/PresentationSessionInfo.cpp
dom/presentation/interfaces/moz.build
dom/presentation/interfaces/nsIPresentationDevice.idl
dom/presentation/interfaces/nsIPresentationLocalDevice.idl
dom/presentation/provider/MulticastDNSDeviceProvider.cpp
--- a/dom/presentation/PresentationSessionInfo.cpp
+++ b/dom/presentation/PresentationSessionInfo.cpp
@@ -784,16 +784,20 @@ void
 PresentationPresentingInfo::Shutdown(nsresult aReason)
 {
   PresentationSessionInfo::Shutdown(aReason);
 
   if (mTimer) {
     mTimer->Cancel();
   }
 
+  if (mDevice) {
+    mDevice->Disconnect();
+  }
+  mDevice = nullptr;
   mLoadingCallback = nullptr;
   mRequesterDescription = nullptr;
   mPromise = nullptr;
 }
 
 // nsIPresentationSessionTransportBuilderListener
 NS_IMETHODIMP
 PresentationPresentingInfo::OnSessionTransport(nsIPresentationSessionTransport* transport)
--- a/dom/presentation/interfaces/moz.build
+++ b/dom/presentation/interfaces/moz.build
@@ -6,16 +6,17 @@
 
 XPIDL_SOURCES += [
     'nsIPresentationControlChannel.idl',
     'nsIPresentationDevice.idl',
     'nsIPresentationDeviceManager.idl',
     'nsIPresentationDevicePrompt.idl',
     'nsIPresentationDeviceProvider.idl',
     'nsIPresentationListener.idl',
+    'nsIPresentationLocalDevice.idl',
     'nsIPresentationRequestUIGlue.idl',
     'nsIPresentationService.idl',
     'nsIPresentationSessionRequest.idl',
     'nsIPresentationSessionTransport.idl',
     'nsIPresentationSessionTransportBuilder.idl',
     'nsITCPPresentationServer.idl',
 ]
 
--- a/dom/presentation/interfaces/nsIPresentationDevice.idl
+++ b/dom/presentation/interfaces/nsIPresentationDevice.idl
@@ -13,22 +13,25 @@ interface nsIPresentationControlChannel;
 interface nsIPresentationDevice : nsISupports
 {
   // The unique Id for the device. UUID is recommanded.
   readonly attribute AUTF8String id;
 
   // The human-readable name of this device.
   readonly attribute AUTF8String name;
 
-  //TODO expose more info in order to fulfill UX spec
+  // TODO expose more info in order to fulfill UX spec
   // The category of this device, could be "wifi", "bluetooth", "hdmi", etc.
   readonly attribute AUTF8String type;
 
   /*
    * Establish a control channel to this device.
    * @param url The URL requested to open by remote device.
    * @param presentationId The Id for representing this session.
    * @returns The control channel for this session.
    * @throws  NS_ERROR_FAILURE if the establishment fails
    */
   nsIPresentationControlChannel establishControlChannel(in DOMString url,
                                                         in DOMString presentationId);
+
+  // Do something when presentation session is disconnected.
+  void disconnect();
 };
new file mode 100644
--- /dev/null
+++ b/dom/presentation/interfaces/nsIPresentationLocalDevice.idl
@@ -0,0 +1,17 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * 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 "nsIPresentationDevice.idl"
+
+/*
+ * Local device.
+ * This device is used for 1-UA use case. The result for display is rendered by
+ * this host device.
+ */
+[scriptable, uuid(dd239720-cab6-4fb5-9025-cba23f1bbc2d)]
+interface nsIPresentationLocalDevice : nsIPresentationDevice
+{
+  // (1-UA only) The property is used to get the window ID of 1-UA device.
+  readonly attribute AUTF8String windowId;
+};
--- a/dom/presentation/provider/MulticastDNSDeviceProvider.cpp
+++ b/dom/presentation/provider/MulticastDNSDeviceProvider.cpp
@@ -1047,11 +1047,17 @@ MulticastDNSDeviceProvider::Device::Esta
 {
   if (!mProvider) {
     return NS_ERROR_FAILURE;
   }
 
   return mProvider->RequestSession(this, aUrl, aPresentationId, aRetVal);
 }
 
+NS_IMETHODIMP
+MulticastDNSDeviceProvider::Device::Disconnect()
+{
+  return NS_OK;
+}
+
 } // namespace presentation
 } // namespace dom
 } // namespace mozilla