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

Unified Diff: extensions/common/url_pattern_set.h

Issue 12209094: Support requesting subsets of host permissions using the permissions API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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
Index: extensions/common/url_pattern_set.h
diff --git a/extensions/common/url_pattern_set.h b/extensions/common/url_pattern_set.h
index 2f7113973835ffe4346b00ac199cc1723d07cd65..803abf51c79fb9fc57479fb2b848572ecc11b7a5 100644
--- a/extensions/common/url_pattern_set.h
+++ b/extensions/common/url_pattern_set.h
@@ -5,6 +5,7 @@
#ifndef EXTENSIONS_COMMMON_URL_PATTERN_SET_H_
#define EXTENSIONS_COMMMON_URL_PATTERN_SET_H_
+#include <ostream>
#include <set>
#include "base/memory/scoped_ptr.h"
@@ -69,8 +70,21 @@ class URLPatternSet {
void ClearPatterns();
// Returns true if the permission |set| is a subset of this.
+ //
+ // This is equality based, so {<all_urls>} is not considered to contain
+ // {google.com}. For that, use Encompasses.
Matt Perry 2013/02/12 01:14:47 This is a strange distinction. Why not just fix Co
not at google - send to devlin 2013/02/12 01:49:36 Yeah, it is strange. I had it like you said - just
bool Contains(const URLPatternSet& set) const;
+ // Returns true if any pattern in this set encompasses |pattern|.
+ //
+ // This is more inclusive than Contains: while {all_urls} is not considered
+ // to contain {google.com}, it does encompass it.
+ bool EncompassesPattern(const URLPattern& pattern) const;
+
+ // Returns true if every pattern in |other| is encompassed by some pattern
+ // in this set.
+ bool Encompasses(const URLPatternSet& other) const;
+
// Test if the extent contains a URL.
bool MatchesURL(const GURL& url) const;
@@ -96,6 +110,8 @@ class URLPatternSet {
std::set<URLPattern> patterns_;
};
+std::ostream& operator<<(std::ostream& out, const URLPatternSet& set);
+
} // namespace extensions
#endif // EXTENSIONS_COMMMON_URL_PATTERN_SET_H_

Powered by Google App Engine
This is Rietveld 408576698