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

Unified 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 side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698