Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: ui/base/webui/web_ui_util.cc

Issue 1820333003: Remove most uses of UnescapeRule::URL_SPECIAL_CHARS outside net/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Oops Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698