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

Side by Side Diff: net/base/mojo/net_base_struct_traits.h

Issue 2063683002: Migrate components/data_reduction_proxy to Mojo interfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Eliminate usage of RPH observer Created 4 years, 4 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef NET_BASE_MOJO_NET_BASE_STRUCT_TRAITS_H_
6 #define NET_BASE_MOJO_NET_BASE_STRUCT_TRAITS_H_
7
8 #include <string>
9
10 #include "net/base/host_port_pair.h"
11
12 namespace mojo {
13
14 template <>
15 struct StructTraits<net::mojom::HostPortPair, net::HostPortPair> {
16 static const std::string& host(const net::HostPortPair& r) {
17 return r.host();
18 }
19 static uint16_t port(const net::HostPortPair& r) { return r.port(); }
20 static bool Read(net::mojom::HostPortPairDataView data,
21 net::HostPortPair* out) {
22 std::string host;
23 if (!data.ReadHost(&host))
24 return false;
25 out->set_host(host);
26
27 out->set_port(data.port());
28 return true;
29 }
30 };
31
32 } // namespace mojo
33
34 #endif // NET_BASE_MOJO_NET_BASE_STRUCT_TRAITS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698