| 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 #ifndef UI_BASE_WEBUI_WEB_UI_UTIL_H_ | 5 #ifndef UI_BASE_WEBUI_WEB_UI_UTIL_H_ |
| 6 #define UI_BASE_WEBUI_WEB_UI_UTIL_H_ | 6 #define UI_BASE_WEBUI_WEB_UI_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 // Pares a formatted scale factor string into float and sets to |scale_factor|. | 38 // Pares a formatted scale factor string into float and sets to |scale_factor|. |
| 39 UI_BASE_EXPORT bool ParseScaleFactor(const base::StringPiece& identifier, | 39 UI_BASE_EXPORT bool ParseScaleFactor(const base::StringPiece& identifier, |
| 40 float* scale_factor); | 40 float* scale_factor); |
| 41 | 41 |
| 42 // Parses a URL containing some path @{scale}x. If it does not contain a scale | 42 // Parses a URL containing some path @{scale}x. If it does not contain a scale |
| 43 // factor then the default scale factor is returned. | 43 // factor then the default scale factor is returned. |
| 44 UI_BASE_EXPORT void ParsePathAndScale(const GURL& url, | 44 UI_BASE_EXPORT void ParsePathAndScale(const GURL& url, |
| 45 std::string* path, | 45 std::string* path, |
| 46 float* scale_factor); | 46 float* scale_factor); |
| 47 | 47 |
| 48 // Helper function to set the font family, size, and text direction into the | 48 // Helper function to set some default values (e.g., font family, size, |
| 49 // given dictionary. | 49 // language, and text direction) into the given dictionary. Requires an |
| 50 // Note that using font family and size in JS templates is deprecated, because | 50 // application locale (i.e. g_browser_process->GetApplicationLocale()). |
| 51 // it might lead to flicker. Instead, use AppendWebUICSSTextDefaults() below. | 51 UI_BASE_EXPORT void SetLoadTimeDataDefaults( |
| 52 // TODO(bauerb): Remove uses of font-family and font-size in JS templates, then | 52 const std::string& app_locale, |
| 53 // rename this method to SetTextDirection(). | |
| 54 UI_BASE_EXPORT void SetFontAndTextDirection( | |
| 55 base::DictionaryValue* localized_strings); | 53 base::DictionaryValue* localized_strings); |
| 56 | 54 |
| 57 // Get a CSS declaration for common text styles for all of Web UI. | 55 // Get a CSS declaration for common text styles for all of Web UI. |
| 58 UI_BASE_EXPORT std::string GetWebUiCssTextDefaults(); | 56 UI_BASE_EXPORT std::string GetWebUiCssTextDefaults(); |
| 59 | 57 |
| 60 // Appends the CSS declaration returned by GetWebUiCssTextDefaults() as an | 58 // Appends the CSS declaration returned by GetWebUiCssTextDefaults() as an |
| 61 // inline stylesheet. | 59 // inline stylesheet. |
| 62 UI_BASE_EXPORT void AppendWebUiCssTextDefaults(std::string* html); | 60 UI_BASE_EXPORT void AppendWebUiCssTextDefaults(std::string* html); |
| 63 | 61 |
| 64 // Get some common font styles for all of WebUI. | 62 // Get some common font styles for all of WebUI. |
| 65 UI_BASE_EXPORT std::string GetFontFamily(); | 63 UI_BASE_EXPORT std::string GetFontFamily(); |
| 66 UI_BASE_EXPORT std::string GetFontSize(); | 64 UI_BASE_EXPORT std::string GetFontSize(); |
| 67 UI_BASE_EXPORT std::string GetTextDirection(); | 65 UI_BASE_EXPORT std::string GetTextDirection(); |
| 68 | 66 |
| 69 } // namespace webui | 67 } // namespace webui |
| 70 | 68 |
| 71 #endif // UI_BASE_WEBUI_WEB_UI_UTIL_H_ | 69 #endif // UI_BASE_WEBUI_WEB_UI_UTIL_H_ |
| OLD | NEW |