| OLD | NEW |
| 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" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 ui::PAGE_TRANSITION_LINK, false); | 108 ui::PAGE_TRANSITION_LINK, false); |
| 109 web_contents()->OpenURL(params); | 109 web_contents()->OpenURL(params); |
| 110 } | 110 } |
| 111 | 111 |
| 112 security_interstitials::MetricsHelper* | 112 security_interstitials::MetricsHelper* |
| 113 SecurityInterstitialPage::metrics_helper() const { | 113 SecurityInterstitialPage::metrics_helper() const { |
| 114 return metrics_helper_.get(); | 114 return metrics_helper_.get(); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void SecurityInterstitialPage::set_metrics_helper( | 117 void SecurityInterstitialPage::set_metrics_helper( |
| 118 security_interstitials::MetricsHelper* metrics_helper) { | 118 scoped_ptr<security_interstitials::MetricsHelper> metrics_helper) { |
| 119 metrics_helper_.reset(metrics_helper); | 119 metrics_helper_ = metrics_helper.Pass(); |
| 120 } | 120 } |
| 121 | 121 |
| 122 base::string16 SecurityInterstitialPage::GetFormattedHostName() const { | 122 base::string16 SecurityInterstitialPage::GetFormattedHostName() const { |
| 123 std::string languages; | 123 std::string languages; |
| 124 Profile* profile = | 124 Profile* profile = |
| 125 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | 125 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
| 126 if (profile) | 126 if (profile) |
| 127 languages = profile->GetPrefs()->GetString(prefs::kAcceptLanguages); | 127 languages = profile->GetPrefs()->GetString(prefs::kAcceptLanguages); |
| 128 base::string16 host = | 128 base::string16 host = |
| 129 url_formatter::IDNToUnicode(request_url_.host(), languages); | 129 url_formatter::IDNToUnicode(request_url_.host(), languages); |
| 130 if (base::i18n::IsRTL()) | 130 if (base::i18n::IsRTL()) |
| 131 base::i18n::WrapStringWithLTRFormatting(&host); | 131 base::i18n::WrapStringWithLTRFormatting(&host); |
| 132 return host; | 132 return host; |
| 133 } | 133 } |
| 134 | 134 |
| 135 std::string SecurityInterstitialPage::GetHTMLContents() { | 135 std::string SecurityInterstitialPage::GetHTMLContents() { |
| 136 base::DictionaryValue load_time_data; | 136 base::DictionaryValue load_time_data; |
| 137 PopulateInterstitialStrings(&load_time_data); | 137 PopulateInterstitialStrings(&load_time_data); |
| 138 const std::string& app_locale = g_browser_process->GetApplicationLocale(); | 138 const std::string& app_locale = g_browser_process->GetApplicationLocale(); |
| 139 webui::SetLoadTimeDataDefaults(app_locale, &load_time_data); | 139 webui::SetLoadTimeDataDefaults(app_locale, &load_time_data); |
| 140 std::string html = ResourceBundle::GetSharedInstance() | 140 std::string html = ResourceBundle::GetSharedInstance() |
| 141 .GetRawDataResource(IDR_SECURITY_INTERSTITIAL_HTML) | 141 .GetRawDataResource(IDR_SECURITY_INTERSTITIAL_HTML) |
| 142 .as_string(); | 142 .as_string(); |
| 143 webui::AppendWebUiCssTextDefaults(&html); | 143 webui::AppendWebUiCssTextDefaults(&html); |
| 144 return webui::GetI18nTemplateHtml(html, &load_time_data); | 144 return webui::GetI18nTemplateHtml(html, &load_time_data); |
| 145 } | 145 } |
| OLD | NEW |