| Index: mojo/common/common_custom_types_struct_traits.cc
|
| diff --git a/mojo/common/common_custom_types_struct_traits.cc b/mojo/common/common_custom_types_struct_traits.cc
|
| index 91fc9524d2b3b14a4ef788c7f6dc8f03e0db1947..21026d4d78e9ce3d6486d4435d9b74f3057ae05c 100644
|
| --- a/mojo/common/common_custom_types_struct_traits.cc
|
| +++ b/mojo/common/common_custom_types_struct_traits.cc
|
| @@ -27,4 +27,20 @@ bool StructTraits<mojo::common::mojom::VersionDataView, base::Version>::Read(
|
| return out->IsValid();
|
| }
|
|
|
| +// static
|
| +bool StructTraits<mojo::common::mojom::UnguessableTokenDataView,
|
| + base::UnguessableToken>::
|
| + Read(mojo::common::mojom::UnguessableTokenDataView data,
|
| + base::UnguessableToken* out) {
|
| + uint64_t high = data.high();
|
| + uint64_t low = data.low();
|
| +
|
| + // Receiving a zeroed UnguessableToken is a security issue.
|
| + if (high == 0 && low == 0)
|
| + return false;
|
| +
|
| + *out = base::UnguessableToken::Deserialize(high, low);
|
| + return true;
|
| +}
|
| +
|
| } // namespace mojo
|
|
|