2026-09-19 11:51:58 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
|
#ifndef mozilla_dom_USBConfiguration_h
|
|
|
|
|
#define mozilla_dom_USBConfiguration_h
|
|
|
|
|
|
|
|
|
|
#include "mozilla/dom/Nullable.h"
|
2026-09-19 12:04:21 -07:00
|
|
|
#include "mozilla/dom/DOMString.h"
|
2026-09-19 11:51:58 -07:00
|
|
|
#include "mozilla/dom/USBInterface.h"
|
2026-09-19 11:59:55 -07:00
|
|
|
#include "mozilla/dom/USBBinding.h"
|
2026-09-19 11:51:58 -07:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
|
#include "nsString.h"
|
|
|
|
|
#include "nsTArray.h"
|
|
|
|
|
#include "nsWrapperCache.h"
|
|
|
|
|
|
|
|
|
|
namespace mozilla { namespace dom {
|
|
|
|
|
class USBConfiguration final : public nsISupports, public nsWrapperCache
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
USBConfiguration(nsIGlobalObject*, uint8_t,
|
|
|
|
|
nsTArray<RefPtr<USBInterface>>&&);
|
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(USBConfiguration)
|
|
|
|
|
nsISupports* GetParentObject() const { return mOwner; }
|
|
|
|
|
uint8_t ConfigurationValue() const { return mValue; }
|
2026-09-19 12:04:21 -07:00
|
|
|
void GetConfigurationName(DOMString& aValue) const
|
|
|
|
|
{
|
|
|
|
|
if (mName.IsNull()) aValue.SetNull();
|
|
|
|
|
else aValue.SetOwnedString(mName.Value());
|
|
|
|
|
}
|
2026-09-19 11:51:58 -07:00
|
|
|
void GetInterfaces(nsTArray<RefPtr<USBInterface>>& aValue) const { aValue = mInterfaces; }
|
|
|
|
|
JSObject* WrapObject(JSContext*, JS::Handle<JSObject*>) override;
|
|
|
|
|
private:
|
|
|
|
|
~USBConfiguration() = default;
|
|
|
|
|
nsCOMPtr<nsIGlobalObject> mOwner;
|
|
|
|
|
uint8_t mValue;
|
|
|
|
|
Nullable<nsString> mName;
|
|
|
|
|
nsTArray<RefPtr<USBInterface>> mInterfaces;
|
|
|
|
|
};
|
|
|
|
|
} }
|
|
|
|
|
#endif // mozilla_dom_USBConfiguration_h
|