Chromium Code Reviews| 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) { |