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 #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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 LOG(WARNING) << "Invalid scale factor format: " << identifier; | 84 LOG(WARNING) << "Invalid scale factor format: " << identifier; |
85 return false; | 85 return false; |
86 } | 86 } |
87 *scale_factor = static_cast<float>(scale); | 87 *scale_factor = static_cast<float>(scale); |
88 return true; | 88 return true; |
89 } | 89 } |
90 | 90 |
91 void ParsePathAndScale(const GURL& url, | 91 void ParsePathAndScale(const GURL& url, |
92 std::string* path, | 92 std::string* path, |
93 float* scale_factor) { | 93 float* scale_factor) { |
94 *path = net::UnescapeURLComponent(url.path().substr(1), | 94 *path = net::UnescapeURLComponent( |
95 (net::UnescapeRule::URL_SPECIAL_CHARS | | 95 url.path().substr(1), |
96 net::UnescapeRule::SPACES)); | 96 (net::UnescapeRule::URL_SPECIAL_CHARS_EXCEPT_PATH_SEPARATORS | |
mmenke
2016/03/23 16:22:29
I don't think unescaping "/" and "\" gets us anyth
Evan Stade
2016/03/23 18:58:08
nit: there is an extra set of parens around the bi
mmenke
2016/03/23 19:06:30
I just kept the extra parens from before... I'll
| |
97 net::UnescapeRule::SPACES)); | |
97 if (scale_factor) | 98 if (scale_factor) |
98 *scale_factor = 1.0f; | 99 *scale_factor = 1.0f; |
99 | 100 |
100 // Detect and parse resource string ending in @<scale>x. | 101 // Detect and parse resource string ending in @<scale>x. |
101 std::size_t pos = path->rfind('@'); | 102 std::size_t pos = path->rfind('@'); |
102 if (pos != std::string::npos) { | 103 if (pos != std::string::npos) { |
103 base::StringPiece stripped_path(*path); | 104 base::StringPiece stripped_path(*path); |
104 float factor; | 105 float factor; |
105 | 106 |
106 if (ParseScaleFactor(stripped_path.substr( | 107 if (ParseScaleFactor(stripped_path.substr( |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
179 IDS_WEB_FONT_SIZE_XP : | 180 IDS_WEB_FONT_SIZE_XP : |
180 #endif | 181 #endif |
181 IDS_WEB_FONT_SIZE); | 182 IDS_WEB_FONT_SIZE); |
182 } | 183 } |
183 | 184 |
184 std::string GetTextDirection() { | 185 std::string GetTextDirection() { |
185 return base::i18n::IsRTL() ? "rtl" : "ltr"; | 186 return base::i18n::IsRTL() ? "rtl" : "ltr"; |
186 } | 187 } |
187 | 188 |
188 } // namespace webui | 189 } // namespace webui |
OLD | NEW |