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

Unified Diff: components/url_formatter/elide_url.cc

Issue 1861213002: Convert host names in ACE to Unicode in ElideHost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add an IDN test to ElideHost test Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/url_formatter/elide_url_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/url_formatter/elide_url.cc
diff --git a/components/url_formatter/elide_url.cc b/components/url_formatter/elide_url.cc
index bcc8840c83224827b048b0638632b6e214b47d08..399b44c2f0fea75d92fe3939e05d956c1d4e96f9 100644
--- a/components/url_formatter/elide_url.cc
+++ b/components/url_formatter/elide_url.cc
@@ -78,15 +78,18 @@ void SplitHost(const GURL& url,
base::string16* url_host,
base::string16* url_domain,
base::string16* url_subdomain) {
- // Get Host.
- *url_host = base::UTF8ToUTF16(url.host());
+ // Get Host in ACE(ASCII Compatible Encoding).
Peter Kasting 2016/04/06 21:38:39 Since we don't use "ACE" most other places in Chro
jungshik at Google 2016/04/06 21:50:38 Ok. (I regret not having used ACE before :-)).
+ std::string host_ace = url.host();
// Get domain and registry information from the URL.
- *url_domain =
- base::UTF8ToUTF16(net::registry_controlled_domains::GetDomainAndRegistry(
- url, net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES));
- if (url_domain->empty())
- *url_domain = *url_host;
+ std::string domain_ace =
+ net::registry_controlled_domains::GetDomainAndRegistry(
+ url, net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES);
+ if (domain_ace.empty())
+ domain_ace = host_ace;
+
+ *url_host = url_formatter::IDNToUnicode(host_ace);
+ *url_domain = url_formatter::IDNToUnicode(domain_ace);
// Add port if required.
if (!url.port().empty()) {
« no previous file with comments | « no previous file | components/url_formatter/elide_url_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698