| 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 #include "url/origin.h" | 5 #include "url/origin.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 return tuple_.Serialize(); | 65 return tuple_.Serialize(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 bool Origin::IsSameOriginWith(const Origin& other) const { | 68 bool Origin::IsSameOriginWith(const Origin& other) const { |
| 69 if (unique_ || other.unique_) | 69 if (unique_ || other.unique_) |
| 70 return false; | 70 return false; |
| 71 | 71 |
| 72 return tuple_.Equals(other.tuple_); | 72 return tuple_.Equals(other.tuple_); |
| 73 } | 73 } |
| 74 | 74 |
| 75 bool Origin::DomainIs(base::StringPiece lower_ascii_domain) const { |
| 76 if (unique_ || lower_ascii_domain.empty() || tuple_.host().empty()) |
| 77 return false; |
| 78 return url::DomainIs(tuple_.host(), lower_ascii_domain); |
| 79 } |
| 80 |
| 75 bool Origin::operator<(const Origin& other) const { | 81 bool Origin::operator<(const Origin& other) const { |
| 76 return tuple_ < other.tuple_; | 82 return tuple_ < other.tuple_; |
| 77 } | 83 } |
| 78 | 84 |
| 79 std::ostream& operator<<(std::ostream& out, const url::Origin& origin) { | 85 std::ostream& operator<<(std::ostream& out, const url::Origin& origin) { |
| 80 return out << origin.Serialize(); | 86 return out << origin.Serialize(); |
| 81 } | 87 } |
| 82 | 88 |
| 83 bool IsSameOriginWith(const GURL& a, const GURL& b) { | 89 bool IsSameOriginWith(const GURL& a, const GURL& b) { |
| 84 return Origin(a).IsSameOriginWith(Origin(b)); | 90 return Origin(a).IsSameOriginWith(Origin(b)); |
| 85 } | 91 } |
| 86 | 92 |
| 87 } // namespace url | 93 } // namespace url |
| OLD | NEW |