0

Migrate absl variant.h and utility.h in device

Since https://crrev.com/c/6330348, some utils in
third_party/abseil-cpp/absl/types/variant.h and
and third_party/abseil-cpp/absl/utility/utility.h are only aliases for
their std counterparts. This CL migrates code to use std:: directly.

Bug: 40242126
Change-Id: Icc6dcd8f2b4623dddcb34df689d154dad9a02e52
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6343310
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Commit-Queue: Victor Vianna <victorvianna@google.com>
Cr-Commit-Position: refs/heads/main@{#1434177}
This commit is contained in:
Victor Hugo Vianna Silva
2025-03-18 09:28:26 -07:00
committed by Chromium LUCI CQ
parent 351a0d625e
commit 21512f1765
16 changed files with 138 additions and 130 deletions

@ -4,6 +4,8 @@
#include "device/bluetooth/floss/floss_sdp_types.h" #include "device/bluetooth/floss/floss_sdp_types.h"
#include <variant>
#include "base/containers/contains.h" #include "base/containers/contains.h"
namespace floss { namespace floss {
@ -55,22 +57,22 @@ constexpr char kSdpDipRecordPropPrimaryRecord[] = "primary_record";
std::optional<floss::BtSdpHeaderOverlay> GetHeaderOverlayFromSdpRecord( std::optional<floss::BtSdpHeaderOverlay> GetHeaderOverlayFromSdpRecord(
const floss::BtSdpRecord& record) { const floss::BtSdpRecord& record) {
if (absl::holds_alternative<floss::BtSdpHeaderOverlay>(record)) { if (std::holds_alternative<floss::BtSdpHeaderOverlay>(record)) {
return absl::get<floss::BtSdpHeaderOverlay>(record); return std::get<floss::BtSdpHeaderOverlay>(record);
} else if (absl::holds_alternative<floss::BtSdpMasRecord>(record)) { } else if (std::holds_alternative<floss::BtSdpMasRecord>(record)) {
return absl::get<floss::BtSdpMasRecord>(record).hdr; return std::get<floss::BtSdpMasRecord>(record).hdr;
} else if (absl::holds_alternative<floss::BtSdpMnsRecord>(record)) { } else if (std::holds_alternative<floss::BtSdpMnsRecord>(record)) {
return absl::get<floss::BtSdpMnsRecord>(record).hdr; return std::get<floss::BtSdpMnsRecord>(record).hdr;
} else if (absl::holds_alternative<floss::BtSdpPseRecord>(record)) { } else if (std::holds_alternative<floss::BtSdpPseRecord>(record)) {
return absl::get<floss::BtSdpPseRecord>(record).hdr; return std::get<floss::BtSdpPseRecord>(record).hdr;
} else if (absl::holds_alternative<floss::BtSdpPceRecord>(record)) { } else if (std::holds_alternative<floss::BtSdpPceRecord>(record)) {
return absl::get<floss::BtSdpPceRecord>(record).hdr; return std::get<floss::BtSdpPceRecord>(record).hdr;
} else if (absl::holds_alternative<floss::BtSdpOpsRecord>(record)) { } else if (std::holds_alternative<floss::BtSdpOpsRecord>(record)) {
return absl::get<floss::BtSdpOpsRecord>(record).hdr; return std::get<floss::BtSdpOpsRecord>(record).hdr;
} else if (absl::holds_alternative<floss::BtSdpSapRecord>(record)) { } else if (std::holds_alternative<floss::BtSdpSapRecord>(record)) {
return absl::get<floss::BtSdpSapRecord>(record).hdr; return std::get<floss::BtSdpSapRecord>(record).hdr;
} else if (absl::holds_alternative<floss::BtSdpDipRecord>(record)) { } else if (std::holds_alternative<floss::BtSdpDipRecord>(record)) {
return absl::get<floss::BtSdpDipRecord>(record).hdr; return std::get<floss::BtSdpDipRecord>(record).hdr;
} else { } else {
return std::nullopt; return std::nullopt;
} }
@ -526,46 +528,46 @@ void FlossDBusClient::WriteDBusParam(dbus::MessageWriter* writer,
dbus::MessageWriter array_writer(nullptr); dbus::MessageWriter array_writer(nullptr);
writer->OpenArray("{sv}", &array_writer); writer->OpenArray("{sv}", &array_writer);
if (absl::holds_alternative<BtSdpHeaderOverlay>(record)) { if (std::holds_alternative<BtSdpHeaderOverlay>(record)) {
WriteDictEntry(&array_writer, kTypeKey, WriteDictEntry(&array_writer, kTypeKey,
static_cast<uint32_t>(BtSdpType::kRaw)); static_cast<uint32_t>(BtSdpType::kRaw));
WriteDictEntry(&array_writer, kVariantValueKey, WriteDictEntry(&array_writer, kVariantValueKey,
absl::get<BtSdpHeaderOverlay>(record)); std::get<BtSdpHeaderOverlay>(record));
} else if (absl::holds_alternative<BtSdpMasRecord>(record)) { } else if (std::holds_alternative<BtSdpMasRecord>(record)) {
WriteDictEntry(&array_writer, kTypeKey, WriteDictEntry(&array_writer, kTypeKey,
static_cast<uint32_t>(BtSdpType::kMapMas)); static_cast<uint32_t>(BtSdpType::kMapMas));
WriteDictEntry(&array_writer, kVariantValueKey, WriteDictEntry(&array_writer, kVariantValueKey,
absl::get<BtSdpMasRecord>(record)); std::get<BtSdpMasRecord>(record));
} else if (absl::holds_alternative<BtSdpMnsRecord>(record)) { } else if (std::holds_alternative<BtSdpMnsRecord>(record)) {
WriteDictEntry(&array_writer, kTypeKey, WriteDictEntry(&array_writer, kTypeKey,
static_cast<uint32_t>(BtSdpType::kMapMns)); static_cast<uint32_t>(BtSdpType::kMapMns));
WriteDictEntry(&array_writer, kVariantValueKey, WriteDictEntry(&array_writer, kVariantValueKey,
absl::get<BtSdpMnsRecord>(record)); std::get<BtSdpMnsRecord>(record));
} else if (absl::holds_alternative<BtSdpPseRecord>(record)) { } else if (std::holds_alternative<BtSdpPseRecord>(record)) {
WriteDictEntry(&array_writer, kTypeKey, WriteDictEntry(&array_writer, kTypeKey,
static_cast<uint32_t>(BtSdpType::kPbapPse)); static_cast<uint32_t>(BtSdpType::kPbapPse));
WriteDictEntry(&array_writer, kVariantValueKey, WriteDictEntry(&array_writer, kVariantValueKey,
absl::get<BtSdpPseRecord>(record)); std::get<BtSdpPseRecord>(record));
} else if (absl::holds_alternative<BtSdpPceRecord>(record)) { } else if (std::holds_alternative<BtSdpPceRecord>(record)) {
WriteDictEntry(&array_writer, kTypeKey, WriteDictEntry(&array_writer, kTypeKey,
static_cast<uint32_t>(BtSdpType::kPbapPce)); static_cast<uint32_t>(BtSdpType::kPbapPce));
WriteDictEntry(&array_writer, kVariantValueKey, WriteDictEntry(&array_writer, kVariantValueKey,
absl::get<BtSdpPceRecord>(record)); std::get<BtSdpPceRecord>(record));
} else if (absl::holds_alternative<BtSdpOpsRecord>(record)) { } else if (std::holds_alternative<BtSdpOpsRecord>(record)) {
WriteDictEntry(&array_writer, kTypeKey, WriteDictEntry(&array_writer, kTypeKey,
static_cast<uint32_t>(BtSdpType::kOppServer)); static_cast<uint32_t>(BtSdpType::kOppServer));
WriteDictEntry(&array_writer, kVariantValueKey, WriteDictEntry(&array_writer, kVariantValueKey,
absl::get<BtSdpOpsRecord>(record)); std::get<BtSdpOpsRecord>(record));
} else if (absl::holds_alternative<BtSdpSapRecord>(record)) { } else if (std::holds_alternative<BtSdpSapRecord>(record)) {
WriteDictEntry(&array_writer, kTypeKey, WriteDictEntry(&array_writer, kTypeKey,
static_cast<uint32_t>(BtSdpType::kSapServer)); static_cast<uint32_t>(BtSdpType::kSapServer));
WriteDictEntry(&array_writer, kVariantValueKey, WriteDictEntry(&array_writer, kVariantValueKey,
absl::get<BtSdpSapRecord>(record)); std::get<BtSdpSapRecord>(record));
} else if (absl::holds_alternative<BtSdpDipRecord>(record)) { } else if (std::holds_alternative<BtSdpDipRecord>(record)) {
WriteDictEntry(&array_writer, kTypeKey, WriteDictEntry(&array_writer, kTypeKey,
static_cast<uint32_t>(BtSdpType::kDip)); static_cast<uint32_t>(BtSdpType::kDip));
WriteDictEntry(&array_writer, kVariantValueKey, WriteDictEntry(&array_writer, kVariantValueKey,
absl::get<BtSdpDipRecord>(record)); std::get<BtSdpDipRecord>(record));
} }
writer->CloseContainer(&array_writer); writer->CloseContainer(&array_writer);

@ -5,11 +5,11 @@
#define DEVICE_BLUETOOTH_FLOSS_FLOSS_SDP_TYPES_H_ #define DEVICE_BLUETOOTH_FLOSS_FLOSS_SDP_TYPES_H_
#include <string> #include <string>
#include <variant>
#include "device/bluetooth/bluetooth_device.h" #include "device/bluetooth/bluetooth_device.h"
#include "device/bluetooth/bluetooth_export.h" #include "device/bluetooth/bluetooth_export.h"
#include "device/bluetooth/floss/floss_dbus_client.h" #include "device/bluetooth/floss/floss_dbus_client.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
namespace floss { namespace floss {
@ -85,14 +85,14 @@ struct DEVICE_BLUETOOTH_EXPORT BtSdpDipRecord {
bool primary_record; bool primary_record;
}; };
using BtSdpRecord = absl::variant<BtSdpHeaderOverlay, using BtSdpRecord = std::variant<BtSdpHeaderOverlay,
BtSdpMasRecord, BtSdpMasRecord,
BtSdpMnsRecord, BtSdpMnsRecord,
BtSdpPseRecord, BtSdpPseRecord,
BtSdpPceRecord, BtSdpPceRecord,
BtSdpOpsRecord, BtSdpOpsRecord,
BtSdpSapRecord, BtSdpSapRecord,
BtSdpDipRecord>; BtSdpDipRecord>;
std::optional<floss::BtSdpHeaderOverlay> DEVICE_BLUETOOTH_EXPORT std::optional<floss::BtSdpHeaderOverlay> DEVICE_BLUETOOTH_EXPORT
GetHeaderOverlayFromSdpRecord(const floss::BtSdpRecord& record); GetHeaderOverlayFromSdpRecord(const floss::BtSdpRecord& record);

@ -11,6 +11,7 @@
#include <memory> #include <memory>
#include <optional> #include <optional>
#include <string> #include <string>
#include <variant>
#include <vector> #include <vector>
#include "base/component_export.h" #include "base/component_export.h"
@ -18,7 +19,6 @@
#include "base/time/time.h" #include "base/time/time.h"
#include "device/fido/cable/v2_constants.h" #include "device/fido/cable/v2_constants.h"
#include "device/fido/fido_constants.h" #include "device/fido/fido_constants.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
#include "third_party/icu/source/common/unicode/uversion.h" #include "third_party/icu/source/common/unicode/uversion.h"
namespace cbor { namespace cbor {

@ -4,6 +4,8 @@
#include "device/fido/cable/fido_tunnel_device.h" #include "device/fido/cable/fido_tunnel_device.h"
#include <variant>
#include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_functions.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/task/sequenced_task_runner.h" #include "base/task/sequenced_task_runner.h"
@ -115,7 +117,7 @@ FidoTunnelDevice::FidoTunnelDevice(
must_support_ctap_(must_support_ctap) { must_support_ctap_(must_support_ctap) {
const eid::Components components = eid::ToComponents(decrypted_eid); const eid::Components components = eid::ToComponents(decrypted_eid);
QRInfo& info = absl::get<QRInfo>(info_); QRInfo& info = std::get<QRInfo>(info_);
info.pairing_callback = std::move(pairing_callback); info.pairing_callback = std::move(pairing_callback);
info.local_identity_seed = info.local_identity_seed =
fido_parsing_utils::Materialize(local_identity_seed); fido_parsing_utils::Materialize(local_identity_seed);
@ -173,7 +175,7 @@ FidoTunnelDevice::FidoTunnelDevice(
CHECK(client_payload_bytes.has_value()); CHECK(client_payload_bytes.has_value());
const std::string client_payload_hex = base::HexEncode(*client_payload_bytes); const std::string client_payload_hex = base::HexEncode(*client_payload_bytes);
PairedInfo& info = absl::get<PairedInfo>(info_); PairedInfo& info = std::get<PairedInfo>(info_);
info.eid_encryption_key = Derive<kEIDKeySize>(pairing->secret, client_nonce, info.eid_encryption_key = Derive<kEIDKeySize>(pairing->secret, client_nonce,
DerivedValueType::kEIDKey); DerivedValueType::kEIDKey);
info.peer_identity = pairing->peer_public_key_x962; info.peer_identity = pairing->peer_public_key_x962;
@ -216,7 +218,7 @@ FidoTunnelDevice::~FidoTunnelDevice() {
bool FidoTunnelDevice::MatchAdvert( bool FidoTunnelDevice::MatchAdvert(
const std::array<uint8_t, kAdvertSize>& advert) { const std::array<uint8_t, kAdvertSize>& advert) {
PairedInfo& info = absl::get<PairedInfo>(info_); PairedInfo& info = std::get<PairedInfo>(info_);
std::optional<CableEidArray> plaintext = std::optional<CableEidArray> plaintext =
eid::Decrypt(advert, info.eid_encryption_key); eid::Decrypt(advert, info.eid_encryption_key);
@ -356,14 +358,14 @@ void FidoTunnelDevice::OnTunnelReady(
DCHECK(!handshake_); DCHECK(!handshake_);
RecordEvent(CableV2TunnelEvent::kTunnelOk); RecordEvent(CableV2TunnelEvent::kTunnelOk);
if (auto* info = absl::get_if<QRInfo>(&info_)) { if (auto* info = std::get_if<QRInfo>(&info_)) {
// A QR handshake can start as soon as the tunnel is connected. // A QR handshake can start as soon as the tunnel is connected.
handshake_.emplace(info->psk, /*peer_identity=*/std::nullopt, handshake_.emplace(info->psk, /*peer_identity=*/std::nullopt,
info->local_identity_seed); info->local_identity_seed);
} else { } else {
// A paired handshake may be able to start if we have already seen // A paired handshake may be able to start if we have already seen
// the BLE advert. // the BLE advert.
PairedInfo& paired_info = absl::get<PairedInfo>(info_); PairedInfo& paired_info = std::get<PairedInfo>(info_);
if (paired_info.psk) { if (paired_info.psk) {
handshake_.emplace(*paired_info.psk, paired_info.peer_identity, handshake_.emplace(*paired_info.psk, paired_info.peer_identity,
/*local_identity=*/std::nullopt); /*local_identity=*/std::nullopt);
@ -385,7 +387,7 @@ void FidoTunnelDevice::OnTunnelReady(
break; break;
case WebSocketAdapter::Result::GONE: case WebSocketAdapter::Result::GONE:
if (auto* info = absl::get_if<PairedInfo>(&info_)) { if (auto* info = std::get_if<PairedInfo>(&info_)) {
FIDO_LOG(DEBUG) << GetId() FIDO_LOG(DEBUG) << GetId()
<< ": tunnel server reports that contact ID is invalid"; << ": tunnel server reports that contact ID is invalid";
RecordEvent(CableV2TunnelEvent::kTunnelGone); RecordEvent(CableV2TunnelEvent::kTunnelGone);
@ -556,7 +558,7 @@ void FidoTunnelDevice::OnTunnelData(
OnError(); OnError();
return; return;
} }
if (auto* info = absl::get_if<QRInfo>(&info_)) { if (auto* info = std::get_if<QRInfo>(&info_)) {
std::optional<std::unique_ptr<Pairing>> maybe_pairing = std::optional<std::unique_ptr<Pairing>> maybe_pairing =
Pairing::Parse(linking_it->second, info->tunnel_server_domain, Pairing::Parse(linking_it->second, info->tunnel_server_domain,
info->local_identity_seed, *handshake_hash_); info->local_identity_seed, *handshake_hash_);
@ -588,7 +590,7 @@ void FidoTunnelDevice::OnTunnelData(
established_connection_ = base::MakeRefCounted<EstablishedConnection>( established_connection_ = base::MakeRefCounted<EstablishedConnection>(
std::move(websocket_client_), GetId(), protocol_revision, std::move(websocket_client_), GetId(), protocol_revision,
std::move(crypter_), *handshake_hash_, absl::get_if<QRInfo>(&info_)); std::move(crypter_), *handshake_hash_, std::get_if<QRInfo>(&info_));
if (discover_callback_) { if (discover_callback_) {
CHECK(features_.has_value()); CHECK(features_.has_value());

@ -6,6 +6,7 @@
#define DEVICE_FIDO_CABLE_FIDO_TUNNEL_DEVICE_H_ #define DEVICE_FIDO_CABLE_FIDO_TUNNEL_DEVICE_H_
#include <array> #include <array>
#include <variant>
#include <vector> #include <vector>
#include "base/functional/callback_forward.h" #include "base/functional/callback_forward.h"
@ -18,7 +19,6 @@
#include "device/fido/fido_constants.h" #include "device/fido/fido_constants.h"
#include "device/fido/fido_device.h" #include "device/fido/fido_device.h"
#include "device/fido/network_context_factory.h" #include "device/fido/network_context_factory.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
namespace device::cablev2 { namespace device::cablev2 {
@ -237,7 +237,7 @@ class COMPONENT_EXPORT(DEVICE_FIDO) FidoTunnelDevice : public FidoDevice {
bool ProcessConnectSignal(base::span<const uint8_t> data); bool ProcessConnectSignal(base::span<const uint8_t> data);
State state_ = State::kConnecting; State state_ = State::kConnecting;
absl::variant<QRInfo, PairedInfo> info_; std::variant<QRInfo, PairedInfo> info_;
const std::array<uint8_t, 8> id_; const std::array<uint8_t, 8> id_;
const std::optional<base::RepeatingCallback<void(Event)>> event_callback_; const std::optional<base::RepeatingCallback<void(Event)>> event_callback_;
const bool must_support_ctap_; const bool must_support_ctap_;

@ -6,6 +6,7 @@
#include <algorithm> #include <algorithm>
#include <string_view> #include <string_view>
#include <variant>
#include "base/containers/flat_set.h" #include "base/containers/flat_set.h"
#include "base/feature_list.h" #include "base/feature_list.h"
@ -40,7 +41,6 @@
#include "net/storage_access_api/status.h" #include "net/storage_access_api/status.h"
#include "net/traffic_annotation/network_traffic_annotation.h" #include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/mojom/network_context.mojom.h" #include "services/network/public/mojom/network_context.mojom.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
#include "third_party/blink/public/mojom/webauthn/authenticator.mojom.h" #include "third_party/blink/public/mojom/webauthn/authenticator.mojom.h"
#include "third_party/boringssl/src/include/openssl/aes.h" #include "third_party/boringssl/src/include/openssl/aes.h"
#include "third_party/boringssl/src/include/openssl/ec_key.h" #include "third_party/boringssl/src/include/openssl/ec_key.h"
@ -672,14 +672,14 @@ class CTAP2Processor : public Transaction {
return; return;
} }
if (auto* error = absl::get_if<Platform::Error>(&update)) { if (auto* error = std::get_if<Platform::Error>(&update)) {
have_completed_ = true; have_completed_ = true;
platform_->OnCompleted(*error); platform_->OnCompleted(*error);
return; return;
} else if (auto* status = absl::get_if<Platform::Status>(&update)) { } else if (auto* status = std::get_if<Platform::Status>(&update)) {
platform_->OnStatus(*status); platform_->OnStatus(*status);
return; return;
} else if (absl::get_if<Transport::Disconnected>(&update)) { } else if (std::get_if<Transport::Disconnected>(&update)) {
std::optional<Platform::Error> maybe_error; std::optional<Platform::Error> maybe_error;
if (!transaction_received_) { if (!transaction_received_) {
maybe_error = Platform::Error::UNEXPECTED_EOF; maybe_error = Platform::Error::UNEXPECTED_EOF;
@ -691,22 +691,22 @@ class CTAP2Processor : public Transaction {
return; return;
} }
auto& msg = absl::get<std::pair<PayloadType, std::vector<uint8_t>>>(update); auto& msg = std::get<std::pair<PayloadType, std::vector<uint8_t>>>(update);
if (msg.first != PayloadType::kCTAP) { if (msg.first != PayloadType::kCTAP) {
have_completed_ = true; have_completed_ = true;
platform_->OnCompleted(Platform::Error::INVALID_CTAP); platform_->OnCompleted(Platform::Error::INVALID_CTAP);
return; return;
} }
const absl::variant<std::vector<uint8_t>, Platform::Error> result = const std::variant<std::vector<uint8_t>, Platform::Error> result =
ProcessCTAPMessage(msg.second); ProcessCTAPMessage(msg.second);
if (const auto* error = absl::get_if<Platform::Error>(&result)) { if (const auto* error = std::get_if<Platform::Error>(&result)) {
have_completed_ = true; have_completed_ = true;
platform_->OnCompleted(*error); platform_->OnCompleted(*error);
return; return;
} }
const std::vector<uint8_t>& response = const std::vector<uint8_t>& response =
absl::get<std::vector<uint8_t>>(result); std::get<std::vector<uint8_t>>(result);
if (response.empty()) { if (response.empty()) {
// Response is pending. // Response is pending.
return; return;
@ -715,7 +715,7 @@ class CTAP2Processor : public Transaction {
transport_->Write(PayloadType::kCTAP, std::move(response)); transport_->Write(PayloadType::kCTAP, std::move(response));
} }
absl::variant<std::vector<uint8_t>, Platform::Error> ProcessCTAPMessage( std::variant<std::vector<uint8_t>, Platform::Error> ProcessCTAPMessage(
base::span<const uint8_t> message_bytes) { base::span<const uint8_t> message_bytes) {
if (message_bytes.empty()) { if (message_bytes.empty()) {
return Platform::Error::INVALID_CTAP; return Platform::Error::INVALID_CTAP;
@ -1142,20 +1142,20 @@ class DigitalIdentityProcessor : public Transaction {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
CHECK(!have_completed_); CHECK(!have_completed_);
if (auto* error = absl::get_if<Platform::Error>(&update)) { if (auto* error = std::get_if<Platform::Error>(&update)) {
have_completed_ = true; have_completed_ = true;
platform_->OnCompleted(*error); platform_->OnCompleted(*error);
return; return;
} else if (auto* status = absl::get_if<Platform::Status>(&update)) { } else if (auto* status = std::get_if<Platform::Status>(&update)) {
platform_->OnStatus(*status); platform_->OnStatus(*status);
return; return;
} else if (absl::get_if<Transport::Disconnected>(&update)) { } else if (std::get_if<Transport::Disconnected>(&update)) {
have_completed_ = true; have_completed_ = true;
platform_->OnCompleted(std::nullopt); platform_->OnCompleted(std::nullopt);
return; return;
} }
auto& msg = absl::get<std::pair<PayloadType, std::vector<uint8_t>>>(update); auto& msg = std::get<std::pair<PayloadType, std::vector<uint8_t>>>(update);
if (msg.first != PayloadType::kJSON) { if (msg.first != PayloadType::kJSON) {
have_completed_ = true; have_completed_ = true;
platform_->OnCompleted(Platform::Error::INVALID_JSON); platform_->OnCompleted(Platform::Error::INVALID_JSON);

@ -9,6 +9,7 @@
#include <optional> #include <optional>
#include <string> #include <string>
#include <variant>
#include <vector> #include <vector>
#include "base/containers/span.h" #include "base/containers/span.h"
@ -16,7 +17,6 @@
#include "device/fido/cable/v2_constants.h" #include "device/fido/cable/v2_constants.h"
#include "device/fido/fido_constants.h" #include "device/fido/fido_constants.h"
#include "device/fido/network_context_factory.h" #include "device/fido/network_context_factory.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
#include "third_party/blink/public/mojom/webauthn/authenticator.mojom-forward.h" #include "third_party/blink/public/mojom/webauthn/authenticator.mojom-forward.h"
namespace device::cablev2::authenticator { namespace device::cablev2::authenticator {
@ -108,10 +108,10 @@ class Transport {
// report. The first element is a message from the peer. |Disconnected| is // report. The first element is a message from the peer. |Disconnected| is
// handled separately because it's context dependent whether that is an error // handled separately because it's context dependent whether that is an error
// or not. // or not.
using Update = absl::variant<std::pair<PayloadType, std::vector<uint8_t>>, using Update = std::variant<std::pair<PayloadType, std::vector<uint8_t>>,
Platform::Error, Platform::Error,
Platform::Status, Platform::Status,
Disconnected>; Disconnected>;
virtual ~Transport(); virtual ~Transport();
// StartReading requests that the given callback be called whenever a message // StartReading requests that the given callback be called whenever a message

@ -15,6 +15,7 @@
#include <array> #include <array>
#include <bit> #include <bit>
#include <type_traits> #include <type_traits>
#include <variant>
#include "base/base64url.h" #include "base/base64url.h"
#include "base/feature_list.h" #include "base/feature_list.h"
@ -581,7 +582,7 @@ void Derive(uint8_t* out,
} // namespace internal } // namespace internal
const char* RequestTypeToString(RequestType request_type) { const char* RequestTypeToString(RequestType request_type) {
return absl::visit( return std::visit(
base::Overloaded{[](const FidoRequestType& request_type) { base::Overloaded{[](const FidoRequestType& request_type) {
switch (request_type) { switch (request_type) {
case FidoRequestType::kMakeCredential: case FidoRequestType::kMakeCredential:
@ -680,7 +681,7 @@ std::optional<std::vector<uint8_t>> EncodePaddedCBORMap(
} }
bool ShouldOfferLinking(RequestType request_type) { bool ShouldOfferLinking(RequestType request_type) {
return absl::visit( return std::visit(
base::Overloaded{[](const FidoRequestType&) { base::Overloaded{[](const FidoRequestType&) {
return base::FeatureList::IsEnabled( return base::FeatureList::IsEnabled(
device::kWebAuthnHybridLinking); device::kWebAuthnHybridLinking);

@ -11,6 +11,7 @@
#include <memory> #include <memory>
#include <optional> #include <optional>
#include <string_view> #include <string_view>
#include <variant>
#include "base/component_export.h" #include "base/component_export.h"
#include "base/containers/span.h" #include "base/containers/span.h"
@ -19,7 +20,6 @@
#include "device/fido/cable/noise.h" #include "device/fido/cable/noise.h"
#include "device/fido/cable/v2_constants.h" #include "device/fido/cable/v2_constants.h"
#include "device/fido/fido_constants.h" #include "device/fido/fido_constants.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
#include "third_party/boringssl/src/include/openssl/base.h" #include "third_party/boringssl/src/include/openssl/base.h"
class GURL; class GURL;
@ -28,7 +28,7 @@ namespace device::cablev2 {
// The different types of digital credential requests. // The different types of digital credential requests.
enum CredentialRequestType { kPresentation, kIssuance }; enum CredentialRequestType { kPresentation, kIssuance };
using RequestType = absl::variant<FidoRequestType, CredentialRequestType>; using RequestType = std::variant<FidoRequestType, CredentialRequestType>;
namespace tunnelserver { namespace tunnelserver {
// ToKnownDomainID creates a KnownDomainID from a raw 16-bit value, or returns // ToKnownDomainID creates a KnownDomainID from a raw 16-bit value, or returns

@ -7,6 +7,7 @@
#include <algorithm> #include <algorithm>
#include <iterator> #include <iterator>
#include <utility> #include <utility>
#include <variant>
#include "base/functional/bind.h" #include "base/functional/bind.h"
#include "base/functional/callback.h" #include "base/functional/callback.h"
@ -23,7 +24,6 @@
#include "device/fido/enclave/types.h" #include "device/fido/enclave/types.h"
#include "device/fido/fido_parsing_utils.h" #include "device/fido/fido_parsing_utils.h"
#include "device/fido/public_key_credential_descriptor.h" #include "device/fido/public_key_credential_descriptor.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
namespace device::enclave { namespace device::enclave {
@ -342,8 +342,8 @@ void EnclaveAuthenticator::ProcessMakeCredentialResponse(
auto parse_result = ParseMakeCredentialResponse( auto parse_result = ParseMakeCredentialResponse(
std::move(response), pending_make_credential_request_->request, std::move(response), pending_make_credential_request_->request,
*ui_request_->key_version, ui_request_->up_and_uv_bits); *ui_request_->key_version, ui_request_->up_and_uv_bits);
if (absl::holds_alternative<ErrorResponse>(parse_result)) { if (std::holds_alternative<ErrorResponse>(parse_result)) {
auto& error_details = absl::get<ErrorResponse>(parse_result); auto& error_details = std::get<ErrorResponse>(parse_result);
ProcessErrorResponse(error_details); ProcessErrorResponse(error_details);
return; return;
} }
@ -353,8 +353,8 @@ void EnclaveAuthenticator::ProcessMakeCredentialResponse(
.Run(PINValidationResult::kSuccess); .Run(PINValidationResult::kSuccess);
} }
auto& success_result = auto& success_result =
absl::get<std::pair<AuthenticatorMakeCredentialResponse, std::get<std::pair<AuthenticatorMakeCredentialResponse,
sync_pb::WebauthnCredentialSpecifics>>(parse_result); sync_pb::WebauthnCredentialSpecifics>>(parse_result);
std::move(ui_request_->save_passkey_callback) std::move(ui_request_->save_passkey_callback)
.Run(std::move(success_result.second)); .Run(std::move(success_result.second));
RecordRequestResult("MakeCredential", EnclaveRequestResult::kSuccess); RecordRequestResult("MakeCredential", EnclaveRequestResult::kSuccess);
@ -391,8 +391,8 @@ void EnclaveAuthenticator::ProcessGetAssertionResponse(
const std::string& cred_id_str = ui_request_->entity->credential_id(); const std::string& cred_id_str = ui_request_->entity->credential_id();
auto parse_result = ParseGetAssertionResponse( auto parse_result = ParseGetAssertionResponse(
std::move(response), base::as_byte_span(cred_id_str)); std::move(response), base::as_byte_span(cred_id_str));
if (absl::holds_alternative<ErrorResponse>(parse_result)) { if (std::holds_alternative<ErrorResponse>(parse_result)) {
auto& error_details = absl::get<ErrorResponse>(parse_result); auto& error_details = std::get<ErrorResponse>(parse_result);
ProcessErrorResponse(error_details); ProcessErrorResponse(error_details);
return; return;
} }
@ -402,22 +402,22 @@ void EnclaveAuthenticator::ProcessGetAssertionResponse(
} }
std::vector<AuthenticatorGetAssertionResponse> responses; std::vector<AuthenticatorGetAssertionResponse> responses;
responses.emplace_back( responses.emplace_back(
std::move(absl::get<AuthenticatorGetAssertionResponse>(parse_result))); std::move(std::get<AuthenticatorGetAssertionResponse>(parse_result)));
RecordRequestResult("GetAssertion", EnclaveRequestResult::kSuccess); RecordRequestResult("GetAssertion", EnclaveRequestResult::kSuccess);
CompleteGetAssertionRequest(GetAssertionStatus::kSuccess, CompleteGetAssertionRequest(GetAssertionStatus::kSuccess,
std::move(responses)); std::move(responses));
} }
void EnclaveAuthenticator::CompleteRequestWithError( void EnclaveAuthenticator::CompleteRequestWithError(
absl::variant<GetAssertionStatus, MakeCredentialStatus> error) { std::variant<GetAssertionStatus, MakeCredentialStatus> error) {
if (absl::holds_alternative<GetAssertionStatus>(error)) { if (std::holds_alternative<GetAssertionStatus>(error)) {
CHECK(pending_get_assertion_request_); CHECK(pending_get_assertion_request_);
CompleteGetAssertionRequest(absl::get<GetAssertionStatus>(error), {}); CompleteGetAssertionRequest(std::get<GetAssertionStatus>(error), {});
return; return;
} }
CHECK(pending_make_credential_request_); CHECK(pending_make_credential_request_);
CompleteMakeCredentialRequest(absl::get<MakeCredentialStatus>(error), CompleteMakeCredentialRequest(std::get<MakeCredentialStatus>(error),
std::nullopt); std::nullopt);
} }

@ -10,6 +10,7 @@
#include <optional> #include <optional>
#include <string> #include <string>
#include <string_view> #include <string_view>
#include <variant>
#include <vector> #include <vector>
#include "base/component_export.h" #include "base/component_export.h"
@ -107,7 +108,7 @@ class COMPONENT_EXPORT(DEVICE_FIDO) EnclaveAuthenticator
// `Complete*` methods invoke callbacks that can result in `this` being // `Complete*` methods invoke callbacks that can result in `this` being
// destroyed, and so should only be called immediately before a return. // destroyed, and so should only be called immediately before a return.
void CompleteRequestWithError( void CompleteRequestWithError(
absl::variant<GetAssertionStatus, MakeCredentialStatus> error); std::variant<GetAssertionStatus, MakeCredentialStatus> error);
void CompleteMakeCredentialRequest( void CompleteMakeCredentialRequest(
MakeCredentialStatus status, MakeCredentialStatus status,
std::optional<AuthenticatorMakeCredentialResponse> response); std::optional<AuthenticatorMakeCredentialResponse> response);

@ -10,6 +10,7 @@
#include "device/fido/enclave/enclave_protocol_utils.h" #include "device/fido/enclave/enclave_protocol_utils.h"
#include <array> #include <array>
#include <variant>
#include "base/functional/callback.h" #include "base/functional/callback.h"
#include "base/json/json_reader.h" #include "base/json/json_reader.h"
@ -240,7 +241,7 @@ ErrorResponse::ErrorResponse(ErrorResponse&) = default;
ErrorResponse::ErrorResponse(ErrorResponse&&) = default; ErrorResponse::ErrorResponse(ErrorResponse&&) = default;
absl::variant<AuthenticatorGetAssertionResponse, ErrorResponse> std::variant<AuthenticatorGetAssertionResponse, ErrorResponse>
ParseGetAssertionResponse(cbor::Value response_value, ParseGetAssertionResponse(cbor::Value response_value,
base::span<const uint8_t> credential_id) { base::span<const uint8_t> credential_id) {
if (!response_value.is_array() || response_value.GetArray().empty()) { if (!response_value.is_array() || response_value.GetArray().empty()) {
@ -312,9 +313,9 @@ ParseGetAssertionResponse(cbor::Value response_value,
return std::move(*response); return std::move(*response);
} }
absl::variant<std::pair<AuthenticatorMakeCredentialResponse, std::variant<std::pair<AuthenticatorMakeCredentialResponse,
sync_pb::WebauthnCredentialSpecifics>, sync_pb::WebauthnCredentialSpecifics>,
ErrorResponse> ErrorResponse>
ParseMakeCredentialResponse(cbor::Value response_value, ParseMakeCredentialResponse(cbor::Value response_value,
const CtapMakeCredentialRequest& request, const CtapMakeCredentialRequest& request,
int32_t wrapped_secret_version, int32_t wrapped_secret_version,

@ -8,6 +8,7 @@
#include <optional> #include <optional>
#include <string> #include <string>
#include <utility> #include <utility>
#include <variant>
#include <vector> #include <vector>
#include "base/component_export.h" #include "base/component_export.h"
@ -19,7 +20,6 @@
#include "device/fido/ctap_get_assertion_request.h" #include "device/fido/ctap_get_assertion_request.h"
#include "device/fido/ctap_make_credential_request.h" #include "device/fido/ctap_make_credential_request.h"
#include "device/fido/enclave/types.h" #include "device/fido/enclave/types.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
namespace sync_pb { namespace sync_pb {
class WebauthnCredentialSpecifics; class WebauthnCredentialSpecifics;
@ -63,19 +63,19 @@ struct COMPONENT_EXPORT(DEVICE_FIDO) ErrorResponse {
// one is for the GetAssertion. // one is for the GetAssertion.
// Returns one of: A successful response, or a struct containing details of // Returns one of: A successful response, or a struct containing details of
// the error. // the error.
absl::variant<AuthenticatorGetAssertionResponse, ErrorResponse> std::variant<AuthenticatorGetAssertionResponse, ErrorResponse> COMPONENT_EXPORT(
COMPONENT_EXPORT(DEVICE_FIDO) DEVICE_FIDO)
ParseGetAssertionResponse(cbor::Value response_value, ParseGetAssertionResponse(cbor::Value response_value,
base::span<const uint8_t> credential_id); base::span<const uint8_t> credential_id);
// Parses a decrypted registration command response from the enclave. // Parses a decrypted registration command response from the enclave.
// If there are multiple request responses in the array, it assumes the last // If there are multiple request responses in the array, it assumes the last
// one is for the MakeCredential. // one is for the MakeCredential.
// Returns one of: A pair containing the response and the new passkey entity, // Returns one of: A pair containing the response and the new passkey entity,
// a struct containing details of the error. // a struct containing details of the error.
absl::variant<std::pair<AuthenticatorMakeCredentialResponse, std::variant<std::pair<AuthenticatorMakeCredentialResponse,
sync_pb::WebauthnCredentialSpecifics>, sync_pb::WebauthnCredentialSpecifics>,
ErrorResponse> ErrorResponse>
COMPONENT_EXPORT(DEVICE_FIDO) COMPONENT_EXPORT(DEVICE_FIDO)
ParseMakeCredentialResponse(cbor::Value response, ParseMakeCredentialResponse(cbor::Value response,
const CtapMakeCredentialRequest& request, const CtapMakeCredentialRequest& request,

@ -6,6 +6,7 @@
#include <optional> #include <optional>
#include <string> #include <string>
#include <variant>
#include <vector> #include <vector>
#include "base/containers/span.h" #include "base/containers/span.h"
@ -28,7 +29,6 @@
#include "device/fido/public_key_credential_user_entity.h" #include "device/fido/public_key_credential_user_entity.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
namespace device { namespace device {
namespace { namespace {
@ -401,9 +401,9 @@ TEST_F(EnclaveProtocolUtilsTest, ParseGetAssertionResponse_Success) {
auto parse_result = auto parse_result =
ParseGetAssertionResponse(std::move(response_cbor), cred_id); ParseGetAssertionResponse(std::move(response_cbor), cred_id);
EXPECT_TRUE( EXPECT_TRUE(
absl::holds_alternative<AuthenticatorGetAssertionResponse>(parse_result)); std::holds_alternative<AuthenticatorGetAssertionResponse>(parse_result));
const auto& assertion_response = const auto& assertion_response =
absl::get<AuthenticatorGetAssertionResponse>(parse_result); std::get<AuthenticatorGetAssertionResponse>(parse_result);
EXPECT_EQ(assertion_response.user_entity->id, EXPECT_EQ(assertion_response.user_entity->id,
std::vector<uint8_t>({'a', 'b'})); std::vector<uint8_t>({'a', 'b'}));
EXPECT_EQ(assertion_response.credential->id, std::vector<uint8_t>({0, 1, 2})); EXPECT_EQ(assertion_response.credential->id, std::vector<uint8_t>({0, 1, 2}));
@ -418,8 +418,8 @@ TEST_F(EnclaveProtocolUtilsTest, ParseGetAssertionResponse_Failures) {
std::vector<uint8_t> cred_id = {0, 1, 2}; std::vector<uint8_t> cred_id = {0, 1, 2};
auto parse_result = auto parse_result =
ParseGetAssertionResponse(std::move(response_cbor), cred_id); ParseGetAssertionResponse(std::move(response_cbor), cred_id);
EXPECT_TRUE(absl::holds_alternative<ErrorResponse>(parse_result) && EXPECT_TRUE(std::holds_alternative<ErrorResponse>(parse_result) &&
absl::get<ErrorResponse>(parse_result).error_string.has_value()) std::get<ErrorResponse>(parse_result).error_string.has_value())
<< "Failed GetAssertion response parsing for: " << test_case.name; << "Failed GetAssertion response parsing for: " << test_case.name;
} }
} }
@ -439,12 +439,12 @@ TEST_F(EnclaveProtocolUtilsTest, ParseMakeCredentialResponse_Success) {
std::move(response_cbor), ctap_request, kWrappedSecretVersion, std::move(response_cbor), ctap_request, kWrappedSecretVersion,
UserPresentAndVerifiedBits::kPresentAndVerified); UserPresentAndVerifiedBits::kPresentAndVerified);
EXPECT_TRUE( EXPECT_TRUE(
(absl::holds_alternative<std::pair<AuthenticatorMakeCredentialResponse, (std::holds_alternative<std::pair<AuthenticatorMakeCredentialResponse,
sync_pb::WebauthnCredentialSpecifics>>( sync_pb::WebauthnCredentialSpecifics>>(
parse_result))); parse_result)));
const auto& entity = const auto& entity =
absl::get<std::pair<AuthenticatorMakeCredentialResponse, std::get<std::pair<AuthenticatorMakeCredentialResponse,
sync_pb::WebauthnCredentialSpecifics>>(parse_result) sync_pb::WebauthnCredentialSpecifics>>(parse_result)
.second; .second;
EXPECT_EQ(entity.rp_id(), std::string(kRpId)); EXPECT_EQ(entity.rp_id(), std::string(kRpId));
EXPECT_EQ(entity.user_id(), std::string(user_id().begin(), user_id().end())); EXPECT_EQ(entity.user_id(), std::string(user_id().begin(), user_id().end()));
@ -453,8 +453,8 @@ TEST_F(EnclaveProtocolUtilsTest, ParseMakeCredentialResponse_Success) {
encrypted_passkey().end())); encrypted_passkey().end()));
const auto& register_response = const auto& register_response =
absl::get<std::pair<AuthenticatorMakeCredentialResponse, std::get<std::pair<AuthenticatorMakeCredentialResponse,
sync_pb::WebauthnCredentialSpecifics>>(parse_result) sync_pb::WebauthnCredentialSpecifics>>(parse_result)
.first; .first;
auto response_cred_id = auto response_cred_id =
register_response.attestation_object.authenticator_data() register_response.attestation_object.authenticator_data()
@ -489,12 +489,12 @@ TEST_F(EnclaveProtocolUtilsTest,
std::move(response_cbor), ctap_request, kWrappedSecretVersion, std::move(response_cbor), ctap_request, kWrappedSecretVersion,
UserPresentAndVerifiedBits::kNeither); UserPresentAndVerifiedBits::kNeither);
EXPECT_TRUE( EXPECT_TRUE(
(absl::holds_alternative<std::pair<AuthenticatorMakeCredentialResponse, (std::holds_alternative<std::pair<AuthenticatorMakeCredentialResponse,
sync_pb::WebauthnCredentialSpecifics>>( sync_pb::WebauthnCredentialSpecifics>>(
parse_result))); parse_result)));
const auto& register_response = const auto& register_response =
absl::get<std::pair<AuthenticatorMakeCredentialResponse, std::get<std::pair<AuthenticatorMakeCredentialResponse,
sync_pb::WebauthnCredentialSpecifics>>(parse_result) sync_pb::WebauthnCredentialSpecifics>>(parse_result)
.first; .first;
EXPECT_FALSE(register_response.attestation_object.authenticator_data() EXPECT_FALSE(register_response.attestation_object.authenticator_data()
.obtained_user_presence()); .obtained_user_presence());
@ -516,8 +516,8 @@ TEST_F(EnclaveProtocolUtilsTest, ParseMakeCredentialResponse_StringFailures) {
auto parse_result = ParseMakeCredentialResponse( auto parse_result = ParseMakeCredentialResponse(
std::move(response_cbor), ctap_request, kWrappedSecretVersion, std::move(response_cbor), ctap_request, kWrappedSecretVersion,
UserPresentAndVerifiedBits::kPresentOnly); UserPresentAndVerifiedBits::kPresentOnly);
EXPECT_TRUE(absl::holds_alternative<ErrorResponse>(parse_result) && EXPECT_TRUE(std::holds_alternative<ErrorResponse>(parse_result) &&
absl::get<ErrorResponse>(parse_result).error_string.has_value()) std::get<ErrorResponse>(parse_result).error_string.has_value())
<< "Failed MakeCredential response parsing for: " << test_case.name; << "Failed MakeCredential response parsing for: " << test_case.name;
} }
} }
@ -530,9 +530,9 @@ TEST_F(EnclaveProtocolUtilsTest, ParseGetAssertionResponse_IntegerFailure) {
auto parse_result = auto parse_result =
ParseGetAssertionResponse(std::move(response_cbor), cred_id); ParseGetAssertionResponse(std::move(response_cbor), cred_id);
EXPECT_TRUE(absl::holds_alternative<ErrorResponse>(parse_result)); EXPECT_TRUE(std::holds_alternative<ErrorResponse>(parse_result));
EXPECT_TRUE(absl::get<ErrorResponse>(parse_result).error_code.has_value()); EXPECT_TRUE(std::get<ErrorResponse>(parse_result).error_code.has_value());
EXPECT_EQ(*absl::get<ErrorResponse>(parse_result).error_code, 2); EXPECT_EQ(*std::get<ErrorResponse>(parse_result).error_code, 2);
} }
TEST_F(EnclaveProtocolUtilsTest, ParseMakeCredentialResponse_IntegerFailure) { TEST_F(EnclaveProtocolUtilsTest, ParseMakeCredentialResponse_IntegerFailure) {
@ -549,9 +549,9 @@ TEST_F(EnclaveProtocolUtilsTest, ParseMakeCredentialResponse_IntegerFailure) {
std::move(response_cbor), ctap_request, kWrappedSecretVersion, std::move(response_cbor), ctap_request, kWrappedSecretVersion,
UserPresentAndVerifiedBits::kPresentOnly); UserPresentAndVerifiedBits::kPresentOnly);
EXPECT_TRUE(absl::holds_alternative<ErrorResponse>(parse_result)); EXPECT_TRUE(std::holds_alternative<ErrorResponse>(parse_result));
EXPECT_TRUE(absl::get<ErrorResponse>(parse_result).error_code.has_value()); EXPECT_TRUE(std::get<ErrorResponse>(parse_result).error_code.has_value());
EXPECT_EQ(*absl::get<ErrorResponse>(parse_result).error_code, 2); EXPECT_EQ(*std::get<ErrorResponse>(parse_result).error_code, 2);
} }
} // namespace enclave } // namespace enclave

@ -5,8 +5,10 @@
#include "device/vr/android/cardboard/cardboard_device_params.h" #include "device/vr/android/cardboard/cardboard_device_params.h"
#include <stdint.h> #include <stdint.h>
#include <cstdint> #include <cstdint>
#include <utility> #include <utility>
#include <variant>
#include "base/notreached.h" #include "base/notreached.h"
#include "third_party/cardboard/src/sdk/include/cardboard.h" #include "third_party/cardboard/src/sdk/include/cardboard.h"
@ -98,11 +100,11 @@ bool CardboardDeviceParams::IsValid() {
} }
const uint8_t* CardboardDeviceParams::encoded_device_params() { const uint8_t* CardboardDeviceParams::encoded_device_params() {
if (absl::holds_alternative<uint8_t*>(encoded_device_params_)) { if (std::holds_alternative<uint8_t*>(encoded_device_params_)) {
return absl::get<uint8_t*>(encoded_device_params_); return std::get<uint8_t*>(encoded_device_params_);
} else if (absl::holds_alternative<OwnedCardboardParams>( } else if (std::holds_alternative<OwnedCardboardParams>(
encoded_device_params_)) { encoded_device_params_)) {
return absl::get<OwnedCardboardParams>(encoded_device_params_).get(); return std::get<OwnedCardboardParams>(encoded_device_params_).get();
} }
NOTREACHED(); NOTREACHED();

@ -7,10 +7,10 @@
#include <stdint.h> #include <stdint.h>
#include "device/vr/android/cardboard/scoped_cardboard_objects.h" #include <variant>
#include "third_party/abseil-cpp/absl/types/variant.h"
#include "base/component_export.h" #include "base/component_export.h"
#include "device/vr/android/cardboard/scoped_cardboard_objects.h"
namespace device { namespace device {
@ -53,8 +53,7 @@ class COMPONENT_EXPORT(VR_CARDBOARD) CardboardDeviceParams {
// launched. Meant to be used for testing purposes only. // launched. Meant to be used for testing purposes only.
static bool use_cardboard_v1_device_params_for_testing_; static bool use_cardboard_v1_device_params_for_testing_;
absl::variant<uint8_t*, OwnedCardboardParams> encoded_device_params_ = std::variant<uint8_t*, OwnedCardboardParams> encoded_device_params_ = nullptr;
nullptr;
int size_ = 0; int size_ = 0;
}; };