mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-21 07:47:32 +09:00
WebUSB pt.4
This commit is contained in:
parent
e686f8a313
commit
f7222385ac
3 changed files with 8 additions and 6 deletions
|
|
@ -96,7 +96,7 @@ private:
|
|||
RefPtr<Promise> mPromise;
|
||||
nsCOMPtr<nsPIDOMWindowInner> mWindow;
|
||||
nsTArray<RefPtr<USBDevice>> mCandidates;
|
||||
RefPtr<nsContentPermissionRequester> mRequester;
|
||||
nsCOMPtr<nsIContentPermissionRequester> mRequester;
|
||||
};
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(USBPermissionRequest)
|
||||
|
|
@ -127,12 +127,14 @@ USBPermissionRequest::GetTypes(nsIArray** aTypes)
|
|||
{
|
||||
nsTArray<nsString> options;
|
||||
for (const auto& device : mCandidates) {
|
||||
Nullable<nsString> label;
|
||||
DOMString label;
|
||||
device->GetProductName(label);
|
||||
if (label.IsNull() || label.Value().IsEmpty()) {
|
||||
nsAutoString labelString;
|
||||
label.ToString(labelString);
|
||||
if (label.IsNull() || labelString.IsEmpty()) {
|
||||
options.AppendElement(NS_LITERAL_STRING("USB device"));
|
||||
} else {
|
||||
options.AppendElement(label.Value());
|
||||
options.AppendElement(labelString);
|
||||
}
|
||||
}
|
||||
return nsContentPermissionUtils::CreatePermissionArray(
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
#ifdef XP_WIN
|
||||
|
||||
#include <setupapi.h>
|
||||
#include <string.h>
|
||||
#include <windows.h>
|
||||
#include <setupapi.h>
|
||||
#include <winusb.h>
|
||||
|
||||
#include "mozilla/fallible.h"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include "USBDescriptors.h"
|
||||
|
||||
#include "mozilla/HoldDropJSObjects.h"
|
||||
#include "mozilla/dom/ArrayBuffer.h"
|
||||
#include "mozilla/dom/TypedArray.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue