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