| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 URL_SCHEME_HOST_PORT_H_ | 5 #ifndef URL_SCHEME_HOST_PORT_H_ |
| 6 #define URL_SCHEME_HOST_PORT_H_ | 6 #define URL_SCHEME_HOST_PORT_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // Creates a (scheme, host, port) tuple. |host| must be a canonicalized | 81 // Creates a (scheme, host, port) tuple. |host| must be a canonicalized |
| 82 // A-label (that is, '☃.net' must be provided as 'xn--n3h.net'). |scheme| | 82 // A-label (that is, '☃.net' must be provided as 'xn--n3h.net'). |scheme| |
| 83 // must be a standard scheme. |port| must not be 0, unless |scheme| does not | 83 // must be a standard scheme. |port| must not be 0, unless |scheme| does not |
| 84 // support ports (e.g. 'file'). In that case, |port| must be 0. | 84 // support ports (e.g. 'file'). In that case, |port| must be 0. |
| 85 // | 85 // |
| 86 // Copies the data in |scheme| and |host|. | 86 // Copies the data in |scheme| and |host|. |
| 87 SchemeHostPort(base::StringPiece scheme, | 87 SchemeHostPort(base::StringPiece scheme, |
| 88 base::StringPiece host, | 88 base::StringPiece host, |
| 89 uint16_t port); | 89 uint16_t port); |
| 90 | 90 |
| 91 // Creates a (scheme, host, port) tuple without performing sanity checking |
| 92 // that the host and port are canonicalized. This should only be used when |
| 93 // converting between already normalized types, and should NOT be used for |
| 94 // IPC. |
| 95 SchemeHostPort(base::StringPiece scheme, |
| 96 base::StringPiece host, |
| 97 uint16_t port, |
| 98 bool is_canonicalized); |
| 99 |
| 91 // Creates a (scheme, host, port) tuple from |url|, as described at | 100 // Creates a (scheme, host, port) tuple from |url|, as described at |
| 92 // https://tools.ietf.org/html/rfc6454#section-4 | 101 // https://tools.ietf.org/html/rfc6454#section-4 |
| 93 // | 102 // |
| 94 // If |url| is invalid or non-standard, the result will be an invalid | 103 // If |url| is invalid or non-standard, the result will be an invalid |
| 95 // SchemeHostPort object. | 104 // SchemeHostPort object. |
| 96 explicit SchemeHostPort(const GURL& url); | 105 explicit SchemeHostPort(const GURL& url); |
| 97 | 106 |
| 98 ~SchemeHostPort(); | 107 ~SchemeHostPort(); |
| 99 | 108 |
| 100 // Returns the host component, in URL form. That is all IDN domain names will | 109 // Returns the host component, in URL form. That is all IDN domain names will |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 std::string SerializeInternal(url::Parsed* parsed) const; | 142 std::string SerializeInternal(url::Parsed* parsed) const; |
| 134 | 143 |
| 135 std::string scheme_; | 144 std::string scheme_; |
| 136 std::string host_; | 145 std::string host_; |
| 137 uint16_t port_; | 146 uint16_t port_; |
| 138 }; | 147 }; |
| 139 | 148 |
| 140 } // namespace url | 149 } // namespace url |
| 141 | 150 |
| 142 #endif // URL_SCHEME_HOST_PORT_H_ | 151 #endif // URL_SCHEME_HOST_PORT_H_ |
| OLD | NEW |