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

Side by Side Diff: chrome/browser/ssl/captive_portal_blocking_page.cc

Issue 1260033005: Revert of Move net::FormatUrl and friends outside of //net and into //components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/ssl/captive_portal_blocking_page.h" 5 #include "chrome/browser/ssl/captive_portal_blocking_page.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" 14 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/ssl/cert_report_helper.h" 16 #include "chrome/browser/ssl/cert_report_helper.h"
17 #include "chrome/browser/ssl/ssl_cert_reporter.h" 17 #include "chrome/browser/ssl/ssl_cert_reporter.h"
18 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
19 #include "components/captive_portal/captive_portal_detector.h" 19 #include "components/captive_portal/captive_portal_detector.h"
20 #include "components/url_formatter/url_formatter.h"
21 #include "components/wifi/wifi_service.h" 20 #include "components/wifi/wifi_service.h"
22 #include "content/public/browser/web_contents.h" 21 #include "content/public/browser/web_contents.h"
23 #include "grit/generated_resources.h" 22 #include "grit/generated_resources.h"
24 #include "net/base/net_util.h" 23 #include "net/base/net_util.h"
25 #include "net/base/network_change_notifier.h" 24 #include "net/base/network_change_notifier.h"
26 #include "net/ssl/ssl_info.h" 25 #include "net/ssl/ssl_info.h"
27 #include "ui/base/l10n/l10n_util.h" 26 #include "ui/base/l10n/l10n_util.h"
28 27
29 #if !defined(ENABLE_CAPTIVE_PORTAL_DETECTION) 28 #if !defined(ENABLE_CAPTIVE_PORTAL_DETECTION)
30 #error This file must be built with ENABLE_CAPTIVE_PORTAL_DETECTION flag. 29 #error This file must be built with ENABLE_CAPTIVE_PORTAL_DETECTION flag.
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 net::EscapeForHTML(base::UTF8ToUTF16(wifi_ssid)))); 162 net::EscapeForHTML(base::UTF8ToUTF16(wifi_ssid))));
164 } 163 }
165 } else { 164 } else {
166 // Portal redirection was done with HTTP redirects, so show the login URL. 165 // Portal redirection was done with HTTP redirects, so show the login URL.
167 // If |languages| is empty, punycode in |login_host| will always be decoded. 166 // If |languages| is empty, punycode in |login_host| will always be decoded.
168 std::string languages; 167 std::string languages;
169 Profile* profile = Profile::FromBrowserContext( 168 Profile* profile = Profile::FromBrowserContext(
170 web_contents()->GetBrowserContext()); 169 web_contents()->GetBrowserContext());
171 if (profile) 170 if (profile)
172 languages = profile->GetPrefs()->GetString(prefs::kAcceptLanguages); 171 languages = profile->GetPrefs()->GetString(prefs::kAcceptLanguages);
173 base::string16 login_host = 172 base::string16 login_host = net::IDNToUnicode(login_url_.host(), languages);
174 url_formatter::IDNToUnicode(login_url_.host(), languages);
175 if (base::i18n::IsRTL()) 173 if (base::i18n::IsRTL())
176 base::i18n::WrapStringWithLTRFormatting(&login_host); 174 base::i18n::WrapStringWithLTRFormatting(&login_host);
177 175
178 if (wifi_ssid.empty()) { 176 if (wifi_ssid.empty()) {
179 load_time_data->SetString( 177 load_time_data->SetString(
180 "primaryParagraph", 178 "primaryParagraph",
181 l10n_util::GetStringFUTF16( 179 l10n_util::GetStringFUTF16(
182 is_wifi_connection ? IDS_CAPTIVE_PORTAL_PRIMARY_PARAGRAPH_WIFI 180 is_wifi_connection ? IDS_CAPTIVE_PORTAL_PRIMARY_PARAGRAPH_WIFI
183 : IDS_CAPTIVE_PORTAL_PRIMARY_PARAGRAPH_WIRED, 181 : IDS_CAPTIVE_PORTAL_PRIMARY_PARAGRAPH_WIRED,
184 login_host)); 182 login_host));
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 CertificateErrorReport::USER_DID_NOT_PROCEED); 233 CertificateErrorReport::USER_DID_NOT_PROCEED);
236 } 234 }
237 235
238 // Need to explicity deny the certificate via the callback, otherwise memory 236 // Need to explicity deny the certificate via the callback, otherwise memory
239 // is leaked. 237 // is leaked.
240 if (!callback_.is_null()) { 238 if (!callback_.is_null()) {
241 callback_.Run(false); 239 callback_.Run(false);
242 callback_.Reset(); 240 callback_.Reset();
243 } 241 }
244 } 242 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_io_data.cc ('k') | chrome/browser/supervised_user/supervised_user_bookmarks_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698