summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/modules/webusb/usb.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2021-05-20 09:47:09 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2021-06-07 11:15:42 +0000
commit189d4fd8fad9e3c776873be51938cd31a42b6177 (patch)
tree6497caeff5e383937996768766ab3bb2081a40b2 /chromium/third_party/blink/renderer/modules/webusb/usb.cc
parent8bc75099d364490b22f43a7ce366b366c08f4164 (diff)
downloadqtwebengine-chromium-189d4fd8fad9e3c776873be51938cd31a42b6177.tar.gz
BASELINE: Update Chromium to 90.0.4430.221
Change-Id: Iff4d9d18d2fcf1a576f3b1f453010f744a232920 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/modules/webusb/usb.cc')
-rw-r--r--chromium/third_party/blink/renderer/modules/webusb/usb.cc24
1 files changed, 19 insertions, 5 deletions
diff --git a/chromium/third_party/blink/renderer/modules/webusb/usb.cc b/chromium/third_party/blink/renderer/modules/webusb/usb.cc
index cea4f3c741c..d99d900d500 100644
--- a/chromium/third_party/blink/renderer/modules/webusb/usb.cc
+++ b/chromium/third_party/blink/renderer/modules/webusb/usb.cc
@@ -17,6 +17,7 @@
#include "third_party/blink/renderer/bindings/modules/v8/v8_usb_device_request_options.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
+#include "third_party/blink/renderer/core/execution_context/navigator_base.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/modules/event_target_modules.h"
#include "third_party/blink/renderer/modules/webusb/usb_connection_event.h"
@@ -34,7 +35,7 @@ namespace blink {
namespace {
const char kFeaturePolicyBlocked[] =
- "Access to the feature \"usb\" is disallowed by feature policy.";
+ "Access to the feature \"usb\" is disallowed by permissions policy.";
const char kNoDeviceSelected[] = "No device selected.";
void RejectWithTypeError(const String& error_details,
@@ -91,10 +92,22 @@ UsbDeviceFilterPtr ConvertDeviceFilter(const USBDeviceFilter* filter,
} // namespace
-USB::USB(ExecutionContext& context)
- : ExecutionContextLifecycleObserver(&context),
- service_(&context),
- client_receiver_(this, &context) {}
+const char USB::kSupplementName[] = "USB";
+
+USB* USB::usb(NavigatorBase& navigator) {
+ USB* usb = Supplement<NavigatorBase>::From<USB>(navigator);
+ if (!usb) {
+ usb = MakeGarbageCollected<USB>(navigator);
+ ProvideTo(navigator, usb);
+ }
+ return usb;
+}
+
+USB::USB(NavigatorBase& navigator)
+ : Supplement<NavigatorBase>(navigator),
+ ExecutionContextLifecycleObserver(navigator.GetExecutionContext()),
+ service_(navigator.GetExecutionContext()),
+ client_receiver_(this, navigator.GetExecutionContext()) {}
USB::~USB() {
// |service_| may still be valid but there should be no more outstanding
@@ -327,6 +340,7 @@ void USB::Trace(Visitor* visitor) const {
visitor->Trace(client_receiver_);
visitor->Trace(device_cache_);
EventTargetWithInlineData::Trace(visitor);
+ Supplement<NavigatorBase>::Trace(visitor);
ExecutionContextLifecycleObserver::Trace(visitor);
}