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 "net/base/url_util.h" | 5 #include "net/base/url_util.h" |
6 | 6 |
7 #include <utility> | |
8 | |
9 #include "base/logging.h" | 7 #include "base/logging.h" |
10 #include "base/strings/string_piece.h" | |
11 #include "net/base/escape.h" | 8 #include "net/base/escape.h" |
12 #include "url/gurl.h" | 9 #include "url/gurl.h" |
13 | 10 |
14 namespace net { | 11 namespace net { |
15 | 12 |
16 GURL AppendQueryParameter(const GURL& url, | 13 GURL AppendQueryParameter(const GURL& url, |
17 const std::string& name, | 14 const std::string& name, |
18 const std::string& value) { | 15 const std::string& value) { |
19 std::string query(url.query()); | 16 std::string query(url.query()); |
20 | 17 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 131 |
135 std::string TrimEndingDot(const base::StringPiece& host) { | 132 std::string TrimEndingDot(const base::StringPiece& host) { |
136 base::StringPiece host_trimmed = host; | 133 base::StringPiece host_trimmed = host; |
137 size_t len = host_trimmed.length(); | 134 size_t len = host_trimmed.length(); |
138 if (len > 1 && host_trimmed[len - 1] == '.') { | 135 if (len > 1 && host_trimmed[len - 1] == '.') { |
139 host_trimmed.remove_suffix(1); | 136 host_trimmed.remove_suffix(1); |
140 } | 137 } |
141 return host_trimmed.as_string(); | 138 return host_trimmed.as_string(); |
142 } | 139 } |
143 | 140 |
| 141 void GetIdentityFromURL(const GURL& url, |
| 142 base::string16* username, |
| 143 base::string16* password) { |
| 144 UnescapeRule::Type flags = |
| 145 UnescapeRule::SPACES | UnescapeRule::URL_SPECIAL_CHARS; |
| 146 *username = UnescapeAndDecodeUTF8URLComponent(url.username(), flags); |
| 147 *password = UnescapeAndDecodeUTF8URLComponent(url.password(), flags); |
| 148 } |
| 149 |
144 } // namespace net | 150 } // namespace net |
OLD | NEW |