Backed out changeset 2450366cf7ca (bug 1891629) for causing win msix mochitest failures
[gecko.git] / dom / gamepad / GamepadLightIndicator.h
blob80c6f9c13b051db65ecb6b7c4a04024de3e5b933
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_GamepadLightIndicator_h
8 #define mozilla_dom_gamepad_GamepadLightIndicator_h
10 #include "mozilla/dom/GamepadLightIndicatorBinding.h"
11 #include "mozilla/dom/GamepadHandle.h"
12 #include "nsWrapperCache.h"
14 namespace mozilla::dom {
16 class GamepadLightIndicator final : public nsISupports, public nsWrapperCache {
17 public:
18 GamepadLightIndicator(nsISupports* aParent, GamepadHandle aGamepadHandle,
19 uint32_t aIndex);
21 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
22 NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(GamepadLightIndicator)
24 static GamepadLightIndicatorType DefaultType() {
25 return GamepadLightIndicatorType::Rgb;
28 nsISupports* GetParentObject() const;
30 virtual JSObject* WrapObject(JSContext* aCx,
31 JS::Handle<JSObject*> aGivenProto) override;
33 already_AddRefed<Promise> SetColor(const GamepadLightColor& color,
34 ErrorResult& aRv);
36 void SetType(GamepadLightIndicatorType aType) { mType = aType; }
38 GamepadLightIndicatorType Type() const;
40 void Set(const GamepadLightIndicator* aOther);
42 private:
43 virtual ~GamepadLightIndicator();
45 nsCOMPtr<nsISupports> mParent;
46 GamepadLightIndicatorType mType;
47 GamepadHandle mGamepadHandle;
48 uint32_t mIndex;
51 } // namespace mozilla::dom
53 #endif // mozilla_dom_gamepad_GamepadLightIndicator_h