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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
152 return GURL("file:///"); | 152 return GURL("file:///"); |
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 GURL Origin::GetURLWithoutSuborigin() const { | |
163 if (unique()) | |
164 return GURL(); | |
165 | |
166 if (scheme() == kFileScheme) | |
167 return GURL("file:///"); | |
168 | |
169 GURL tuple_url(tuple_.GetURL()); | |
170 | |
171 return tuple_url; | |
172 } | |
Mike West
2017/05/26 11:45:35
+Jochen, who's responsible for suborigins these da
jochen (gone - plz use gerrit)
2017/05/26 11:51:53
why not use origin->GetPhysicalOrigin().GetURL() ?
nrpeter
2017/05/26 15:50:24
Good point, I'll switch to GetPhysicalOrigin().Get
| |
173 | |
162 bool Origin::IsSameOriginWith(const Origin& other) const { | 174 bool Origin::IsSameOriginWith(const Origin& other) const { |
163 if (unique_ || other.unique_) | 175 if (unique_ || other.unique_) |
164 return false; | 176 return false; |
165 | 177 |
166 return tuple_.Equals(other.tuple_) && suborigin_ == other.suborigin_; | 178 return tuple_.Equals(other.tuple_) && suborigin_ == other.suborigin_; |
167 } | 179 } |
168 | 180 |
169 bool Origin::IsSamePhysicalOriginWith(const Origin& other) const { | 181 bool Origin::IsSamePhysicalOriginWith(const Origin& other) const { |
170 return GetPhysicalOrigin().IsSameOriginWith(other.GetPhysicalOrigin()); | 182 return GetPhysicalOrigin().IsSameOriginWith(other.GetPhysicalOrigin()); |
171 } | 183 } |
(...skipping 13 matching lines...) Expand all Loading... | |
185 | 197 |
186 bool IsSameOriginWith(const GURL& a, const GURL& b) { | 198 bool IsSameOriginWith(const GURL& a, const GURL& b) { |
187 return Origin(a).IsSameOriginWith(Origin(b)); | 199 return Origin(a).IsSameOriginWith(Origin(b)); |
188 } | 200 } |
189 | 201 |
190 bool IsSamePhysicalOriginWith(const GURL& a, const GURL& b) { | 202 bool IsSamePhysicalOriginWith(const GURL& a, const GURL& b) { |
191 return Origin(a).IsSamePhysicalOriginWith(Origin(b)); | 203 return Origin(a).IsSamePhysicalOriginWith(Origin(b)); |
192 } | 204 } |
193 | 205 |
194 } // namespace url | 206 } // namespace url |
OLD | NEW |