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

Unified Diff: extensions/common/url_pattern_set.cc

Issue 12209094: Support requesting subsets of host permissions using the permissions API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: are you happy yet?!?!? Created 7 years, 10 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
« no previous file with comments | « extensions/common/url_pattern_set.h ('k') | extensions/common/url_pattern_set_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..7a19c71112cdf7a7e04e42a6ad03619d02a6a9ab 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 (!ContainsPattern(*it))
+ return false;
+ }
+
+ return true;
}
bool URLPatternSet::MatchesURL(const GURL& url) const {
@@ -216,4 +221,13 @@ bool URLPatternSet::Populate(const base::ListValue& value,
return Populate(patterns, valid_schemes, allow_file_access, error);
}
+bool URLPatternSet::ContainsPattern(const URLPattern& pattern) const {
+ for (URLPatternSet::const_iterator it = begin();
+ it != end(); ++it) {
+ if (it->Contains(pattern))
+ return true;
+ }
+ return false;
+}
+
} // namespace extensions
« no previous file with comments | « extensions/common/url_pattern_set.h ('k') | extensions/common/url_pattern_set_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698