OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ios/chrome/browser/interstitials/ios_security_interstitial_page.h" | 5 #include "ios/chrome/browser/interstitials/ios_security_interstitial_page.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "components/grit/components_resources.h" | 8 #include "components/grit/components_resources.h" |
9 #include "components/prefs/pref_service.h" | 9 #include "components/prefs/pref_service.h" |
10 #include "components/security_interstitials/core/common_string_util.h" | 10 #include "components/security_interstitials/core/common_string_util.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 webui::SetLoadTimeDataDefaults( | 46 webui::SetLoadTimeDataDefaults( |
47 GetApplicationContext()->GetApplicationLocale(), &load_time_data); | 47 GetApplicationContext()->GetApplicationLocale(), &load_time_data); |
48 std::string html = ResourceBundle::GetSharedInstance() | 48 std::string html = ResourceBundle::GetSharedInstance() |
49 .GetRawDataResource(IDR_SECURITY_INTERSTITIAL_HTML) | 49 .GetRawDataResource(IDR_SECURITY_INTERSTITIAL_HTML) |
50 .as_string(); | 50 .as_string(); |
51 webui::AppendWebUiCssTextDefaults(&html); | 51 webui::AppendWebUiCssTextDefaults(&html); |
52 return webui::GetI18nTemplateHtml(html, &load_time_data); | 52 return webui::GetI18nTemplateHtml(html, &load_time_data); |
53 } | 53 } |
54 | 54 |
55 base::string16 IOSSecurityInterstitialPage::GetFormattedHostName() const { | 55 base::string16 IOSSecurityInterstitialPage::GetFormattedHostName() const { |
56 ios::ChromeBrowserState* browser_state = | |
57 ios::ChromeBrowserState::FromBrowserState(web_state_->GetBrowserState()); | |
58 std::string languages = | |
59 browser_state->GetPrefs()->GetString(prefs::kAcceptLanguages); | |
60 return security_interstitials::common_string_util::GetFormattedHostName( | 56 return security_interstitials::common_string_util::GetFormattedHostName( |
61 request_url_, languages); | 57 request_url_); |
62 } | 58 } |
63 | 59 |
64 bool IOSSecurityInterstitialPage::IsPrefEnabled(const char* pref_name) const { | 60 bool IOSSecurityInterstitialPage::IsPrefEnabled(const char* pref_name) const { |
65 ios::ChromeBrowserState* browser_state = | 61 ios::ChromeBrowserState* browser_state = |
66 ios::ChromeBrowserState::FromBrowserState(web_state_->GetBrowserState()); | 62 ios::ChromeBrowserState::FromBrowserState(web_state_->GetBrowserState()); |
67 return browser_state->GetPrefs()->GetBoolean(pref_name); | 63 return browser_state->GetPrefs()->GetBoolean(pref_name); |
68 } | 64 } |
OLD | NEW |