Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(381)

Side by Side Diff: net/dns/mojo_host_struct_traits.cc

Issue 2675033002: [Media Router] Add MediaSink subtypes (Closed)
Patch Set: resolve code review comments from dcheng Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "net/dns/mojo_host_struct_traits.h" 5 #include "net/dns/mojo_host_struct_traits.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "net/base/address_list.h" 10 #include "net/base/address_list.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 *out = base::MakeUnique<net::HostResolver::RequestInfo>( 63 *out = base::MakeUnique<net::HostResolver::RequestInfo>(
64 net::HostPortPair(host.as_string(), data.port())); 64 net::HostPortPair(host.as_string(), data.port()));
65 net::HostResolver::RequestInfo& request = **out; 65 net::HostResolver::RequestInfo& request = **out;
66 request.set_address_family(address_family); 66 request.set_address_family(address_family);
67 request.set_is_my_ip_address(data.is_my_ip_address()); 67 request.set_is_my_ip_address(data.is_my_ip_address());
68 return true; 68 return true;
69 } 69 }
70 70
71 // static 71 // static
72 bool StructTraits<net::interfaces::IPAddressDataView, net::IPAddress>::Read(
73 net::interfaces::IPAddressDataView data,
74 net::IPAddress* out) {
75 std::vector<uint8_t> bytes;
76 if (!data.ReadAddress(&bytes))
77 return false;
78
79 *out = net::IPAddress(bytes);
80 return true;
81 }
82
83 // static
72 bool StructTraits<net::interfaces::IPEndPointDataView, net::IPEndPoint>::Read( 84 bool StructTraits<net::interfaces::IPEndPointDataView, net::IPEndPoint>::Read(
73 net::interfaces::IPEndPointDataView data, 85 net::interfaces::IPEndPointDataView data,
74 net::IPEndPoint* out) { 86 net::IPEndPoint* out) {
75 std::vector<uint8_t> bytes; 87 std::vector<uint8_t> bytes;
76 if (!data.ReadAddress(&bytes)) 88 if (!data.ReadAddress(&bytes))
77 return false; 89 return false;
78 90
79 *out = net::IPEndPoint(net::IPAddress(bytes), data.port()); 91 *out = net::IPEndPoint(net::IPAddress(bytes), data.port());
80 return true; 92 return true;
81 } 93 }
82 94
83 // static 95 // static
84 bool StructTraits<net::interfaces::AddressListDataView, net::AddressList>::Read( 96 bool StructTraits<net::interfaces::AddressListDataView, net::AddressList>::Read(
85 net::interfaces::AddressListDataView data, 97 net::interfaces::AddressListDataView data,
86 net::AddressList* out) { 98 net::AddressList* out) {
87 return data.ReadAddresses(&out->endpoints()); 99 return data.ReadAddresses(&out->endpoints());
88 } 100 }
89 101
90 } // namespace mojo 102 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698