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_ORIGIN_H_ | 5 #ifndef URL_ORIGIN_H_ |
6 #define URL_ORIGIN_H_ | 6 #define URL_ORIGIN_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
110 bool unique() const { return unique_; } | 110 bool unique() const { return unique_; } |
111 | 111 |
112 // An ASCII serialization of the Origin as per Section 6.2 of RFC 6454, with | 112 // An ASCII serialization of the Origin as per Section 6.2 of RFC 6454, with |
113 // the addition that all Origins with a 'file' scheme serialize to "file://". | 113 // the addition that all Origins with a 'file' scheme serialize to "file://". |
114 std::string Serialize() const; | 114 std::string Serialize() const; |
115 | 115 |
116 // Two Origins are "same-origin" if their schemes, hosts, and ports are exact | 116 // Two Origins are "same-origin" if their schemes, hosts, and ports are exact |
117 // matches; and neither is unique. | 117 // matches; and neither is unique. |
118 bool IsSameOriginWith(const Origin& other) const; | 118 bool IsSameOriginWith(const Origin& other) const; |
119 | 119 |
120 // Allows SchemeHostPort to used as a key in STL (for example, a std::set or | 120 // Allows Origin to used as a key in STL (for example, a std::set or |
Charlie Reis
2015/11/24 21:00:42
nit: to be used
ncarter (slow)
2015/11/24 22:07:34
Done.
| |
121 // std::map). | 121 // std::map). |
122 bool operator<(const Origin& other) const; | 122 bool operator<(const Origin& other) const; |
123 | 123 |
124 private: | 124 private: |
125 Origin(base::StringPiece scheme, base::StringPiece host, uint16 port); | 125 Origin(base::StringPiece scheme, base::StringPiece host, uint16 port); |
126 | 126 |
127 SchemeHostPort tuple_; | 127 SchemeHostPort tuple_; |
128 bool unique_; | 128 bool unique_; |
129 }; | 129 }; |
130 | 130 |
131 URL_EXPORT std::ostream& operator<<(std::ostream& out, | 131 URL_EXPORT std::ostream& operator<<(std::ostream& out, |
132 const Origin& origin); | 132 const Origin& origin); |
133 | 133 |
134 } // namespace url | 134 } // namespace url |
135 | 135 |
136 #endif // URL_ORIGIN_H_ | 136 #endif // URL_ORIGIN_H_ |
OLD | NEW |