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 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/browser_process.h" |
10 #include "chrome/grit/browser_resources.h" | 11 #include "chrome/grit/browser_resources.h" |
11 #include "content/public/browser/interstitial_page.h" | 12 #include "content/public/browser/interstitial_page.h" |
12 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
13 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
14 #include "ui/base/webui/jstemplate_builder.h" | 15 #include "ui/base/webui/jstemplate_builder.h" |
15 #include "ui/base/webui/web_ui_util.h" | 16 #include "ui/base/webui/web_ui_util.h" |
16 | 17 |
17 SecurityInterstitialPage::SecurityInterstitialPage( | 18 SecurityInterstitialPage::SecurityInterstitialPage( |
18 content::WebContents* web_contents, | 19 content::WebContents* web_contents, |
19 const GURL& request_url) | 20 const GURL& request_url) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 base::string16 SecurityInterstitialPage::GetFormattedHostName() const { | 57 base::string16 SecurityInterstitialPage::GetFormattedHostName() const { |
57 base::string16 host(base::UTF8ToUTF16(request_url_.host())); | 58 base::string16 host(base::UTF8ToUTF16(request_url_.host())); |
58 if (base::i18n::IsRTL()) | 59 if (base::i18n::IsRTL()) |
59 base::i18n::WrapStringWithLTRFormatting(&host); | 60 base::i18n::WrapStringWithLTRFormatting(&host); |
60 return host; | 61 return host; |
61 } | 62 } |
62 | 63 |
63 std::string SecurityInterstitialPage::GetHTMLContents() { | 64 std::string SecurityInterstitialPage::GetHTMLContents() { |
64 base::DictionaryValue load_time_data; | 65 base::DictionaryValue load_time_data; |
65 PopulateInterstitialStrings(&load_time_data); | 66 PopulateInterstitialStrings(&load_time_data); |
66 webui::SetFontAndTextDirection(&load_time_data); | 67 const std::string& app_locale = g_browser_process->GetApplicationLocale(); |
| 68 webui::SetLoadTimeDataDefaults(app_locale, &load_time_data); |
67 std::string html = ResourceBundle::GetSharedInstance() | 69 std::string html = ResourceBundle::GetSharedInstance() |
68 .GetRawDataResource(IDR_SECURITY_INTERSTITIAL_HTML) | 70 .GetRawDataResource(IDR_SECURITY_INTERSTITIAL_HTML) |
69 .as_string(); | 71 .as_string(); |
70 webui::AppendWebUiCssTextDefaults(&html); | 72 webui::AppendWebUiCssTextDefaults(&html); |
71 return webui::GetI18nTemplateHtml(html, &load_time_data); | 73 return webui::GetI18nTemplateHtml(html, &load_time_data); |
72 } | 74 } |
OLD | NEW |