Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: ui/base/webui/web_ui_util.cc

Issue 1516233003: Incognito NTP style tweaks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Roboto font with full charset version Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/base/webui/web_ui_util.h ('k') | ui/webui/resources/css/roboto.css » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } 115 }
116 116
117 void SetLoadTimeDataDefaults(const std::string& app_locale, 117 void SetLoadTimeDataDefaults(const std::string& app_locale,
118 base::DictionaryValue* localized_strings) { 118 base::DictionaryValue* localized_strings) {
119 localized_strings->SetString("fontfamily", GetFontFamily()); 119 localized_strings->SetString("fontfamily", GetFontFamily());
120 localized_strings->SetString("fontsize", GetFontSize()); 120 localized_strings->SetString("fontsize", GetFontSize());
121 localized_strings->SetString("language", l10n_util::GetLanguage(app_locale)); 121 localized_strings->SetString("language", l10n_util::GetLanguage(app_locale));
122 localized_strings->SetString("textdirection", GetTextDirection()); 122 localized_strings->SetString("textdirection", GetTextDirection());
123 } 123 }
124 124
125 std::string GetWebUiCssTextDefaults() { 125 std::string GetWebUiCssTextDefaults(const std::string& css_template) {
126 std::map<base::StringPiece, std::string> placeholders; 126 std::map<base::StringPiece, std::string> placeholders;
127 placeholders["textDirection"] = GetTextDirection(); 127 placeholders["textDirection"] = GetTextDirection();
128 placeholders["fontFamily"] = GetFontFamily(); 128 placeholders["fontFamily"] = GetFontFamily();
129 placeholders["fontSize"] = GetFontSize(); 129 placeholders["fontSize"] = GetFontSize();
130 return ui::ReplaceTemplateExpressions(css_template, placeholders);
131 }
130 132
133 std::string GetWebUiCssTextDefaults() {
131 const ui::ResourceBundle& resource_bundle = 134 const ui::ResourceBundle& resource_bundle =
132 ui::ResourceBundle::GetSharedInstance(); 135 ui::ResourceBundle::GetSharedInstance();
133 const std::string& css_template = 136 const std::string& css_template =
134 resource_bundle.GetRawDataResource(IDR_WEBUI_CSS_TEXT_DEFAULTS) 137 resource_bundle.GetRawDataResource(IDR_WEBUI_CSS_TEXT_DEFAULTS)
135 .as_string(); 138 .as_string();
139 return GetWebUiCssTextDefaults(css_template);
140 }
136 141
137 return ui::ReplaceTemplateExpressions(css_template, placeholders); 142 std::string GetWebUiCssTextDefaultsMd() {
143 const ui::ResourceBundle& resource_bundle =
144 ui::ResourceBundle::GetSharedInstance();
145 const std::string& css_template =
146 resource_bundle.GetRawDataResource(IDR_WEBUI_CSS_TEXT_DEFAULTS_MD)
147 .as_string();
148 return GetWebUiCssTextDefaults(css_template);
138 } 149 }
139 150
140 void AppendWebUiCssTextDefaults(std::string* html) { 151 void AppendWebUiCssTextDefaults(std::string* html) {
141 html->append("<style>"); 152 html->append("<style>");
142 html->append(GetWebUiCssTextDefaults()); 153 html->append(GetWebUiCssTextDefaults());
143 html->append("</style>"); 154 html->append("</style>");
144 } 155 }
145 156
146 std::string GetFontFamily() { 157 std::string GetFontFamily() {
147 std::string font_family = l10n_util::GetStringUTF8( 158 std::string font_family = l10n_util::GetStringUTF8(
(...skipping 20 matching lines...) Expand all
168 IDS_WEB_FONT_SIZE_XP : 179 IDS_WEB_FONT_SIZE_XP :
169 #endif 180 #endif
170 IDS_WEB_FONT_SIZE); 181 IDS_WEB_FONT_SIZE);
171 } 182 }
172 183
173 std::string GetTextDirection() { 184 std::string GetTextDirection() {
174 return base::i18n::IsRTL() ? "rtl" : "ltr"; 185 return base::i18n::IsRTL() ? "rtl" : "ltr";
175 } 186 }
176 187
177 } // namespace webui 188 } // namespace webui
OLDNEW
« no previous file with comments | « ui/base/webui/web_ui_util.h ('k') | ui/webui/resources/css/roboto.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698