Backed out changeset 2450366cf7ca (bug 1891629) for causing win msix mochitest failures
[gecko.git] / dom / gamepad / GamepadHapticActuator.h
blob18b659137b881e94e60478de7c951021a2d612ce
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_gamepad_GamepadHapticActuator_h
8 #define mozilla_dom_gamepad_GamepadHapticActuator_h
10 #include "nsCOMPtr.h"
11 #include "nsWrapperCache.h"
12 #include "mozilla/dom/GamepadHapticActuatorBinding.h"
13 #include "mozilla/dom/Gamepad.h"
14 #include "mozilla/dom/GamepadHandle.h"
16 namespace mozilla::dom {
17 class Promise;
19 class GamepadHapticActuator : public nsISupports, public nsWrapperCache {
20 public:
21 GamepadHapticActuator(nsISupports* aParent, GamepadHandle aGamepadHandle,
22 uint32_t aIndex);
24 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
25 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(GamepadHapticActuator)
27 nsISupports* GetParentObject() const;
29 virtual JSObject* WrapObject(JSContext* aCx,
30 JS::Handle<JSObject*> aGivenProto) override;
32 already_AddRefed<Promise> Pulse(double aValue, double aDuration,
33 ErrorResult& aRv);
35 GamepadHapticActuatorType Type() const;
37 void Set(const GamepadHapticActuator* aOther);
39 private:
40 virtual ~GamepadHapticActuator() = default;
42 protected:
43 nsCOMPtr<nsISupports> mParent;
44 GamepadHandle mGamepadHandle;
45 GamepadHapticActuatorType mType;
46 uint32_t mIndex;
49 } // namespace mozilla::dom
51 #endif // mozilla_dom_gamepad_GamepadHapticActuator_h