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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 153 |
154 GURL tuple_url(tuple_.GetURL()); | 154 GURL tuple_url(tuple_.GetURL()); |
155 | 155 |
156 if (!suborigin_.empty()) | 156 if (!suborigin_.empty()) |
157 return AddSuboriginToUrl(tuple_url, suborigin_); | 157 return AddSuboriginToUrl(tuple_url, suborigin_); |
158 | 158 |
159 return tuple_url; | 159 return tuple_url; |
160 } | 160 } |
161 | 161 |
162 bool Origin::IsSameOriginWith(const Origin& other) const { | 162 bool Origin::IsSameOriginWith(const Origin& other) const { |
| 163 if (this == &other) |
| 164 return true; |
| 165 |
163 if (opaque_ || other.opaque_) | 166 if (opaque_ || other.opaque_) |
164 return false; | 167 return false; |
165 | 168 |
166 return tuple_.Equals(other.tuple_) && suborigin_ == other.suborigin_; | 169 return tuple_.Equals(other.tuple_) && suborigin_ == other.suborigin_; |
167 } | 170 } |
168 | 171 |
169 bool Origin::IsSamePhysicalOriginWith(const Origin& other) const { | 172 bool Origin::IsSamePhysicalOriginWith(const Origin& other) const { |
170 return GetPhysicalOrigin().IsSameOriginWith(other.GetPhysicalOrigin()); | 173 return GetPhysicalOrigin().IsSameOriginWith(other.GetPhysicalOrigin()); |
171 } | 174 } |
172 | 175 |
(...skipping 12 matching lines...) Expand all Loading... |
185 | 188 |
186 bool IsSameOriginWith(const GURL& a, const GURL& b) { | 189 bool IsSameOriginWith(const GURL& a, const GURL& b) { |
187 return Origin(a).IsSameOriginWith(Origin(b)); | 190 return Origin(a).IsSameOriginWith(Origin(b)); |
188 } | 191 } |
189 | 192 |
190 bool IsSamePhysicalOriginWith(const GURL& a, const GURL& b) { | 193 bool IsSamePhysicalOriginWith(const GURL& a, const GURL& b) { |
191 return Origin(a).IsSamePhysicalOriginWith(Origin(b)); | 194 return Origin(a).IsSamePhysicalOriginWith(Origin(b)); |
192 } | 195 } |
193 | 196 |
194 } // namespace url | 197 } // namespace url |
OLD | NEW |