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

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

Issue 880313002: webui: add [lang] attribute to <html> element on all webui pages so (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cros Created 5 years, 10 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/file_manager/file_manager/main.html » ('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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 pos + 1, stripped_path.length() - pos - 1), &factor)) { 124 pos + 1, stripped_path.length() - pos - 1), &factor)) {
125 // Strip scale factor specification from path. 125 // Strip scale factor specification from path.
126 stripped_path.remove_suffix(stripped_path.length() - pos); 126 stripped_path.remove_suffix(stripped_path.length() - pos);
127 stripped_path.CopyToString(path); 127 stripped_path.CopyToString(path);
128 } 128 }
129 if (scale_factor) 129 if (scale_factor)
130 *scale_factor = factor; 130 *scale_factor = factor;
131 } 131 }
132 } 132 }
133 133
134 void SetFontAndTextDirection(base::DictionaryValue* localized_strings) { 134 void SetLoadTimeDataDefaults(const std::string& app_locale,
135 base::DictionaryValue* localized_strings) {
135 localized_strings->SetString("fontfamily", GetFontFamily()); 136 localized_strings->SetString("fontfamily", GetFontFamily());
136 localized_strings->SetString("fontsize", GetFontSize()); 137 localized_strings->SetString("fontsize", GetFontSize());
138 localized_strings->SetString("language", l10n_util::GetLanguage(app_locale));
137 localized_strings->SetString("textdirection", GetTextDirection()); 139 localized_strings->SetString("textdirection", GetTextDirection());
138 } 140 }
139 141
140 std::string GetWebUiCssTextDefaults() { 142 std::string GetWebUiCssTextDefaults() {
141 std::vector<std::string> placeholders; 143 std::vector<std::string> placeholders;
142 placeholders.push_back(GetTextDirection()); // $1 144 placeholders.push_back(GetTextDirection()); // $1
143 placeholders.push_back(GetFontFamily()); // $2 145 placeholders.push_back(GetFontFamily()); // $2
144 placeholders.push_back(GetFontSize()); // $3 146 placeholders.push_back(GetFontSize()); // $3
145 147
146 const ui::ResourceBundle& resource_bundle = 148 const ui::ResourceBundle& resource_bundle =
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 IDS_WEB_FONT_SIZE_XP : 189 IDS_WEB_FONT_SIZE_XP :
188 #endif 190 #endif
189 IDS_WEB_FONT_SIZE); 191 IDS_WEB_FONT_SIZE);
190 } 192 }
191 193
192 std::string GetTextDirection() { 194 std::string GetTextDirection() {
193 return base::i18n::IsRTL() ? "rtl" : "ltr"; 195 return base::i18n::IsRTL() ? "rtl" : "ltr";
194 } 196 }
195 197
196 } // namespace webui 198 } // namespace webui
OLDNEW
« no previous file with comments | « ui/base/webui/web_ui_util.h ('k') | ui/file_manager/file_manager/main.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698