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