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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 AfterShow(); | 71 AfterShow(); |
72 } | 72 } |
73 | 73 |
74 bool SecurityInterstitialPage::IsPrefEnabled(const char* pref) { | 74 bool SecurityInterstitialPage::IsPrefEnabled(const char* pref) { |
75 Profile* profile = | 75 Profile* profile = |
76 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | 76 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
77 return profile->GetPrefs()->GetBoolean(pref); | 77 return profile->GetPrefs()->GetBoolean(pref); |
78 } | 78 } |
79 | 79 |
80 base::string16 SecurityInterstitialPage::GetFormattedHostName() const { | 80 base::string16 SecurityInterstitialPage::GetFormattedHostName() const { |
81 std::string languages; | |
82 Profile* profile = | |
83 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | |
84 if (profile) | |
85 languages = profile->GetPrefs()->GetString(prefs::kAcceptLanguages); | |
86 return security_interstitials::common_string_util::GetFormattedHostName( | 81 return security_interstitials::common_string_util::GetFormattedHostName( |
87 request_url_, languages); | 82 request_url_); |
88 } | 83 } |
89 | 84 |
90 std::string SecurityInterstitialPage::GetHTMLContents() { | 85 std::string SecurityInterstitialPage::GetHTMLContents() { |
91 base::DictionaryValue load_time_data; | 86 base::DictionaryValue load_time_data; |
92 PopulateInterstitialStrings(&load_time_data); | 87 PopulateInterstitialStrings(&load_time_data); |
93 const std::string& app_locale = g_browser_process->GetApplicationLocale(); | 88 const std::string& app_locale = g_browser_process->GetApplicationLocale(); |
94 webui::SetLoadTimeDataDefaults(app_locale, &load_time_data); | 89 webui::SetLoadTimeDataDefaults(app_locale, &load_time_data); |
95 std::string html = ResourceBundle::GetSharedInstance() | 90 std::string html = ResourceBundle::GetSharedInstance() |
96 .GetRawDataResource(IDR_SECURITY_INTERSTITIAL_HTML) | 91 .GetRawDataResource(IDR_SECURITY_INTERSTITIAL_HTML) |
97 .as_string(); | 92 .as_string(); |
(...skipping 11 matching lines...) Expand all Loading... |
109 | 104 |
110 security_interstitials::MetricsHelper* | 105 security_interstitials::MetricsHelper* |
111 SecurityInterstitialPage::metrics_helper() { | 106 SecurityInterstitialPage::metrics_helper() { |
112 return controller_->metrics_helper(); | 107 return controller_->metrics_helper(); |
113 } | 108 } |
114 | 109 |
115 void SecurityInterstitialPage::set_metrics_helper( | 110 void SecurityInterstitialPage::set_metrics_helper( |
116 std::unique_ptr<security_interstitials::MetricsHelper> metrics_helper) { | 111 std::unique_ptr<security_interstitials::MetricsHelper> metrics_helper) { |
117 controller_->set_metrics_helper(std::move(metrics_helper)); | 112 controller_->set_metrics_helper(std::move(metrics_helper)); |
118 } | 113 } |
OLD | NEW |