| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 bool IsSamePhysicalOriginWith(const Origin& other) const; | 149 bool IsSamePhysicalOriginWith(const Origin& other) const; |
| 150 | 150 |
| 151 // Efficiently returns what GURL(Serialize()) would without re-parsing the | 151 // Efficiently returns what GURL(Serialize()) would without re-parsing the |
| 152 // URL. This can be used for the (rare) times a GURL representation is needed | 152 // URL. This can be used for the (rare) times a GURL representation is needed |
| 153 // for an Origin. | 153 // for an Origin. |
| 154 // Note: The returned URL will not necessarily be serialized to the same value | 154 // Note: The returned URL will not necessarily be serialized to the same value |
| 155 // as the Origin would. The GURL will have an added "/" path for Origins with | 155 // as the Origin would. The GURL will have an added "/" path for Origins with |
| 156 // valid SchemeHostPorts and file Origins. | 156 // valid SchemeHostPorts and file Origins. |
| 157 GURL GetURL() const; | 157 GURL GetURL() const; |
| 158 | 158 |
| 159 // Similar to GetURL() but does NOT modify the URL when a suborigin is used. |
| 160 // Note: The returned URL will not be serialized to the same value |
| 161 // as the Origin would. The GURL will have an added "/" path for Origins with |
| 162 // valid SchemeHostPorts and file Origins. |
| 163 GURL GetURLWithoutSuborigin() const; |
| 164 |
| 159 // Same as GURL::DomainIs. If |this| origin is unique, then returns false. | 165 // Same as GURL::DomainIs. If |this| origin is unique, then returns false. |
| 160 bool DomainIs(base::StringPiece lower_ascii_domain) const; | 166 bool DomainIs(base::StringPiece lower_ascii_domain) const; |
| 161 | 167 |
| 162 // Allows Origin to be used as a key in STL (for example, a std::set or | 168 // Allows Origin to be used as a key in STL (for example, a std::set or |
| 163 // std::map). | 169 // std::map). |
| 164 bool operator<(const Origin& other) const; | 170 bool operator<(const Origin& other) const; |
| 165 | 171 |
| 166 private: | 172 private: |
| 167 Origin(base::StringPiece scheme, | 173 Origin(base::StringPiece scheme, |
| 168 base::StringPiece host, | 174 base::StringPiece host, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 181 }; | 187 }; |
| 182 | 188 |
| 183 URL_EXPORT std::ostream& operator<<(std::ostream& out, const Origin& origin); | 189 URL_EXPORT std::ostream& operator<<(std::ostream& out, const Origin& origin); |
| 184 | 190 |
| 185 URL_EXPORT bool IsSameOriginWith(const GURL& a, const GURL& b); | 191 URL_EXPORT bool IsSameOriginWith(const GURL& a, const GURL& b); |
| 186 URL_EXPORT bool IsSamePhysicalOriginWith(const GURL& a, const GURL& b); | 192 URL_EXPORT bool IsSamePhysicalOriginWith(const GURL& a, const GURL& b); |
| 187 | 193 |
| 188 } // namespace url | 194 } // namespace url |
| 189 | 195 |
| 190 #endif // URL_ORIGIN_H_ | 196 #endif // URL_ORIGIN_H_ |
| OLD | NEW |