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

Side by Side Diff: net/proxy/mojo_proxy_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: Fix build. Created 5 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
« no previous file with comments | « net/proxy/mojo_proxy_type_converters.h ('k') | net/proxy/proxy_resolver_mojo.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_proxy_type_converters.h" 5 #include "net/proxy/mojo_proxy_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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 } 74 }
74 75
75 // static 76 // static
76 net::ProxyServer 77 net::ProxyServer
77 TypeConverter<net::ProxyServer, net::interfaces::ProxyServerPtr>::Convert( 78 TypeConverter<net::ProxyServer, net::interfaces::ProxyServerPtr>::Convert(
78 const net::interfaces::ProxyServerPtr& obj) { 79 const net::interfaces::ProxyServerPtr& obj) {
79 return net::ProxyServer(net::ProxySchemeFromMojo(obj->scheme), 80 return net::ProxyServer(net::ProxySchemeFromMojo(obj->scheme),
80 net::HostPortPair(obj->host, obj->port)); 81 net::HostPortPair(obj->host, obj->port));
81 } 82 }
82 83
84 // static
85 net::ProxyInfo
86 TypeConverter<net::ProxyInfo, mojo::Array<net::interfaces::ProxyServerPtr>>::
87 Convert(const mojo::Array<net::interfaces::ProxyServerPtr>& obj) {
88 net::ProxyList proxy_list;
89 for (size_t i = 0; i < obj.size(); i++) {
90 proxy_list.AddProxyServer(obj[i].To<net::ProxyServer>());
91 }
92 net::ProxyInfo info;
93 info.UseProxyList(proxy_list);
94 return info;
95 }
96
83 } // namespace mojo 97 } // namespace mojo
OLDNEW
« no previous file with comments | « net/proxy/mojo_proxy_type_converters.h ('k') | net/proxy/proxy_resolver_mojo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698