Commit 3f46ac3b authored by Adam Langley's avatar Adam Langley Committed by Commit Bot

cablev2: plumb a NetworkContext into discovery.

This change plumbs a NetworkContext for WebSocket creation into the
|FidoDiscoveryFactory| when caBLEv2 is enabled.

BUG=1002262

Change-Id: I0fabe9642c785669c75516207bf4d8f2f8c147e1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2340389
Commit-Queue: Adam Langley <agl@chromium.org>
Reviewed-by: default avatarMartin Kreichgauer <martinkr@google.com>
Cr-Commit-Position: refs/heads/master@{#799869}
parent 7fbeaa0f
......@@ -18,6 +18,7 @@
#include "base/time/time.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/net/system_network_context_manager.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webauthn/authenticator_request_dialog.h"
#include "chrome/browser/webauthn/authenticator_request_dialog_model.h"
......@@ -330,6 +331,8 @@ void ChromeAuthenticatorRequestDelegate::ConfigureCable(
content::GetDeviceService().BindUsbDeviceManager(
usb_device_manager.BindNewPipeAndPassReceiver());
discovery_factory->set_usb_device_manager(std::move(usb_device_manager));
discovery_factory->set_network_context(
SystemNetworkContextManager::GetInstance()->GetContext());
}
if (pairings.empty() && !qr_generator_key) {
......
......@@ -47,8 +47,7 @@ std::unique_ptr<FidoDiscoveryBase> FidoDiscoveryFactory::Create(
(cable_data_.has_value() || qr_generator_key_.has_value())) {
return std::make_unique<FidoCableDiscovery>(
cable_data_.value_or(std::vector<CableDiscoveryData>()),
qr_generator_key_, cable_pairing_callback_,
/*network_context=*/nullptr);
qr_generator_key_, cable_pairing_callback_, network_context_);
}
return nullptr;
case FidoTransportProtocol::kNearFieldCommunication:
......@@ -87,6 +86,11 @@ void FidoDiscoveryFactory::set_usb_device_manager(
usb_device_manager_.emplace(std::move(usb_device_manager));
}
void FidoDiscoveryFactory::set_network_context(
network::mojom::NetworkContext* network_context) {
network_context_ = network_context;
}
void FidoDiscoveryFactory::set_cable_pairing_callback(
base::RepeatingCallback<void(std::unique_ptr<CableDiscoveryData>)>
pairing_callback) {
......
......@@ -19,6 +19,7 @@
#include "device/fido/hid/fido_hid_discovery.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "services/device/public/mojom/usb_manager.mojom.h"
#include "services/network/public/mojom/network_context.mojom-forward.h"
#if defined(OS_MAC)
#include "device/fido/mac/authenticator_config.h"
......@@ -53,6 +54,8 @@ class COMPONENT_EXPORT(DEVICE_FIDO) FidoDiscoveryFactory {
void set_usb_device_manager(mojo::Remote<device::mojom::UsbDeviceManager>);
void set_network_context(network::mojom::NetworkContext*);
// set_cable_pairing_callback installs a repeating callback that will be
// called when a QR handshake results in a phone wishing to pair with this
// browser.
......@@ -91,6 +94,7 @@ class COMPONENT_EXPORT(DEVICE_FIDO) FidoDiscoveryFactory {
#endif // defined(OS_MAC)
base::Optional<mojo::Remote<device::mojom::UsbDeviceManager>>
usb_device_manager_;
network::mojom::NetworkContext* network_context_ = nullptr;
base::Optional<std::vector<CableDiscoveryData>> cable_data_;
base::Optional<QRGeneratorKey> qr_generator_key_;
base::Optional<
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment