NS_IMETHODIMP PresentationDeviceManager::UpdateDevice(nsIPresentationDevice* aDevice) { NS_ENSURE_ARG(aDevice); MOZ_ASSERT(NS_IsMainThread()); if (NS_WARN_IF(!mDevices.Contains(aDevice))) { return NS_ERROR_FAILURE; } NotifyDeviceChange(aDevice, MOZ_UTF16("update")); return NS_OK; }
// nsIPresentationDeviceListener NS_IMETHODIMP PresentationDeviceManager::AddDevice(nsIPresentationDevice* aDevice) { NS_ENSURE_ARG(aDevice); MOZ_ASSERT(NS_IsMainThread()); if (NS_WARN_IF(mDevices.Contains(aDevice))) { return NS_ERROR_FAILURE; } mDevices.AppendElement(aDevice); NotifyDeviceChange(aDevice, u"add"); return NS_OK; }
NS_IMETHODIMP PresentationDeviceManager::RemoveDevice(nsIPresentationDevice* aDevice) { NS_ENSURE_ARG(aDevice); MOZ_ASSERT(NS_IsMainThread()); int32_t index = mDevices.IndexOf(aDevice); if (NS_WARN_IF(index < 0)) { return NS_ERROR_FAILURE; } mDevices.RemoveElementAt(index); NotifyDeviceChange(aDevice, u"remove"); return NS_OK; }