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

Side by Side Diff: chrome/browser/chromeos/proxy_cros_settings_parser.cc

Issue 11737038: Fix proxy settings so that a port number in the host field gets applied to the port field. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « AUTHORS ('k') | chrome/browser/resources/options/chromeos/internet_detail.js » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/proxy_cros_settings_parser.h" 5 #include "chrome/browser/chromeos/proxy_cros_settings_parser.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/chromeos/proxy_config_service_impl.h" 9 #include "chrome/browser/chromeos/proxy_config_service_impl.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 uint16 default_port = net::ProxyServer::GetDefaultPortForScheme(scheme); 75 uint16 default_port = net::ProxyServer::GetDefaultPortForScheme(scheme);
76 net::HostPortPair host_port_pair; 76 net::HostPortPair host_port_pair;
77 // Check if host is a valid URL or a string of valid format <server>::<port>. 77 // Check if host is a valid URL or a string of valid format <server>::<port>.
78 GURL url(host); 78 GURL url(host);
79 if (url.is_valid()) // See if host is URL. 79 if (url.is_valid()) // See if host is URL.
80 host_port_pair = net::HostPortPair::FromURL(url); 80 host_port_pair = net::HostPortPair::FromURL(url);
81 if (host_port_pair.host().empty()) // See if host is <server>::<port>. 81 if (host_port_pair.host().empty()) // See if host is <server>::<port>.
82 host_port_pair = net::HostPortPair::FromString(host); 82 host_port_pair = net::HostPortPair::FromString(host);
83 if (host_port_pair.host().empty()) // Host is not URL or <server>::<port>. 83 if (host_port_pair.host().empty()) // Host is not URL or <server>::<port>.
84 host_port_pair = net::HostPortPair(host, port); 84 host_port_pair = net::HostPortPair(host, port);
85 // Formal parameter port overrides what may have been specified in host. 85 if (host_port_pair.port() == 0) // No port in host, use default.
86 if (port != 0 && port != default_port)
87 host_port_pair.set_port(port);
88 else if (host_port_pair.port() == 0) // No port in host, use default.
89 host_port_pair.set_port(default_port); 86 host_port_pair.set_port(default_port);
90 return net::ProxyServer(scheme, host_port_pair); 87 return net::ProxyServer(scheme, host_port_pair);
91 } 88 }
92 89
93 net::ProxyServer CreateProxyServerFromHost( 90 net::ProxyServer CreateProxyServerFromHost(
94 const std::string& host, 91 const std::string& host,
95 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy, 92 const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy,
96 net::ProxyServer::Scheme scheme) { 93 net::ProxyServer::Scheme scheme) {
97 uint16 port = 0; 94 uint16 port = 0;
98 if (proxy.server.is_valid()) 95 if (proxy.server.is_valid())
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 } else { 372 } else {
376 dict->SetBoolean("disabled", false); 373 dict->SetBoolean("disabled", false);
377 } 374 }
378 *out_value = dict; 375 *out_value = dict;
379 return true; 376 return true;
380 } 377 }
381 378
382 } // namespace proxy_cros_settings_parser 379 } // namespace proxy_cros_settings_parser
383 380
384 } // namespace chromeos 381 } // namespace chromeos
OLDNEW
« no previous file with comments | « AUTHORS ('k') | chrome/browser/resources/options/chromeos/internet_detail.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698