Index: extensions/common/url_pattern.h |
diff --git a/extensions/common/url_pattern.h b/extensions/common/url_pattern.h |
index a6dfa7480af2e2514060623c5b79968cd5b0f661..3775f0b0090e661551c027d49761e24b6ad914d5 100644 |
--- a/extensions/common/url_pattern.h |
+++ b/extensions/common/url_pattern.h |
@@ -100,6 +100,9 @@ class URLPattern { |
int valid_schemes() const { return valid_schemes_; } |
void SetValidSchemes(int valid_schemes); |
+ int allowed_schemes() const { return allowed_schemes_; } |
+ void SetAllowedSchemes(int allowed_schemes); |
+ |
// Gets the host the pattern matches. This can be an empty string if the |
// pattern matches all hosts (the input was <scheme>://*/<whatever>). |
const std::string& host() const { return host_; } |
@@ -130,6 +133,10 @@ class URLPattern { |
// false otherwise. Uses valid_schemes_ to determine validity. |
bool IsValidScheme(const std::string& scheme) const; |
+ // Returns true if the specified scheme is allowed by this URL pattern, and |
+ // false otherwise. Uses allowed_schemes_ to determine status. |
+ bool IsAllowedScheme(const std::string& scheme) const; |
+ |
// Returns true if this instance matches the specified URL. |
bool MatchesURL(const GURL& test) const; |
@@ -188,6 +195,9 @@ class URLPattern { |
// Get an error string for a ParseResult. |
static const char* GetParseResultString(URLPattern::ParseResult parse_result); |
+ // Checks whether the bit is set for the given scheme in the given scheme mask |
+ static bool IsSchemeBitSet(const std::string& scheme, const int mask); |
+ |
private: |
// Returns true if any of the |schemes| items matches our scheme. |
bool MatchesAnyScheme(const std::vector<std::string>& schemes) const; |
@@ -206,10 +216,14 @@ class URLPattern { |
// A bitmask containing the schemes which are considered valid for this |
// pattern. Parse() uses this to decide whether a pattern contains a valid |
- // scheme. MatchesScheme uses this to decide whether a wildcard scheme_ |
- // matches a given test scheme. |
+ // scheme. |
int valid_schemes_; |
+ // A bitmask containing the schemes which return a positive match for this |
+ // pattern. MatchesScheme uses this to decide whether a wildcard scheme_ |
+ // matches a given test scheme. |
+ int allowed_schemes_; |
+ |
// True if this is a special-case "<all_urls>" pattern. |
bool match_all_urls_; |