2020-04-06 22:33:32 +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: */
|
|
|
|
/* 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_XRInputSourceArray_h_
|
|
|
|
#define mozilla_dom_XRInputSourceArray_h_
|
|
|
|
|
|
|
|
#include "mozilla/DOMEventTargetHelper.h"
|
|
|
|
#include "mozilla/dom/WebXRBinding.h"
|
|
|
|
|
|
|
|
#include "gfxVR.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
2020-04-08 02:49:47 +03:00
|
|
|
namespace gfx {
|
|
|
|
struct VRControllerState;
|
|
|
|
}
|
2020-04-06 22:33:32 +03:00
|
|
|
namespace dom {
|
|
|
|
class XRInputSource;
|
|
|
|
|
|
|
|
class XRInputSourceArray final : public nsISupports, public nsWrapperCache {
|
|
|
|
public:
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(XRInputSourceArray)
|
|
|
|
|
|
|
|
explicit XRInputSourceArray(nsISupports* aParent);
|
|
|
|
|
|
|
|
// WebIDL Boilerplate
|
|
|
|
nsISupports* GetParentObject() const { return mParent; }
|
|
|
|
JSObject* WrapObject(JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aGivenProto) override;
|
|
|
|
|
2020-04-08 02:49:47 +03:00
|
|
|
// WebIDL Members
|
2020-04-06 22:33:32 +03:00
|
|
|
XRInputSource* IndexedGetter(uint32_t aIndex, bool& aFound);
|
|
|
|
uint32_t Length();
|
2020-04-08 02:49:47 +03:00
|
|
|
void Setup(XRSession* aSession, RefPtr<gfx::VRDisplayClient> aDisplayClient);
|
|
|
|
void Update(XRSession* aSession);
|
2020-04-08 07:39:01 +03:00
|
|
|
void Clear(XRSession* aSession);
|
2020-04-06 22:33:32 +03:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual ~XRInputSourceArray() = default;
|
|
|
|
|
2020-04-08 07:39:01 +03:00
|
|
|
private:
|
|
|
|
void DispatchInputSourceRemovedEvent(
|
|
|
|
const nsTArray<RefPtr<XRInputSource>>& aInputs, XRSession* aSession);
|
|
|
|
|
2020-04-06 22:33:32 +03:00
|
|
|
nsCOMPtr<nsISupports> mParent;
|
|
|
|
nsTArray<RefPtr<XRInputSource>> mInputSources;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_XRInputSourceArray_h_
|