OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_SCHEME_HOST_PORT_H_ | 5 #ifndef URL_SCHEME_HOST_PORT_H_ |
6 #define URL_SCHEME_HOST_PORT_H_ | 6 #define URL_SCHEME_HOST_PORT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 // It may, however, be inappropriate to use as a cache key for persistent | 29 // It may, however, be inappropriate to use as a cache key for persistent |
30 // storage associated with a host. | 30 // storage associated with a host. |
31 // | 31 // |
32 // In particular, note that: | 32 // In particular, note that: |
33 // | 33 // |
34 // * SchemeHostPort can only represent schemes which follow the RFC 3986 syntax | 34 // * SchemeHostPort can only represent schemes which follow the RFC 3986 syntax |
35 // (e.g. those registered with GURL as "standard schemes"). Non-standard | 35 // (e.g. those registered with GURL as "standard schemes"). Non-standard |
36 // schemes such as "blob", "filesystem", "data", and "javascript" can only be | 36 // schemes such as "blob", "filesystem", "data", and "javascript" can only be |
37 // represented as invalid SchemeHostPort objects. | 37 // represented as invalid SchemeHostPort objects. |
38 // | 38 // |
39 // * The "file" scheme follows the standard syntax, but it is important to note | 39 // * For example, the "file" scheme follows the standard syntax, but it is |
40 // that the authority portion (host, port) is optional. URLs without an | 40 // important to note that the authority portion (host, port) is optional. |
41 // authority portion will be represented with an empty string for the host, | 41 // URLs without an authority portion will be represented with an empty string |
42 // and a port of 0 (e.g. "file:///etc/hosts" => ("file", "", 0)), and URLs | 42 // for the host, and a port of 0 (e.g. "file:///etc/hosts" => |
43 // with a host-only authority portion will be represented with a port of 0 | 43 // ("file", "", 0)), and URLs with a host-only authority portion will be |
44 // (e.g. "file://example.com/etc/hosts" => ("file", "example.com", 0)). See | 44 // represented with a port of 0 (e.g. "file://example.com/etc/hosts" => |
45 // Section 3 of RFC 3986 to better understand these constructs. | 45 // ("file", "example.com", 0)). See Section 3 of RFC 3986 to better understand |
| 46 // these constructs. |
46 // | 47 // |
47 // * SchemeHostPort has no notion of the Origin concept (RFC 6454), and in | 48 // * SchemeHostPort has no notion of the Origin concept (RFC 6454), and in |
48 // particular, it has no notion of a "unique" Origin. If you need to take | 49 // particular, it has no notion of a "unique" Origin. If you need to take |
49 // uniqueness into account (and, if you're making security-relevant decisions | 50 // uniqueness into account (and, if you're making security-relevant decisions |
50 // then you absolutely do), please use 'url::Origin' instead[1]. | 51 // then you absolutely do), please use 'url::Origin' instead. |
51 // | |
52 // [1]: // TODO(mkwst): Land 'url::Origin'. :) | |
53 // | 52 // |
54 // Usage: | 53 // Usage: |
55 // | 54 // |
56 // * SchemeHostPort objects are commonly created from GURL objects: | 55 // * SchemeHostPort objects are commonly created from GURL objects: |
57 // | 56 // |
58 // GURL url("https://example.com/"); | 57 // GURL url("https://example.com/"); |
59 // url::SchemeHostPort tuple(url); | 58 // url::SchemeHostPort tuple(url); |
60 // tuple.scheme(); // "https" | 59 // tuple.scheme(); // "https" |
61 // tuple.host(); // "example.com" | 60 // tuple.host(); // "example.com" |
62 // tuple.port(); // 443 | 61 // tuple.port(); // 443 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 122 |
124 private: | 123 private: |
125 std::string scheme_; | 124 std::string scheme_; |
126 std::string host_; | 125 std::string host_; |
127 uint16 port_; | 126 uint16 port_; |
128 }; | 127 }; |
129 | 128 |
130 } // namespace url | 129 } // namespace url |
131 | 130 |
132 #endif // URL_SCHEME_HOST_PORT_H_ | 131 #endif // URL_SCHEME_HOST_PORT_H_ |
OLD | NEW |