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 #ifndef NET_BASE_URL_UTIL_H_ | 5 #ifndef NET_BASE_URL_UTIL_H_ |
6 #define NET_BASE_URL_UTIL_H_ | 6 #define NET_BASE_URL_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/strings/string16.h" |
11 #include "base/strings/string_piece.h" | 12 #include "base/strings/string_piece.h" |
12 #include "net/base/net_export.h" | 13 #include "net/base/net_export.h" |
13 #include "url/third_party/mozilla/url_parse.h" | 14 #include "url/third_party/mozilla/url_parse.h" |
14 | 15 |
15 class GURL; | 16 class GURL; |
16 | 17 |
17 namespace net { | 18 namespace net { |
18 | 19 |
19 // Returns a new GURL by appending the given query parameter name and the | 20 // Returns a new GURL by appending the given query parameter name and the |
20 // value. Unsafe characters in the name and the value are escaped like | 21 // value. Unsafe characters in the name and the value are escaped like |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // key is found and sets |out_value| to the unescaped value for the key. | 76 // key is found and sets |out_value| to the unescaped value for the key. |
76 // Returns false if the key is not found. | 77 // Returns false if the key is not found. |
77 NET_EXPORT bool GetValueForKeyInQuery(const GURL& url, | 78 NET_EXPORT bool GetValueForKeyInQuery(const GURL& url, |
78 const std::string& search_key, | 79 const std::string& search_key, |
79 std::string* out_value); | 80 std::string* out_value); |
80 | 81 |
81 | 82 |
82 // Returns the hostname by trimming the ending dot, if one exists. | 83 // Returns the hostname by trimming the ending dot, if one exists. |
83 NET_EXPORT std::string TrimEndingDot(const base::StringPiece& host); | 84 NET_EXPORT std::string TrimEndingDot(const base::StringPiece& host); |
84 | 85 |
| 86 // Extracts the unescaped username/password from |url|, saving the results |
| 87 // into |*username| and |*password|. |
| 88 NET_EXPORT_PRIVATE void GetIdentityFromURL(const GURL& url, |
| 89 base::string16* username, |
| 90 base::string16* password); |
| 91 |
85 } // namespace net | 92 } // namespace net |
86 | 93 |
87 #endif // NET_BASE_URL_UTIL_H_ | 94 #endif // NET_BASE_URL_UTIL_H_ |
OLD | NEW |