Rename IsLocalhost(host) to HostStringIsLocalhost(host); add IsLocalhost(GURL)

Several call sites incorrectly used GURL::host or GURL::host_piece as an
argument to net::IsLocalhost. This function only expects IPv6 addresses
without brackets. Since the vast majority of the callers start off with
a GURL, change net::IsLocalhost(StringPiece) to net::IsLocalhost(GURL).

For callers that do not have a GURL, and only a host name (e.g. Blink code),
net::HostStringIsLocalhost is added (which behaves like the old net::IsLocalhost).

TEST=Start Chrome with --allow-insecure-localhost, visit https://[::1]/
     and confirm that the site loads without intersitial.

Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: Ibb1cbf3f061ea2070d5e479ac4119a813a7e98a7
Commit-Queue: Rob Wu <>
Reviewed-by: Eric Roman <>
Reviewed-by: Scott Violet <>
Cr-Commit-Position: refs/heads/master@{#529180}
31 files changed