OLD | NEW |
1 // Copyright 2007, Google Inc. | 1 // Copyright 2007, Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 // replacing the path with a slash, and clearing everything after that. If | 197 // replacing the path with a slash, and clearing everything after that. If |
198 // this URL is not a standard URL, then the result will be an empty, | 198 // this URL is not a standard URL, then the result will be an empty, |
199 // invalid GURL. If the URL has neither username nor password, this | 199 // invalid GURL. If the URL has neither username nor password, this |
200 // degenerates to GetWithEmptyPath(). | 200 // degenerates to GetWithEmptyPath(). |
201 // | 201 // |
202 // It is an error to get the origin of an invalid URL. The result | 202 // It is an error to get the origin of an invalid URL. The result |
203 // will be the empty URL. | 203 // will be the empty URL. |
204 GURL GetOrigin() const; | 204 GURL GetOrigin() const; |
205 | 205 |
206 // Returns true if the scheme for the current URL is a known "standard" | 206 // Returns true if the scheme for the current URL is a known "standard" |
207 // scheme or there is a "://" after it. Standard schemes have an authority | 207 // scheme. Standard schemes have an authority and a path section. This |
208 // and a path section. This includes file:, which some callers may want to | 208 // includes file:, which some callers may want to filter out explicitly by |
209 // filter out explicitly by calling SchemeIsFile. | 209 // calling SchemeIsFile. |
210 bool IsStandard() const; | 210 bool IsStandard() const; |
211 | 211 |
212 // Returns true if the given parameter (should be lower-case ASCII to match | 212 // Returns true if the given parameter (should be lower-case ASCII to match |
213 // the canonicalized scheme) is the scheme for this URL. This call is more | 213 // the canonicalized scheme) is the scheme for this URL. This call is more |
214 // efficient than getting the scheme and comparing it because no copies or | 214 // efficient than getting the scheme and comparing it because no copies or |
215 // object constructions are done. | 215 // object constructions are done. |
216 bool SchemeIs(const char* lower_ascii_scheme) const; | 216 bool SchemeIs(const char* lower_ascii_scheme) const; |
217 | 217 |
218 // We often need to know if this is a file URL. File URLs are "standard", but | 218 // We often need to know if this is a file URL. File URLs are "standard", but |
219 // are often treated separately by some programs. | 219 // are often treated separately by some programs. |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 | 363 |
364 // TODO bug 684583: Add encoding for query params. | 364 // TODO bug 684583: Add encoding for query params. |
365 }; | 365 }; |
366 | 366 |
367 // Stream operator so GURL can be used in assertion statements. | 367 // Stream operator so GURL can be used in assertion statements. |
368 inline std::ostream& operator<<(std::ostream& out, const GURL& url) { | 368 inline std::ostream& operator<<(std::ostream& out, const GURL& url) { |
369 return out << url.possibly_invalid_spec(); | 369 return out << url.possibly_invalid_spec(); |
370 } | 370 } |
371 | 371 |
372 #endif // GOOGLEURL_SRC_GURL_H__ | 372 #endif // GOOGLEURL_SRC_GURL_H__ |
OLD | NEW |