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

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: 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
Index: extensions/common/url_pattern.h
diff --git a/extensions/common/url_pattern.h b/extensions/common/url_pattern.h
index 42188a5038bae55cc9872fc1a5b5729720983fa8..a6dfa7480af2e2514060623c5b79968cd5b0f661 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 Contains(const URLPattern& other) const;
+
+ // 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;
« no previous file with comments | « chrome/test/data/extensions/api_test/permissions/host_subsets/manifest.json ('k') | extensions/common/url_pattern.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698