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

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

Issue 2481923002: [WIP] make GURL::path() return a StringPiece (Closed)
Patch Set: thanks asan Created 4 years, 1 month 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
« no previous file with comments | « storage/common/fileapi/file_system_util.cc ('k') | url/gurl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
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( 94 *path = net::UnescapeURLComponent(
95 url.path().substr(1), 95 url.path().substr(1).as_string(),
96 net::UnescapeRule::URL_SPECIAL_CHARS_EXCEPT_PATH_SEPARATORS | 96 net::UnescapeRule::URL_SPECIAL_CHARS_EXCEPT_PATH_SEPARATORS |
97 net::UnescapeRule::SPACES); 97 net::UnescapeRule::SPACES);
98 if (scale_factor) 98 if (scale_factor)
99 *scale_factor = 1.0f; 99 *scale_factor = 1.0f;
100 100
101 // Detect and parse resource string ending in @<scale>x. 101 // Detect and parse resource string ending in @<scale>x.
102 std::size_t pos = path->rfind('@'); 102 std::size_t pos = path->rfind('@');
103 if (pos != std::string::npos) { 103 if (pos != std::string::npos) {
104 base::StringPiece stripped_path(*path); 104 base::StringPiece stripped_path(*path);
105 float factor; 105 float factor;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 IDS_WEB_FONT_SIZE_XP : 176 IDS_WEB_FONT_SIZE_XP :
177 #endif 177 #endif
178 IDS_WEB_FONT_SIZE); 178 IDS_WEB_FONT_SIZE);
179 } 179 }
180 180
181 std::string GetTextDirection() { 181 std::string GetTextDirection() {
182 return base::i18n::IsRTL() ? "rtl" : "ltr"; 182 return base::i18n::IsRTL() ? "rtl" : "ltr";
183 } 183 }
184 184
185 } // namespace webui 185 } // namespace webui
OLDNEW
« no previous file with comments | « storage/common/fileapi/file_system_util.cc ('k') | url/gurl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698