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 URL_GURL_H_ | 5 #ifndef URL_GURL_H_ |
6 #define URL_GURL_H_ | 6 #define URL_GURL_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 bool SchemeIsFileSystem() const { | 219 bool SchemeIsFileSystem() const { |
220 return SchemeIs("filesystem"); | 220 return SchemeIs("filesystem"); |
221 } | 221 } |
222 | 222 |
223 // If the scheme indicates a secure connection | 223 // If the scheme indicates a secure connection |
224 bool SchemeIsSecure() const { | 224 bool SchemeIsSecure() const { |
225 return SchemeIs("https") || SchemeIs("wss") || | 225 return SchemeIs("https") || SchemeIs("wss") || |
226 (SchemeIsFileSystem() && inner_url() && inner_url()->SchemeIsSecure()); | 226 (SchemeIsFileSystem() && inner_url() && inner_url()->SchemeIsSecure()); |
227 } | 227 } |
228 | 228 |
| 229 // The "content" of the URL is everything after the scheme (skipping the |
| 230 // scheme delimiting colon). It is an error to get the origin of an invalid |
| 231 // URL. The result will be an empty string. |
| 232 std::string GetContent() const; |
| 233 |
229 // Returns true if the hostname is an IP address. Note: this function isn't | 234 // Returns true if the hostname is an IP address. Note: this function isn't |
230 // as cheap as a simple getter because it re-parses the hostname to verify. | 235 // as cheap as a simple getter because it re-parses the hostname to verify. |
231 // This currently identifies only IPv4 addresses (bug 822685). | 236 // This currently identifies only IPv4 addresses (bug 822685). |
232 bool HostIsIPAddress() const; | 237 bool HostIsIPAddress() const; |
233 | 238 |
234 // Getters for various components of the URL. The returned string will be | 239 // Getters for various components of the URL. The returned string will be |
235 // empty if the component is empty or is not present. | 240 // empty if the component is empty or is not present. |
236 std::string scheme() const { // Not including the colon. See also SchemeIs. | 241 std::string scheme() const { // Not including the colon. See also SchemeIs. |
237 return ComponentString(parsed_.scheme); | 242 return ComponentString(parsed_.scheme); |
238 } | 243 } |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 // Used for nested schemes [currently only filesystem:]. | 377 // Used for nested schemes [currently only filesystem:]. |
373 GURL* inner_url_; | 378 GURL* inner_url_; |
374 | 379 |
375 // TODO bug 684583: Add encoding for query params. | 380 // TODO bug 684583: Add encoding for query params. |
376 }; | 381 }; |
377 | 382 |
378 // Stream operator so GURL can be used in assertion statements. | 383 // Stream operator so GURL can be used in assertion statements. |
379 URL_EXPORT std::ostream& operator<<(std::ostream& out, const GURL& url); | 384 URL_EXPORT std::ostream& operator<<(std::ostream& out, const GURL& url); |
380 | 385 |
381 #endif // URL_GURL_H_ | 386 #endif // URL_GURL_H_ |
OLD | NEW |