Index: extensions/common/url_pattern_set.cc |
diff --git a/extensions/common/url_pattern_set.cc b/extensions/common/url_pattern_set.cc |
index 40663201c1c5a66169f5160a43eaa67f8f7d6f5f..92a628fac5557137496bf6961b01b74caf2fdc54 100644 |
--- a/extensions/common/url_pattern_set.cc |
+++ b/extensions/common/url_pattern_set.cc |
@@ -129,9 +129,14 @@ void URLPatternSet::ClearPatterns() { |
patterns_.clear(); |
} |
-bool URLPatternSet::Contains(const URLPatternSet& set) const { |
- return std::includes(patterns_.begin(), patterns_.end(), |
- set.patterns_.begin(), set.patterns_.end()); |
+bool URLPatternSet::Contains(const URLPatternSet& other) const { |
+ for (URLPatternSet::const_iterator it = other.begin(); |
+ it != other.end(); ++it) { |
+ if (!Encompasses(*it)) |
+ return false; |
+ } |
+ |
+ return true; |
} |
bool URLPatternSet::MatchesURL(const GURL& url) const { |
@@ -216,4 +221,23 @@ bool URLPatternSet::Populate(const base::ListValue& value, |
return Populate(patterns, valid_schemes, allow_file_access, error); |
} |
+bool URLPatternSet::Encompasses(const URLPattern& pattern) const { |
+ for (URLPatternSet::const_iterator it = begin(); |
+ it != end(); ++it) { |
+ if (it->Encompasses(pattern)) |
+ return true; |
+ } |
+ return false; |
+} |
+ |
+std::ostream& operator<<(std::ostream& out, const URLPatternSet& set) { |
+ out << "{"; |
+ for (URLPatternSet::const_iterator it = set.begin(); it != set.end(); ++it) { |
+ if (it != set.begin()) |
+ out << ","; |
+ out << it->GetAsString(); |
+ } |
+ return out << "}"; |
+} |
+ |
} // namespace extensions |