| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // | 60 // |
| 61 // Usage: | 61 // Usage: |
| 62 // | 62 // |
| 63 // * Origins are generally constructed from an already-canonicalized GURL: | 63 // * Origins are generally constructed from an already-canonicalized GURL: |
| 64 // | 64 // |
| 65 // GURL url("https://example.com/"); | 65 // GURL url("https://example.com/"); |
| 66 // url::Origin origin(url); | 66 // url::Origin origin(url); |
| 67 // origin.scheme(); // "https" | 67 // origin.scheme(); // "https" |
| 68 // origin.host(); // "example.com" | 68 // origin.host(); // "example.com" |
| 69 // origin.port(); // 443 | 69 // origin.port(); // 443 |
| 70 // origin.IsUnique(); // false | 70 // origin.unique(); // false |
| 71 // | 71 // |
| 72 // * To answer the question "Are |this| and |that| "same-origin" with each | 72 // * To answer the question "Are |this| and |that| "same-origin" with each |
| 73 // other?", use |Origin::IsSameOriginWith|: | 73 // other?", use |Origin::IsSameOriginWith|: |
| 74 // | 74 // |
| 75 // if (this.IsSameOriginWith(that)) { | 75 // if (this.IsSameOriginWith(that)) { |
| 76 // // Amazingness goes here. | 76 // // Amazingness goes here. |
| 77 // } | 77 // } |
| 78 class URL_EXPORT Origin { | 78 class URL_EXPORT Origin { |
| 79 public: | 79 public: |
| 80 // Creates a unique Origin. | 80 // Creates a unique Origin. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 SchemeHostPort tuple_; | 129 SchemeHostPort tuple_; |
| 130 bool unique_; | 130 bool unique_; |
| 131 }; | 131 }; |
| 132 | 132 |
| 133 URL_EXPORT std::ostream& operator<<(std::ostream& out, | 133 URL_EXPORT std::ostream& operator<<(std::ostream& out, |
| 134 const Origin& origin); | 134 const Origin& origin); |
| 135 | 135 |
| 136 } // namespace url | 136 } // namespace url |
| 137 | 137 |
| 138 #endif // URL_ORIGIN_H_ | 138 #endif // URL_ORIGIN_H_ |
| OLD | NEW |