2017-10-27 01:08:41 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2015-09-22 13:36:47 +03:00
|
|
|
/* 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/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_PresentationReceiver_h
|
|
|
|
#define mozilla_dom_PresentationReceiver_h
|
|
|
|
|
2016-10-04 01:22:34 +03:00
|
|
|
#include "mozilla/ErrorResult.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2016-05-29 20:59:00 +03:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2015-09-22 13:36:47 +03:00
|
|
|
#include "nsIPresentationListener.h"
|
2016-10-04 01:22:34 +03:00
|
|
|
#include "nsWrapperCache.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
|
|
|
|
class nsPIDOMWindowInner;
|
2015-09-22 13:36:47 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2015-10-12 05:36:31 +03:00
|
|
|
class PresentationConnection;
|
2016-05-29 20:59:00 +03:00
|
|
|
class PresentationConnectionList;
|
|
|
|
class Promise;
|
2015-09-22 13:36:47 +03:00
|
|
|
|
2016-05-29 20:59:00 +03:00
|
|
|
class PresentationReceiver final : public nsIPresentationRespondingListener,
|
|
|
|
public nsWrapperCache {
|
2015-09-22 13:36:47 +03:00
|
|
|
public:
|
2016-05-29 20:59:00 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(PresentationReceiver)
|
2015-09-22 13:36:47 +03:00
|
|
|
NS_DECL_NSIPRESENTATIONRESPONDINGLISTENER
|
|
|
|
|
2016-05-17 06:18:16 +03:00
|
|
|
static already_AddRefed<PresentationReceiver> Create(
|
|
|
|
nsPIDOMWindowInner* aWindow);
|
2015-09-22 13:36:47 +03:00
|
|
|
|
|
|
|
virtual JSObject* WrapObject(JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aGivenProto) override;
|
|
|
|
|
2016-10-04 01:22:34 +03:00
|
|
|
nsPIDOMWindowInner* GetParentObject() const { return mOwner; }
|
2015-09-22 13:36:47 +03:00
|
|
|
|
2016-05-29 20:59:00 +03:00
|
|
|
// WebIDL (public APIs)
|
|
|
|
already_AddRefed<Promise> GetConnectionList(ErrorResult& aRv);
|
2015-09-22 13:36:47 +03:00
|
|
|
|
|
|
|
private:
|
2016-01-30 20:05:36 +03:00
|
|
|
explicit PresentationReceiver(nsPIDOMWindowInner* aWindow);
|
2015-09-22 13:36:47 +03:00
|
|
|
|
2016-05-29 20:59:00 +03:00
|
|
|
virtual ~PresentationReceiver();
|
2015-09-22 13:36:47 +03:00
|
|
|
|
2016-10-14 17:18:26 +03:00
|
|
|
MOZ_IS_CLASS_INIT bool Init();
|
2015-09-22 13:36:47 +03:00
|
|
|
|
|
|
|
void Shutdown();
|
|
|
|
|
2016-05-29 20:59:00 +03:00
|
|
|
void CreateConnectionList();
|
2015-09-22 13:36:47 +03:00
|
|
|
|
|
|
|
// Store the inner window ID for |UnregisterRespondingListener| call in
|
|
|
|
// |Shutdown| since the inner window may not exist at that moment.
|
|
|
|
uint64_t mWindowId;
|
|
|
|
|
2016-05-29 20:59:00 +03:00
|
|
|
nsCOMPtr<nsPIDOMWindowInner> mOwner;
|
2016-08-02 20:11:00 +03:00
|
|
|
nsString mUrl;
|
2016-05-29 20:59:00 +03:00
|
|
|
RefPtr<Promise> mGetConnectionListPromise;
|
|
|
|
RefPtr<PresentationConnectionList> mConnectionList;
|
2015-09-22 13:36:47 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_PresentationReceiver_h
|