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

Unified Diff: extensions/common/url_pattern_set.cc

Issue 396033002: Support "always allow" for runtime script execution (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: String param reference Created 6 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 side-by-side diff with in-line comments
Download patch
Index: extensions/common/url_pattern_set.cc
diff --git a/extensions/common/url_pattern_set.cc b/extensions/common/url_pattern_set.cc
index ee5ea933830f3cc46e9267c1044942f0487901f2..bc1d0d57b34a9c5db87976134301131d4553eec9 100644
--- a/extensions/common/url_pattern_set.cc
+++ b/extensions/common/url_pattern_set.cc
@@ -142,6 +142,18 @@ void URLPatternSet::ClearPatterns() {
patterns_.clear();
}
+bool URLPatternSet::AddOrigin(int valid_schemes, const GURL& origin) {
+ DCHECK_EQ(origin.GetOrigin(), origin);
+ URLPattern origin_pattern(valid_schemes);
+ // Origin adding could fail if |origin| does not match |valid_schemes|.
+ if (origin_pattern.Parse(origin.GetOrigin().spec()) !=
+ URLPattern::PARSE_SUCCESS) {
+ return false;
+ }
+ origin_pattern.SetPath("/*");
not at google - send to devlin 2014/08/14 21:03:55 Just "*" should do it? You need to add tests for
gpdavis 2014/08/14 21:59:53 That's what I thought as well, but without the sla
not at google - send to devlin 2014/08/14 22:05:33 Good question. The scheme would reject origins lik
gpdavis 2014/08/14 23:31:33 Ah, okay. I just realized we're passing in ValidU
+ return AddPattern(origin_pattern);
+}
+
bool URLPatternSet::Contains(const URLPatternSet& other) const {
for (URLPatternSet::const_iterator it = other.begin();
it != other.end(); ++it) {

Powered by Google App Engine
This is Rietveld 408576698