Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Side by Side Diff: url/origin.cc

Issue 2688573002: Allow a unique origin to compare equal to itself
Patch Set: Fix after rebase Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | url/origin_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | url/origin_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698