| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ui/base/webui/web_ui_util.h" | 5 #include "ui/base/webui/web_ui_util.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 } | 116 } |
| 117 | 117 |
| 118 void SetLoadTimeDataDefaults(const std::string& app_locale, | 118 void SetLoadTimeDataDefaults(const std::string& app_locale, |
| 119 base::DictionaryValue* localized_strings) { | 119 base::DictionaryValue* localized_strings) { |
| 120 localized_strings->SetString("fontfamily", GetFontFamily()); | 120 localized_strings->SetString("fontfamily", GetFontFamily()); |
| 121 localized_strings->SetString("fontsize", GetFontSize()); | 121 localized_strings->SetString("fontsize", GetFontSize()); |
| 122 localized_strings->SetString("language", l10n_util::GetLanguage(app_locale)); | 122 localized_strings->SetString("language", l10n_util::GetLanguage(app_locale)); |
| 123 localized_strings->SetString("textdirection", GetTextDirection()); | 123 localized_strings->SetString("textdirection", GetTextDirection()); |
| 124 } | 124 } |
| 125 | 125 |
| 126 void SetLoadTimeDataDefaults(const std::string& app_locale, |
| 127 ui::TemplateReplacements* replacements) { |
| 128 (*replacements)["fontfamily"] = GetFontFamily(); |
| 129 (*replacements)["fontsize"] = GetFontSize(); |
| 130 (*replacements)["language"] = l10n_util::GetLanguage(app_locale); |
| 131 (*replacements)["textdirection"] = GetTextDirection(); |
| 132 } |
| 133 |
| 126 std::string GetWebUiCssTextDefaults(base::StringPiece css_template) { | 134 std::string GetWebUiCssTextDefaults(base::StringPiece css_template) { |
| 127 ui::TemplateReplacements placeholders; | 135 ui::TemplateReplacements placeholders; |
| 128 placeholders["textDirection"] = GetTextDirection(); | 136 placeholders["textDirection"] = GetTextDirection(); |
| 129 placeholders["fontFamily"] = GetFontFamily(); | 137 placeholders["fontFamily"] = GetFontFamily(); |
| 130 placeholders["fontSize"] = GetFontSize(); | 138 placeholders["fontSize"] = GetFontSize(); |
| 131 return ui::ReplaceTemplateExpressions(css_template, placeholders); | 139 return ui::ReplaceTemplateExpressions(css_template, placeholders); |
| 132 } | 140 } |
| 133 | 141 |
| 134 std::string GetWebUiCssTextDefaults() { | 142 std::string GetWebUiCssTextDefaults() { |
| 135 const ui::ResourceBundle& resource_bundle = | 143 const ui::ResourceBundle& resource_bundle = |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 IDS_WEB_FONT_SIZE_XP : | 184 IDS_WEB_FONT_SIZE_XP : |
| 177 #endif | 185 #endif |
| 178 IDS_WEB_FONT_SIZE); | 186 IDS_WEB_FONT_SIZE); |
| 179 } | 187 } |
| 180 | 188 |
| 181 std::string GetTextDirection() { | 189 std::string GetTextDirection() { |
| 182 return base::i18n::IsRTL() ? "rtl" : "ltr"; | 190 return base::i18n::IsRTL() ? "rtl" : "ltr"; |
| 183 } | 191 } |
| 184 | 192 |
| 185 } // namespace webui | 193 } // namespace webui |
| OLD | NEW |