| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/strings/string_piece.h" | 12 #include "base/strings/string_piece.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "ui/base/template_expressions.h" |
| 14 #include "ui/base/ui_base_export.h" | 15 #include "ui/base/ui_base_export.h" |
| 15 #include "ui/base/window_open_disposition.h" | 16 #include "ui/base/window_open_disposition.h" |
| 16 | 17 |
| 17 class GURL; | 18 class GURL; |
| 18 class SkBitmap; | 19 class SkBitmap; |
| 19 | 20 |
| 20 namespace webui { | 21 namespace webui { |
| 21 | 22 |
| 22 // Convenience routine to convert SkBitmap object to data url | 23 // Convenience routine to convert SkBitmap object to data url |
| 23 // so that it can be used in WebUI. | 24 // so that it can be used in WebUI. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 42 UI_BASE_EXPORT void ParsePathAndScale(const GURL& url, | 43 UI_BASE_EXPORT void ParsePathAndScale(const GURL& url, |
| 43 std::string* path, | 44 std::string* path, |
| 44 float* scale_factor); | 45 float* scale_factor); |
| 45 | 46 |
| 46 // Helper function to set some default values (e.g., font family, size, | 47 // Helper function to set some default values (e.g., font family, size, |
| 47 // language, and text direction) into the given dictionary. Requires an | 48 // language, and text direction) into the given dictionary. Requires an |
| 48 // application locale (i.e. g_browser_process->GetApplicationLocale()). | 49 // application locale (i.e. g_browser_process->GetApplicationLocale()). |
| 49 UI_BASE_EXPORT void SetLoadTimeDataDefaults( | 50 UI_BASE_EXPORT void SetLoadTimeDataDefaults( |
| 50 const std::string& app_locale, | 51 const std::string& app_locale, |
| 51 base::DictionaryValue* localized_strings); | 52 base::DictionaryValue* localized_strings); |
| 53 UI_BASE_EXPORT void SetLoadTimeDataDefaults( |
| 54 const std::string& app_locale, |
| 55 ui::TemplateReplacements* replacements); |
| 52 | 56 |
| 53 // Get a CSS declaration for common text styles using provided template. | 57 // Get a CSS declaration for common text styles using provided template. |
| 54 UI_BASE_EXPORT std::string GetWebUiCssTextDefaults( | 58 UI_BASE_EXPORT std::string GetWebUiCssTextDefaults( |
| 55 const std::string& css_template); | 59 const std::string& css_template); |
| 56 | 60 |
| 57 // Get a CSS declaration for common text styles for all of Web UI. | 61 // Get a CSS declaration for common text styles for all of Web UI. |
| 58 UI_BASE_EXPORT std::string GetWebUiCssTextDefaults(); | 62 UI_BASE_EXPORT std::string GetWebUiCssTextDefaults(); |
| 59 | 63 |
| 60 // Get a CSS declaration for common text styles for Web UI using | 64 // Get a CSS declaration for common text styles for Web UI using |
| 61 // Material Design. | 65 // Material Design. |
| 62 UI_BASE_EXPORT std::string GetWebUiCssTextDefaultsMd(); | 66 UI_BASE_EXPORT std::string GetWebUiCssTextDefaultsMd(); |
| 63 | 67 |
| 64 // Appends the CSS declaration returned by GetWebUiCssTextDefaults() as an | 68 // Appends the CSS declaration returned by GetWebUiCssTextDefaults() as an |
| 65 // inline stylesheet. | 69 // inline stylesheet. |
| 66 UI_BASE_EXPORT void AppendWebUiCssTextDefaults(std::string* html); | 70 UI_BASE_EXPORT void AppendWebUiCssTextDefaults(std::string* html); |
| 67 | 71 |
| 68 // Get some common font styles for all of WebUI. | 72 // Get some common font styles for all of WebUI. |
| 69 UI_BASE_EXPORT std::string GetFontFamily(); | 73 UI_BASE_EXPORT std::string GetFontFamily(); |
| 70 UI_BASE_EXPORT std::string GetFontSize(); | 74 UI_BASE_EXPORT std::string GetFontSize(); |
| 71 UI_BASE_EXPORT std::string GetTextDirection(); | 75 UI_BASE_EXPORT std::string GetTextDirection(); |
| 72 | 76 |
| 73 } // namespace webui | 77 } // namespace webui |
| 74 | 78 |
| 75 #endif // UI_BASE_WEBUI_WEB_UI_UTIL_H_ | 79 #endif // UI_BASE_WEBUI_WEB_UI_UTIL_H_ |
| OLD | NEW |