The overall approach is good, but I would like some details cleaned up
before
approving.
https://codereview.chromium.org/12315019/diff/1/net/proxy/proxy_config.cc
File net/proxy/proxy_config.cc (right):
https://codereview.chromium.org/12315019/diff/1/net/proxy/proxy_config.cc#newcode17
net/proxy/proxy_config.cc:17: // If |proxy| is valid, sets it in |dict|
under the key |name|.
"is valid" needs to be updated.
https://codereview.chromium.org/12315019/diff/1/net/proxy/proxy_config.cc#newcode18
net/proxy/proxy_config.cc:18: void AddProxyToValue(const char* name,
This should be renamed to AddProxyListToValue()
https://codereview.chromium.org/12315019/diff/1/net/proxy/proxy_config.cc#newcode29
net/proxy/proxy_config.cc:29: type(TYPE_NO_RULES){
Why remove the space? That is counter to the style AFAIK.
https://codereview.chromium.org/12315019/diff/1/net/proxy/proxy_config.cc#newcode51
net/proxy/proxy_config.cc:51:
result->UsePacString(single_proxy.ToPacString());
Rather than round-tripping through the PAC string format, this should
just set the values directly.
Perhaps add a method like:
result->UseProxyList(single_proxy);
https://codereview.chromium.org/12315019/diff/1/net/proxy/proxy_config.cc#newcode57
net/proxy/proxy_config.cc:57:
result->UsePacString(entry->ToPacString());
See comment above.
https://codereview.chromium.org/12315019/diff/1/net/proxy/proxy_config.cc#newcode117
net/proxy/proxy_config.cc:117: // 'socks' maps to SOCKS5 in
ProxyServer::GetSchemeFromURIInternal.
Yeah, icky carry-over from the windows interpretation of this string
(which is where the format comes from). It is convenient having a
cross-platform implementation for the purpose of command line flags, but
maybe it doesn't make sense and we should invent our own for that.
https://codereview.chromium.org/12315019/diff/1/net/proxy/proxy_config.cc#newcode124
net/proxy/proxy_config.cc:124: // Don't have DIRECT as the first proxy
in a list.
Why disallow this?
https://codereview.chromium.org/12315019/diff/1/net/proxy/proxy_config.h
File net/proxy/proxy_config.h (right):
https://codereview.chromium.org/12315019/diff/1/net/proxy/proxy_config.h#newcode56
net/proxy/proxy_config.h:56: // Sets |result| with the proxy to use for
|url| based on the current rules.
update: proxy --> proxies
https://codereview.chromium.org/12315019/diff/1/net/proxy/proxy_config.h#newcode72
net/proxy/proxy_config.h:72: // that 'socks' server added.
What about instead changing the grammar from:
url-scheme"="proxy-uri
to:
url-scheme"="proxy-uri-list
where proxy-uri-list is a COMMA separated list of proxy-uri.
Do you really care about this string form (i.e. do you plan on setting
things this way), or can you just access it programmatically for your
purposes.
(the particular grammar here is rather awkward/fragile, and forms the
basis of shared code with a platform-specific settings parser. it was
extracted more for convenience to re-use from command-line flags).
https://codereview.chromium.org/12315019/diff/1/net/proxy/proxy_config.h#newcode109
net/proxy/proxy_config.h:109: ProxyList single_proxy;
These names are no longer good, since they are actually proxy lists. At
a minimum please add a TODO to rename these.
https://codereview.chromium.org/12315019/diff/1/net/proxy/proxy_config.h#newcode116
net/proxy/proxy_config.h:116: // Used when a fallback (a socks= scheme)
has been defined and the
I don't think this comment should mention socks= here. That is a concept
of the serialization format (ParseFromString), which honestly doesn't
make much sense, but is the format inherited from the Windows settings.
https://codereview.chromium.org/12315019/diff/1/net/proxy/proxy_config_service_common_unittest.cc
File net/proxy/proxy_config_service_common_unittest.cc (right):
https://codereview.chromium.org/12315019/diff/1/net/proxy/proxy_config_service_common_unittest.cc#newcode84
net/proxy/proxy_config_service_common_unittest.cc:84:
rules.single_proxy.Get(), &failure_details, &failed);
It seems it would be appropriate to change the expectations here to a
PAC style string similar to what you did in the proxy_config_unitest.cc.
That may cause lots of other updates.
At a minimum please assert that the list size is 1 here, since that is
important for correctness of the test verification (whereas changing to
PAC strings is about flexibility).
https://codereview.chromium.org/12315019/diff/1/net/proxy/proxy_config_unittest.cc
File net/proxy/proxy_config_unittest.cc (right):
https://codereview.chromium.org/12315019/diff/1/net/proxy/proxy_config_unittest.cc#newcode260
net/proxy/proxy_config_unittest.cc:260: // direct:// discarded as a
first or only option for a scheme.
Why do we do this?
https://codereview.chromium.org/12315019/diff/1/net/proxy/proxy_list.cc
File net/proxy/proxy_list.cc (right):
https://codereview.chromium.org/12315019/diff/1/net/proxy/proxy_list.cc#newcode121
net/proxy/proxy_list.cc:121: return ToPacString() ==
other.ToPacString();
Not ideal. I will allow it though.
https://codereview.chromium.org/12315019/