mirror of
https://git.freebsd.org/ports.git
synced 2025-07-18 17:59:20 -04:00
www/chromium: unbreak WebAuthn USB FIDO support by implementing a fake USB service
PR: 263790
This commit is contained in:
parent
7d4663ad1d
commit
b92dcd07c7
5 changed files with 145 additions and 3 deletions
|
@ -1,5 +1,6 @@
|
|||
PORTNAME= chromium
|
||||
PORTVERSION= 107.0.5304.87
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= www wayland
|
||||
MASTER_SITES= https://commondatastorage.googleapis.com/chromium-browser-official/ \
|
||||
https://nerd.hu/distfiles/:external
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
--- services/device/usb/BUILD.gn.orig 2022-02-28 16:54:41 UTC
|
||||
--- services/device/usb/BUILD.gn.orig 2022-10-29 13:32:26 UTC
|
||||
+++ services/device/usb/BUILD.gn
|
||||
@@ -103,15 +103,17 @@ static_library("usb") {
|
||||
deps += [ "//third_party/re2" ]
|
||||
|
@ -13,7 +13,7 @@
|
|||
- "usb_service_mac.cc",
|
||||
- "usb_service_mac.h",
|
||||
- ]
|
||||
+ if (is_mac || is_bsd) {
|
||||
+ if (is_mac || is_openbsd) {
|
||||
+ if (is_mac) {
|
||||
+ sources += [
|
||||
+ "usb_device_handle_mac.cc",
|
||||
|
@ -27,7 +27,21 @@
|
|||
|
||||
# These sources and deps are required for libusb.
|
||||
# TODO(https://crbug.com/1096743) Remove these sources.
|
||||
@@ -152,7 +154,7 @@ static_library("usb") {
|
||||
@@ -135,6 +137,13 @@ static_library("usb") {
|
||||
deps += [ "//third_party/libusb" ]
|
||||
}
|
||||
|
||||
+ if (is_freebsd) {
|
||||
+ sources += [
|
||||
+ "usb_service_fake.cc",
|
||||
+ "usb_service_fake.h",
|
||||
+ ]
|
||||
+ }
|
||||
+
|
||||
if (is_linux || is_chromeos) {
|
||||
sources += [
|
||||
"usb_device_linux.cc",
|
||||
@@ -152,7 +161,7 @@ static_library("usb") {
|
||||
deps += [ "//device/udev_linux" ]
|
||||
}
|
||||
|
||||
|
|
22
www/chromium/files/patch-services_device_usb_usb__service.cc
Normal file
22
www/chromium/files/patch-services_device_usb_usb__service.cc
Normal file
|
@ -0,0 +1,22 @@
|
|||
--- services/device/usb/usb_service.cc.orig 2022-10-29 13:32:26 UTC
|
||||
+++ services/device/usb/usb_service.cc
|
||||
@@ -29,6 +29,10 @@
|
||||
#include "services/device/usb/usb_service_mac.h"
|
||||
#elif BUILDFLAG(IS_WIN)
|
||||
#include "services/device/usb/usb_service_win.h"
|
||||
+#elif BUILDFLAG(IS_OPENBSD)
|
||||
+#include "services/device/usb/usb_service_impl.h"
|
||||
+#elif BUILDFLAG(IS_FREEBSD)
|
||||
+#include "services/device/usb/usb_service_fake.h"
|
||||
#endif
|
||||
|
||||
namespace device {
|
||||
@@ -60,6 +64,8 @@ std::unique_ptr<UsbService> UsbService::Create() {
|
||||
return base::WrapUnique(new UsbServiceMac());
|
||||
else
|
||||
return base::WrapUnique(new UsbServiceImpl());
|
||||
+#elif BUILDFLAG(IS_BSD)
|
||||
+ return base::WrapUnique(new UsbServiceImpl());
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
|
@ -0,0 +1,54 @@
|
|||
--- services/device/usb/usb_service_fake.cc.orig 2022-10-29 13:32:26 UTC
|
||||
+++ services/device/usb/usb_service_fake.cc
|
||||
@@ -0,0 +1,51 @@
|
||||
+// Copyright 2014 The Chromium Authors
|
||||
+// Use of this source code is governed by a BSD-style license that can be
|
||||
+// found in the LICENSE file.
|
||||
+
|
||||
+#include "services/device/usb/usb_service_fake.h"
|
||||
+
|
||||
+#include <stdint.h>
|
||||
+
|
||||
+#include <list>
|
||||
+#include <memory>
|
||||
+#include <set>
|
||||
+#include <utility>
|
||||
+
|
||||
+#include "base/barrier_closure.h"
|
||||
+#include "base/bind.h"
|
||||
+#include "base/callback_helpers.h"
|
||||
+#include "base/containers/contains.h"
|
||||
+#include "base/location.h"
|
||||
+#include "base/memory/ref_counted_memory.h"
|
||||
+#include "base/memory/weak_ptr.h"
|
||||
+#include "base/strings/string_number_conversions.h"
|
||||
+#include "base/strings/utf_string_conversions.h"
|
||||
+#include "base/task/sequenced_task_runner.h"
|
||||
+#include "base/task/single_thread_task_runner.h"
|
||||
+#include "base/task/thread_pool.h"
|
||||
+#include "base/threading/scoped_blocking_call.h"
|
||||
+#include "build/build_config.h"
|
||||
+#include "components/device_event_log/device_event_log.h"
|
||||
+#include "services/device/usb/usb_device_handle.h"
|
||||
+#include "services/device/usb/usb_error.h"
|
||||
+#include "services/device/usb/webusb_descriptors.h"
|
||||
+
|
||||
+namespace device {
|
||||
+
|
||||
+UsbServiceImpl::UsbServiceImpl()
|
||||
+ : task_runner_(base::SequencedTaskRunnerHandle::Get()) {
|
||||
+ NOTIMPLEMENTED();
|
||||
+}
|
||||
+
|
||||
+UsbServiceImpl::~UsbServiceImpl() {
|
||||
+ NOTIMPLEMENTED();
|
||||
+ NotifyWillDestroyUsbService();
|
||||
+}
|
||||
+
|
||||
+void UsbServiceImpl::GetDevices(GetDevicesCallback callback) {
|
||||
+ NOTIMPLEMENTED();
|
||||
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
+ UsbService::GetDevices(std::move(callback));
|
||||
+}
|
||||
+
|
||||
+} // namespace device
|
|
@ -0,0 +1,51 @@
|
|||
--- services/device/usb/usb_service_fake.h.orig 2022-10-29 13:32:26 UTC
|
||||
+++ services/device/usb/usb_service_fake.h
|
||||
@@ -0,0 +1,48 @@
|
||||
+// Copyright 2015 The Chromium Authors
|
||||
+// Use of this source code is governed by a BSD-style license that can be
|
||||
+// found in the LICENSE file.
|
||||
+
|
||||
+#ifndef SERVICES_DEVICE_USB_USB_SERVICE_IMPL_H_
|
||||
+#define SERVICES_DEVICE_USB_USB_SERVICE_IMPL_H_
|
||||
+
|
||||
+#include "services/device/usb/usb_service.h"
|
||||
+
|
||||
+#include <stddef.h>
|
||||
+
|
||||
+#include <map>
|
||||
+#include <set>
|
||||
+#include <string>
|
||||
+#include <vector>
|
||||
+
|
||||
+#include "base/containers/queue.h"
|
||||
+#include "base/memory/weak_ptr.h"
|
||||
+#include "build/build_config.h"
|
||||
+#include "services/device/usb/usb_context.h"
|
||||
+#include "services/device/usb/usb_device_impl.h"
|
||||
+#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
+
|
||||
+namespace device {
|
||||
+
|
||||
+class UsbDeviceImpl;
|
||||
+
|
||||
+class UsbServiceImpl final : public UsbService {
|
||||
+ public:
|
||||
+ UsbServiceImpl();
|
||||
+
|
||||
+ UsbServiceImpl(const UsbServiceImpl&) = delete;
|
||||
+ UsbServiceImpl& operator=(const UsbServiceImpl&) = delete;
|
||||
+
|
||||
+ ~UsbServiceImpl() override;
|
||||
+
|
||||
+ private:
|
||||
+ // device::UsbService implementation
|
||||
+ void GetDevices(GetDevicesCallback callback) override;
|
||||
+
|
||||
+ void OnUsbContext(scoped_refptr<UsbContext> context);
|
||||
+
|
||||
+ scoped_refptr<base::SequencedTaskRunner> task_runner_;
|
||||
+};
|
||||
+
|
||||
+} // namespace device
|
||||
+
|
||||
+#endif // SERVICES_DEVICE_USB_USB_SERVICE_IMPL_H_
|
Loading…
Add table
Reference in a new issue