OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_DNS_MOJO_HOST_STRUCT_TRAITS_H_ | 5 #ifndef NET_DNS_MOJO_HOST_STRUCT_TRAITS_H_ |
6 #define NET_DNS_MOJO_HOST_STRUCT_TRAITS_H_ | 6 #define NET_DNS_MOJO_HOST_STRUCT_TRAITS_H_ |
7 | 7 |
8 #include "base/strings/string_piece.h" | 8 #include "base/strings/string_piece.h" |
9 #include "mojo/public/cpp/bindings/enum_traits.h" | 9 #include "mojo/public/cpp/bindings/enum_traits.h" |
10 #include "mojo/public/cpp/bindings/struct_traits.h" | 10 #include "mojo/public/cpp/bindings/struct_traits.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 const std::unique_ptr<net::HostResolver::RequestInfo>& obj) { | 43 const std::unique_ptr<net::HostResolver::RequestInfo>& obj) { |
44 return obj->is_my_ip_address(); | 44 return obj->is_my_ip_address(); |
45 } | 45 } |
46 | 46 |
47 static bool Read(net::interfaces::HostResolverRequestInfoDataView obj, | 47 static bool Read(net::interfaces::HostResolverRequestInfoDataView obj, |
48 std::unique_ptr<net::HostResolver::RequestInfo>* output); | 48 std::unique_ptr<net::HostResolver::RequestInfo>* output); |
49 }; | 49 }; |
50 | 50 |
51 template <> | 51 template <> |
52 struct StructTraits<net::interfaces::IPEndPointDataView, net::IPEndPoint> { | 52 struct StructTraits<net::interfaces::IPEndPointDataView, net::IPEndPoint> { |
53 static const std::vector<uint8_t>& address(const net::IPEndPoint& obj) { | 53 static const std::vector<uint8_t> address(const net::IPEndPoint& obj) { |
54 return obj.address().bytes(); | 54 return obj.address().BytesAsVector(); |
55 } | 55 } |
56 static uint16_t port(const net::IPEndPoint& obj) { return obj.port(); } | 56 static uint16_t port(const net::IPEndPoint& obj) { return obj.port(); } |
57 | 57 |
58 static bool Read(net::interfaces::IPEndPointDataView obj, | 58 static bool Read(net::interfaces::IPEndPointDataView obj, |
59 net::IPEndPoint* out); | 59 net::IPEndPoint* out); |
60 }; | 60 }; |
61 | 61 |
62 template <> | 62 template <> |
63 struct StructTraits<net::interfaces::AddressListDataView, net::AddressList> { | 63 struct StructTraits<net::interfaces::AddressListDataView, net::AddressList> { |
64 static std::vector<net::IPEndPoint> addresses(const net::AddressList& obj) { | 64 static std::vector<net::IPEndPoint> addresses(const net::AddressList& obj) { |
65 return obj.endpoints(); | 65 return obj.endpoints(); |
66 } | 66 } |
67 | 67 |
68 static bool Read(net::interfaces::AddressListDataView data, | 68 static bool Read(net::interfaces::AddressListDataView data, |
69 net::AddressList* out); | 69 net::AddressList* out); |
70 }; | 70 }; |
71 | 71 |
72 } // namespace mojo | 72 } // namespace mojo |
73 | 73 |
74 #endif // NET_DNS_MOJO_HOST_STRUCT_TRAITS_H_ | 74 #endif // NET_DNS_MOJO_HOST_STRUCT_TRAITS_H_ |
OLD | NEW |