| Index: net/base/mojo/net_base_struct_traits.h
|
| diff --git a/net/base/mojo/net_base_struct_traits.h b/net/base/mojo/net_base_struct_traits.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..2450c60077f9ddf3b181e7a58b5ffed07616881b
|
| --- /dev/null
|
| +++ b/net/base/mojo/net_base_struct_traits.h
|
| @@ -0,0 +1,34 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef NET_BASE_MOJO_NET_BASE_STRUCT_TRAITS_H_
|
| +#define NET_BASE_MOJO_NET_BASE_STRUCT_TRAITS_H_
|
| +
|
| +#include <string>
|
| +
|
| +#include "net/base/host_port_pair.h"
|
| +
|
| +namespace mojo {
|
| +
|
| +template <>
|
| +struct StructTraits<net::mojom::HostPortPair, net::HostPortPair> {
|
| + static const std::string& host(const net::HostPortPair& r) {
|
| + return r.host();
|
| + }
|
| + static uint16_t port(const net::HostPortPair& r) { return r.port(); }
|
| + static bool Read(net::mojom::HostPortPairDataView data,
|
| + net::HostPortPair* out) {
|
| + std::string host;
|
| + if (!data.ReadHost(&host))
|
| + return false;
|
| + out->set_host(host);
|
| +
|
| + out->set_port(data.port());
|
| + return true;
|
| + }
|
| +};
|
| +
|
| +} // namespace mojo
|
| +
|
| +#endif // NET_BASE_MOJO_NET_BASE_STRUCT_TRAITS_H_
|
|
|