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

Unified Diff: chrome/browser/interstitials/security_interstitial_page.cc

Issue 863133003: Properly decode IDN in interstitials. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/interstitials/security_interstitial_page.cc
diff --git a/chrome/browser/interstitials/security_interstitial_page.cc b/chrome/browser/interstitials/security_interstitial_page.cc
index 513219631c1fa5c538f47cd014931887e123ff34..6db315c6819ab9e25487b2f2fd48d928ebad84b7 100644
--- a/chrome/browser/interstitials/security_interstitial_page.cc
+++ b/chrome/browser/interstitials/security_interstitial_page.cc
@@ -5,11 +5,15 @@
#include "chrome/browser/interstitials/security_interstitial_page.h"
#include "base/i18n/rtl.h"
+#include "base/prefs/pref_service.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/common/pref_names.h"
#include "chrome/grit/browser_resources.h"
#include "content/public/browser/interstitial_page.h"
#include "content/public/browser/web_contents.h"
+#include "net/base/net_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/webui/jstemplate_builder.h"
#include "ui/base/webui/web_ui_util.h"
@@ -54,7 +58,12 @@ void SecurityInterstitialPage::Show() {
}
base::string16 SecurityInterstitialPage::GetFormattedHostName() const {
- base::string16 host(base::UTF8ToUTF16(request_url_.host()));
+ std::string languages;
+ Profile* profile = Profile::FromBrowserContext(
+ web_contents()->GetBrowserContext());
+ if (profile)
+ languages = profile->GetPrefs()->GetString(prefs::kAcceptLanguages);
+ base::string16 host = net::IDNToUnicode(request_url_.host(), languages);
if (base::i18n::IsRTL())
base::i18n::WrapStringWithLTRFormatting(&host);
return host;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698