mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-24 17:37:30 +09:00
WebUSB pt.2
This commit is contained in:
parent
f4afa8f456
commit
7c1a08e62f
10 changed files with 219 additions and 195 deletions
37
dom/usb/USBInterface.h
Normal file
37
dom/usb/USBInterface.h
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
#ifndef mozilla_dom_USBInterface_h
|
||||
#define mozilla_dom_USBInterface_h
|
||||
|
||||
#include "mozilla/dom/USBInterfaceBinding.h"
|
||||
#include "mozilla/dom/USBAlternateInterface.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
namespace mozilla { namespace dom {
|
||||
class USBInterface final : public nsISupports, public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
USBInterface(nsIGlobalObject*, uint8_t,
|
||||
nsTArray<RefPtr<USBAlternateInterface>>&&);
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(USBInterface)
|
||||
nsISupports* GetParentObject() const { return mOwner; }
|
||||
uint8_t InterfaceNumber() const { return mNumber; }
|
||||
USBAlternateInterface* GetAlternate() const { return mAlternate; }
|
||||
void SetAlternate(uint8_t);
|
||||
void GetAlternates(nsTArray<RefPtr<USBAlternateInterface>>& aValue) const { aValue = mAlternates; }
|
||||
bool Claimed() const { return mClaimed; }
|
||||
void SetClaimed(bool aClaimed) { mClaimed = aClaimed; }
|
||||
JSObject* WrapObject(JSContext*, JS::Handle<JSObject*>) override;
|
||||
private:
|
||||
~USBInterface() = default;
|
||||
nsCOMPtr<nsIGlobalObject> mOwner;
|
||||
uint8_t mNumber;
|
||||
RefPtr<USBAlternateInterface> mAlternate;
|
||||
nsTArray<RefPtr<USBAlternateInterface>> mAlternates;
|
||||
bool mClaimed;
|
||||
};
|
||||
} }
|
||||
#endif // mozilla_dom_USBInterface_h
|
||||
Loading…
Add table
Add a link
Reference in a new issue