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

Side by Side Diff: chrome/browser/interstitials/security_interstitial_page.cc

Issue 1171333003: Move net::FormatUrl and friends outside of //net and into //components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase again now that CQ is fixed 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 (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/interstitials/security_interstitial_page.h" 5 #include "chrome/browser/interstitials/security_interstitial_page.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 8
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/net/referrer.h" 14 #include "chrome/browser/net/referrer.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/common/pref_names.h" 16 #include "chrome/common/pref_names.h"
17 #include "chrome/grit/browser_resources.h" 17 #include "chrome/grit/browser_resources.h"
18 #include "chrome/grit/generated_resources.h" 18 #include "chrome/grit/generated_resources.h"
19 #include "components/google/core/browser/google_util.h" 19 #include "components/google/core/browser/google_util.h"
20 #include "components/security_interstitials/core/metrics_helper.h" 20 #include "components/security_interstitials/core/metrics_helper.h"
21 #include "components/url_formatter/url_formatter.h"
21 #include "content/public/browser/interstitial_page.h" 22 #include "content/public/browser/interstitial_page.h"
22 #include "content/public/browser/page_navigator.h" 23 #include "content/public/browser/page_navigator.h"
23 #include "content/public/browser/web_contents.h" 24 #include "content/public/browser/web_contents.h"
24 #include "net/base/net_util.h"
25 #include "ui/base/l10n/l10n_util.h" 25 #include "ui/base/l10n/l10n_util.h"
26 #include "ui/base/resource/resource_bundle.h" 26 #include "ui/base/resource/resource_bundle.h"
27 #include "ui/base/webui/jstemplate_builder.h" 27 #include "ui/base/webui/jstemplate_builder.h"
28 #include "ui/base/webui/web_ui_util.h" 28 #include "ui/base/webui/web_ui_util.h"
29 29
30 namespace interstitials { 30 namespace interstitials {
31 const char kBoxChecked[] = "boxchecked"; 31 const char kBoxChecked[] = "boxchecked";
32 const char kDisplayCheckBox[] = "displaycheckbox"; 32 const char kDisplayCheckBox[] = "displaycheckbox";
33 const char kOptInLink[] = "optInLink"; 33 const char kOptInLink[] = "optInLink";
34 const char kPrivacyLinkHtml[] = 34 const char kPrivacyLinkHtml[] =
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 security_interstitials::MetricsHelper* metrics_helper) { 117 security_interstitials::MetricsHelper* metrics_helper) {
118 metrics_helper_.reset(metrics_helper); 118 metrics_helper_.reset(metrics_helper);
119 } 119 }
120 120
121 base::string16 SecurityInterstitialPage::GetFormattedHostName() const { 121 base::string16 SecurityInterstitialPage::GetFormattedHostName() const {
122 std::string languages; 122 std::string languages;
123 Profile* profile = 123 Profile* profile =
124 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); 124 Profile::FromBrowserContext(web_contents()->GetBrowserContext());
125 if (profile) 125 if (profile)
126 languages = profile->GetPrefs()->GetString(prefs::kAcceptLanguages); 126 languages = profile->GetPrefs()->GetString(prefs::kAcceptLanguages);
127 base::string16 host = net::IDNToUnicode(request_url_.host(), languages); 127 base::string16 host =
128 url_formatter::IDNToUnicode(request_url_.host(), languages);
128 if (base::i18n::IsRTL()) 129 if (base::i18n::IsRTL())
129 base::i18n::WrapStringWithLTRFormatting(&host); 130 base::i18n::WrapStringWithLTRFormatting(&host);
130 return host; 131 return host;
131 } 132 }
132 133
133 std::string SecurityInterstitialPage::GetHTMLContents() { 134 std::string SecurityInterstitialPage::GetHTMLContents() {
134 base::DictionaryValue load_time_data; 135 base::DictionaryValue load_time_data;
135 PopulateInterstitialStrings(&load_time_data); 136 PopulateInterstitialStrings(&load_time_data);
136 const std::string& app_locale = g_browser_process->GetApplicationLocale(); 137 const std::string& app_locale = g_browser_process->GetApplicationLocale();
137 webui::SetLoadTimeDataDefaults(app_locale, &load_time_data); 138 webui::SetLoadTimeDataDefaults(app_locale, &load_time_data);
138 std::string html = ResourceBundle::GetSharedInstance() 139 std::string html = ResourceBundle::GetSharedInstance()
139 .GetRawDataResource(IDR_SECURITY_INTERSTITIAL_HTML) 140 .GetRawDataResource(IDR_SECURITY_INTERSTITIAL_HTML)
140 .as_string(); 141 .as_string();
141 webui::AppendWebUiCssTextDefaults(&html); 142 webui::AppendWebUiCssTextDefaults(&html);
142 return webui::GetI18nTemplateHtml(html, &load_time_data); 143 return webui::GetI18nTemplateHtml(html, &load_time_data);
143 } 144 }
OLDNEW
« no previous file with comments | « chrome/browser/geolocation/geolocation_infobar_delegate.cc ('k') | chrome/browser/media/media_stream_capture_indicator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698