Chromium Code Reviews| 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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 348 // This function may be called from any thread. | 348 // This function may be called from any thread. |
| 349 static const GURL& EmptyGURL(); | 349 static const GURL& EmptyGURL(); |
| 350 | 350 |
| 351 // Returns the inner URL of a nested URL [currently only non-null for | 351 // Returns the inner URL of a nested URL [currently only non-null for |
| 352 // filesystem: URLs]. | 352 // filesystem: URLs]. |
| 353 const GURL* inner_url() const { | 353 const GURL* inner_url() const { |
| 354 return inner_url_.get(); | 354 return inner_url_.get(); |
| 355 } | 355 } |
| 356 | 356 |
| 357 private: | 357 private: |
| 358 // Variant of the string parsing constructor that allows the caller to elect | |
| 359 // retain trailing whitespace, if any, on the passed URL spec but only if the | |
| 360 // scheme is one that allows trailing whitespace. The primary use-case is | |
| 361 // for data: URLs. In most cases, you want to use the single parameter | |
| 362 // constructor above. | |
| 363 enum RetainWhiteSpaceSelector { RETAIN_TRAILING_PATH_WHITEPACE }; | |
| 364 GURL(const std::string& url_string, RetainWhiteSpaceSelector); | |
| 365 | |
| 366 template<typename STR> | |
| 367 void InitCanonical(const STR& input_spec, | |
|
brettw
2013/11/20 00:03:51
One line since it fits.
joth
2013/11/21 00:08:45
Done.
| |
| 368 bool trim_path_end); | |
| 358 void InitializeFromCanonicalSpec(); | 369 void InitializeFromCanonicalSpec(); |
| 359 | 370 |
| 360 // Returns the substring of the input identified by the given component. | 371 // Returns the substring of the input identified by the given component. |
| 361 std::string ComponentString(const url_parse::Component& comp) const { | 372 std::string ComponentString(const url_parse::Component& comp) const { |
| 362 if (comp.len <= 0) | 373 if (comp.len <= 0) |
| 363 return std::string(); | 374 return std::string(); |
| 364 return std::string(spec_, comp.begin, comp.len); | 375 return std::string(spec_, comp.begin, comp.len); |
| 365 } | 376 } |
| 366 | 377 |
| 367 // The actual text of the URL, in canonical ASCII form. | 378 // The actual text of the URL, in canonical ASCII form. |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 378 // Used for nested schemes [currently only filesystem:]. | 389 // Used for nested schemes [currently only filesystem:]. |
| 379 scoped_ptr<GURL> inner_url_; | 390 scoped_ptr<GURL> inner_url_; |
| 380 | 391 |
| 381 // TODO bug 684583: Add encoding for query params. | 392 // TODO bug 684583: Add encoding for query params. |
| 382 }; | 393 }; |
| 383 | 394 |
| 384 // Stream operator so GURL can be used in assertion statements. | 395 // Stream operator so GURL can be used in assertion statements. |
| 385 URL_EXPORT std::ostream& operator<<(std::ostream& out, const GURL& url); | 396 URL_EXPORT std::ostream& operator<<(std::ostream& out, const GURL& url); |
| 386 | 397 |
| 387 #endif // URL_GURL_H_ | 398 #endif // URL_GURL_H_ |
| OLD | NEW |