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

Side by Side Diff: net/proxy/mojo_type_converters.cc

Issue 917863005: Implementation of ProxyResolver that uses a Mojo service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sam-v8-pac-utility-proxy
Patch Set: Rebase Created 5 years, 10 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/proxy/mojo_type_converters.h" 5 #include "net/proxy/mojo_type_converters.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "net/base/host_port_pair.h" 8 #include "net/base/host_port_pair.h"
9 #include "net/proxy/proxy_info.h"
9 #include "net/proxy/proxy_server.h" 10 #include "net/proxy/proxy_server.h"
10 11
11 namespace net { 12 namespace net {
12 namespace { 13 namespace {
13 14
14 interfaces::ProxyScheme ProxySchemeToMojo(ProxyServer::Scheme scheme) { 15 interfaces::ProxyScheme ProxySchemeToMojo(ProxyServer::Scheme scheme) {
15 switch (scheme) { 16 switch (scheme) {
16 case ProxyServer::SCHEME_INVALID: 17 case ProxyServer::SCHEME_INVALID:
17 return interfaces::PROXY_SCHEME_INVALID; 18 return interfaces::PROXY_SCHEME_INVALID;
18 case ProxyServer::SCHEME_DIRECT: 19 case ProxyServer::SCHEME_DIRECT:
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 } 70 }
70 71
71 // static 72 // static
72 net::ProxyServer 73 net::ProxyServer
73 TypeConverter<net::ProxyServer, net::interfaces::ProxyServerPtr>::Convert( 74 TypeConverter<net::ProxyServer, net::interfaces::ProxyServerPtr>::Convert(
74 const net::interfaces::ProxyServerPtr& obj) { 75 const net::interfaces::ProxyServerPtr& obj) {
75 return net::ProxyServer(net::ProxySchemeFromMojo(obj->scheme), 76 return net::ProxyServer(net::ProxySchemeFromMojo(obj->scheme),
76 net::HostPortPair(obj->host, obj->port)); 77 net::HostPortPair(obj->host, obj->port));
77 } 78 }
78 79
80 // static
81 net::ProxyInfo
82 TypeConverter<net::ProxyInfo, mojo::Array<net::interfaces::ProxyServerPtr>>::
83 Convert(const mojo::Array<net::interfaces::ProxyServerPtr>& obj) {
84 net::ProxyList proxy_list;
85 for (size_t i = 0; i < obj.size(); i++) {
86 proxy_list.AddProxyServer(obj[i].To<net::ProxyServer>());
87 }
88 net::ProxyInfo info;
89 info.UseProxyList(proxy_list);
90 return info;
91 }
92
79 } // namespace mojo 93 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698