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 |
11 #include "base/string16.h" | 11 #include "base/string16.h" |
12 #include "url/url_canon.h" | 12 #include "url/url_canon.h" |
13 #include "url/url_canon_stdstring.h" | 13 #include "url/url_canon_stdstring.h" |
14 #include "url/url_export.h" | |
15 #include "url/url_parse.h" | 14 #include "url/url_parse.h" |
16 | 15 |
17 class URL_EXPORT GURL { | 16 class GURL { |
18 public: | 17 public: |
19 typedef url_canon::StdStringReplacements<std::string> Replacements; | 18 typedef url_canon::StdStringReplacements<std::string> Replacements; |
20 typedef url_canon::StdStringReplacements<string16> ReplacementsW; | 19 typedef url_canon::StdStringReplacements<string16> ReplacementsW; |
21 | 20 |
22 // Creates an empty, invalid URL. | 21 // Creates an empty, invalid URL. |
23 GURL(); | 22 GURL(); |
24 | 23 |
25 // Copy construction is relatively inexpensive, with most of the time going | 24 // Copy construction is relatively inexpensive, with most of the time going |
26 // to reallocating the string. It does not re-parse. | 25 // to reallocating the string. It does not re-parse. |
27 GURL(const GURL& other); | 26 GURL(const GURL& other); |
28 | 27 |
29 // The narrow version requires the input be UTF-8. Invalid UTF-8 input will | 28 // The narrow version requires the input be UTF-8. Invalid UTF-8 input will |
30 // result in an invalid URL. | 29 // result in an invalid URL. |
31 // | 30 // |
32 // The wide version should also take an encoding parameter so we know how to | 31 // The wide version should also take an encoding parameter so we know how to |
33 // encode the query parameters. It is probably sufficient for the narrow | 32 // encode the query parameters. It is probably sufficient for the narrow |
34 // version to assume the query parameter encoding should be the same as the | 33 // version to assume the query parameter encoding should be the same as the |
35 // input encoding. | 34 // input encoding. |
36 explicit GURL(const std::string& url_string /*, output_param_encoding*/); | 35 explicit GURL(const std::string& url_string |
37 explicit GURL(const string16& url_string /*, output_param_encoding*/); | 36 /*, output_param_encoding*/); |
| 37 explicit GURL(const string16& url_string |
| 38 /*, output_param_encoding*/); |
38 | 39 |
39 // Constructor for URLs that have already been parsed and canonicalized. This | 40 // Constructor for URLs that have already been parsed and canonicalized. This |
40 // is used for conversions from KURL, for example. The caller must supply all | 41 // is used for conversions from KURL, for example. The caller must supply all |
41 // information associated with the URL, which must be correct and consistent. | 42 // information associated with the URL, which must be correct and consistent. |
42 GURL(const char* canonical_spec, size_t canonical_spec_len, | 43 GURL(const char* canonical_spec, size_t canonical_spec_len, |
43 const url_parse::Parsed& parsed, bool is_valid); | 44 const url_parse::Parsed& parsed, bool is_valid); |
44 | 45 |
45 ~GURL(); | 46 ~GURL(); |
46 | 47 |
47 GURL& operator=(const GURL& other); | 48 GURL& operator=(const GURL& other); |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 // Identified components of the canonical spec. | 354 // Identified components of the canonical spec. |
354 url_parse::Parsed parsed_; | 355 url_parse::Parsed parsed_; |
355 | 356 |
356 // Used for nested schemes [currently only filesystem:]. | 357 // Used for nested schemes [currently only filesystem:]. |
357 GURL* inner_url_; | 358 GURL* inner_url_; |
358 | 359 |
359 // TODO bug 684583: Add encoding for query params. | 360 // TODO bug 684583: Add encoding for query params. |
360 }; | 361 }; |
361 | 362 |
362 // Stream operator so GURL can be used in assertion statements. | 363 // Stream operator so GURL can be used in assertion statements. |
363 URL_EXPORT std::ostream& operator<<(std::ostream& out, const GURL& url); | 364 std::ostream& operator<<(std::ostream& out, const GURL& url); |
364 | 365 |
365 #endif // URL_GURL_H_ | 366 #endif // URL_GURL_H_ |
OLD | NEW |