| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_WEBUI_WEB_UI_UTIL_H_ | 5 #ifndef UI_WEBUI_WEB_UI_UTIL_H_ |
| 6 #define UI_WEBUI_WEB_UI_UTIL_H_ | 6 #define UI_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 15 matching lines...) Expand all Loading... |
| 26 // resource_id as a bitmap. This function does not check if the | 26 // resource_id as a bitmap. This function does not check if the |
| 27 // resource for the |resource_id| is a bitmap, therefore it is the | 27 // resource for the |resource_id| is a bitmap, therefore it is the |
| 28 // caller's responsibility to make sure the resource is indeed a | 28 // caller's responsibility to make sure the resource is indeed a |
| 29 // bitmap. Returns empty string if a resource does not exist for given | 29 // bitmap. Returns empty string if a resource does not exist for given |
| 30 // |resource_id|. | 30 // |resource_id|. |
| 31 UI_EXPORT std::string GetBitmapDataUrlFromResource(int resource_id); | 31 UI_EXPORT std::string GetBitmapDataUrlFromResource(int resource_id); |
| 32 | 32 |
| 33 // Extracts a disposition from click event arguments. |args| should contain | 33 // Extracts a disposition from click event arguments. |args| should contain |
| 34 // an integer button and booleans alt key, ctrl key, meta key, and shift key | 34 // an integer button and booleans alt key, ctrl key, meta key, and shift key |
| 35 // (in that order), starting at |start_index|. | 35 // (in that order), starting at |start_index|. |
| 36 UI_EXPORT WindowOpenDisposition GetDispositionFromClick(const ListValue* args, | 36 UI_EXPORT WindowOpenDisposition GetDispositionFromClick( |
| 37 int start_index); | 37 const base::ListValue* args, |
| 38 int start_index); |
| 38 | 39 |
| 39 // Given a scale factor such as "1x", "2x" or "1.99x", sets |scale_factor| to | 40 // Given a scale factor such as "1x", "2x" or "1.99x", sets |scale_factor| to |
| 40 // the closest ScaleFactor enum value for this scale factor. If string can not | 41 // the closest ScaleFactor enum value for this scale factor. If string can not |
| 41 // be parsed, then |scale_factor| is set to SCALE_FACTOR_100P, and false is | 42 // be parsed, then |scale_factor| is set to SCALE_FACTOR_100P, and false is |
| 42 // returned. | 43 // returned. |
| 43 UI_EXPORT bool ParseScaleFactor(const base::StringPiece&identifier, | 44 UI_EXPORT bool ParseScaleFactor(const base::StringPiece&identifier, |
| 44 ui::ScaleFactor* scale_factor); | 45 ui::ScaleFactor* scale_factor); |
| 45 | 46 |
| 46 // Parses a URL containing some path @{scale}x. If it does not contain a scale | 47 // Parses a URL containing some path @{scale}x. If it does not contain a scale |
| 47 // factor then the default scale factor is returned. | 48 // factor then the default scale factor is returned. |
| 48 UI_EXPORT void ParsePathAndScale(const GURL& url, | 49 UI_EXPORT void ParsePathAndScale(const GURL& url, |
| 49 std::string* path, | 50 std::string* path, |
| 50 ui::ScaleFactor* scale_factor); | 51 ui::ScaleFactor* scale_factor); |
| 51 | 52 |
| 52 // Helper function to set the font family, size, and text direction into the | 53 // Helper function to set the font family, size, and text direction into the |
| 53 // given dictionary. | 54 // given dictionary. |
| 54 UI_EXPORT void SetFontAndTextDirection( | 55 UI_EXPORT void SetFontAndTextDirection( |
| 55 base::DictionaryValue* localized_strings); | 56 base::DictionaryValue* localized_strings); |
| 56 | 57 |
| 57 } // namespace webui | 58 } // namespace webui |
| 58 | 59 |
| 59 #endif // UI_WEBUI_WEB_UI_UTIL_H_ | 60 #endif // UI_WEBUI_WEB_UI_UTIL_H_ |
| OLD | NEW |