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

Unified Diff: extensions/common/url_pattern.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: fix urlpatternsettest 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.h
diff --git a/extensions/common/url_pattern.h b/extensions/common/url_pattern.h
index 42188a5038bae55cc9872fc1a5b5729720983fa8..934636513c2682846c63146361efc24f67e578b4 100644
--- a/extensions/common/url_pattern.h
+++ b/extensions/common/url_pattern.h
@@ -149,9 +149,6 @@ class URLPattern {
// Returns true if |test| matches our path.
bool MatchesPath(const std::string& test) const;
- // Returns true if |port| matches our port.
- bool MatchesPort(int port) const;
-
// Sets the port. Returns false if the port is invalid.
bool SetPort(const std::string& port);
const std::string& port() const { return port_; }
@@ -159,12 +156,16 @@ class URLPattern {
// Returns a string representing this instance.
const std::string& GetAsString() const;
- // Determine whether there is a URL that would match this instance and another
- // instance. This method is symmetrical: Calling other.OverlapsWith(this)
- // would result in the same answer.
+ // Determines whether there is a URL that would match this instance and
+ // another instance. This method is symmetrical: Calling
+ // other.OverlapsWith(this) would result in the same answer.
bool OverlapsWith(const URLPattern& other) const;
- // Convert this URLPattern into an equivalent set of URLPatterns that don't
+ // Returns true if this pattern matches all possible URLs that |other| can
+ // match. For example, http://*.google.com encompasses http://www.google.com.
+ bool Encompasses(const URLPattern& other) const;
Matt Perry 2013/02/12 19:07:17 rename to Contains?
Yoyo Zhou 2013/02/12 19:45:04 I thought about this as well, but you'd also want
Matt Perry 2013/02/12 19:50:00 Seems better to have Contains and ContainsPattern,
Yoyo Zhou 2013/02/12 19:53:56 Right. You do the dual meaning of containment - th
not at google - send to devlin 2013/02/12 19:56:20 Contains seemed wrong to me, since it's not a cont
+
+ // Converts this URLPattern into an equivalent set of URLPatterns that don't
// use a wildcard in the scheme component. If this URLPattern doesn't use a
// wildcard scheme, then the returned set will contain one element that is
// equivalent to this instance.
@@ -191,8 +192,14 @@ class URLPattern {
// Returns true if any of the |schemes| items matches our scheme.
bool MatchesAnyScheme(const std::vector<std::string>& schemes) const;
+ // Returns true if all of the |schemes| items matches our scheme.
+ bool MatchesAllSchemes(const std::vector<std::string>& schemes) const;
+
bool MatchesSecurityOriginHelper(const GURL& test) const;
+ // Returns true if our port matches the |port| pattern (it may be "*").
+ bool MatchesPortPattern(const std::string& port) const;
+
// If the URLPattern contains a wildcard scheme, returns a list of
// equivalent literal schemes, otherwise returns the current scheme.
std::vector<std::string> GetExplicitSchemes() const;
@@ -233,4 +240,6 @@ class URLPattern {
typedef std::vector<URLPattern> URLPatternList;
+std::ostream& operator<<(std::ostream& out, const URLPattern& pattern);
+
#endif // EXTENSIONS_COMMON_URL_PATTERN_H_

Powered by Google App Engine
This is Rietveld 408576698