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 CHROME_BROWSER_UI_WEBUI_WEB_UI_UTIL_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_WEB_UI_UTIL_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_WEB_UI_UTIL_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_WEB_UI_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 // image. Returns empty string if a resource does not exist for given | 31 // image. Returns empty string if a resource does not exist for given |
32 // |resource_id|. | 32 // |resource_id|. |
33 std::string GetImageDataUrlFromResource(int resource_id); | 33 std::string GetImageDataUrlFromResource(int resource_id); |
34 | 34 |
35 // Extracts a disposition from click event arguments. |args| should contain | 35 // Extracts a disposition from click event arguments. |args| should contain |
36 // an integer button and booleans alt key, ctrl key, meta key, and shift key | 36 // an integer button and booleans alt key, ctrl key, meta key, and shift key |
37 // (in that order), starting at |start_index|. | 37 // (in that order), starting at |start_index|. |
38 WindowOpenDisposition GetDispositionFromClick(const ListValue* args, | 38 WindowOpenDisposition GetDispositionFromClick(const ListValue* args, |
39 int start_index); | 39 int start_index); |
40 | 40 |
41 // Given a scale factor such as "1x" or "2x" returns the ScaleFactor enum | 41 // Given a scale factor such as "1x" or "2x", sets |scale_factor| to the |
42 // value for this scale factor. | 42 // ScaleFactor enum value for this scale factor. If the scale factor could not |
43 ui::ScaleFactor ParseScaleFactor(const base::StringPiece& identifier); | 43 // be determined correctly from the string, then |scale_factor| is set to |
| 44 // SCALE_FACTOR_NONE, and false is returned. |
| 45 bool ParseScaleFactor(const base::StringPiece& identifier, |
| 46 ui::ScaleFactor* scale_factor); |
44 | 47 |
45 // Parses a URL containing some path @{scale}x. If it does not contain a scale | 48 // Parses a URL containing some path @{scale}x. If it does not contain a scale |
46 // factor then the default scale factor is returned. | 49 // factor then the default scale factor is returned. |
47 void ParsePathAndScale(const GURL& url, | 50 void ParsePathAndScale(const GURL& url, |
48 std::string* path, | 51 std::string* path, |
49 ui::ScaleFactor* scale_factor); | 52 ui::ScaleFactor* scale_factor); |
50 | 53 |
51 } // namespace web_ui_util | 54 } // namespace web_ui_util |
52 | 55 |
53 #endif // CHROME_BROWSER_UI_WEBUI_WEB_UI_UTIL_H_ | 56 #endif // CHROME_BROWSER_UI_WEBUI_WEB_UI_UTIL_H_ |
OLD | NEW |