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

Side by Side Diff: url/origin.cc

Issue 2495353003: chrome.webRequest support for ExtensionSettings (Closed)
Patch Set: Policy template translation doesn't like '&', switching to 'and'. Small fix to browser test. Created 3 years, 6 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
« url/origin.h ('K') | « url/origin.h ('k') | no next file » | 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
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
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
OLDNEW
« url/origin.h ('K') | « url/origin.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698