Index: chrome/common/extensions/url_pattern.h |
diff --git a/chrome/common/extensions/url_pattern.h b/chrome/common/extensions/url_pattern.h |
index 6a83c017ce7c3b5a3dd2cd0348a16fd009352b14..44892697927be1e833168670e2a96940fa31703d 100644 |
--- a/chrome/common/extensions/url_pattern.h |
+++ b/chrome/common/extensions/url_pattern.h |
@@ -99,7 +99,12 @@ class URLPattern { |
// Gets the bitmask of valid schemes. |
int valid_schemes() const { return valid_schemes_; } |
+ // Sets the bitmask of valid schemes and inner_schemes. |
Aaron Boodman
2012/02/15 21:31:18
Please put an empty line before each of these comm
|
void SetValidSchemes(int valid_schemes); |
+ // Gets the bitmask of valid inner schemes. |
+ int valid_inner_schemes() const { return valid_inner_schemes_; } |
+ // Sets the bitmask of valid inner_schemes. |
+ void SetValidInnerSchemes(int valid_schemes); |
// Gets the host the pattern matches. This can be an empty string if the |
// pattern matches all hosts (the input was <scheme>://*/<whatever>). |
@@ -123,14 +128,27 @@ class URLPattern { |
// pattern matches all valid schemes (as defined by the valid_schemes_ |
// property). Returns false on failure (if the scheme is not valid). |
bool SetScheme(const std::string& scheme); |
+ // Sets the inner scheme for pattern matches; this can only be used for |
+ // patterns whose scheme has already been set to "filesystem". This can be a |
Aaron Boodman
2012/02/15 21:31:18
Why make this restriction? It seems easier to just
ericu
2012/02/16 01:42:56
If you're doing something that's obviously wrong,
|
+ // single '*' if the pattern matches all valid schemes (as defined by the |
+ // valid_inner_schemes_ property). Returns false on failure (if the scheme is |
+ // not valid). |
+ bool SetInnerScheme(const std::string& scheme); |
// Note: You should use MatchesScheme() instead of this getter unless you |
Aaron Boodman
2012/02/15 21:31:18
In retrospect, these warnings are overly scary. Ma
ericu
2012/02/22 00:00:51
Done.
|
// absolutely need the exact scheme. This is exposed for testing. |
const std::string& scheme() const { return scheme_; } |
+ // Note: You should use MatchesInnerScheme() instead of this getter unless you |
+ // absolutely need the exact scheme. This is exposed for testing. |
+ const std::string& inner_scheme() const { return inner_scheme_; } |
// Returns true if the specified scheme can be used in this URL pattern, and |
// false otherwise. Uses valid_schemes_ to determine validity. |
bool IsValidScheme(const std::string& scheme) const; |
+ // Returns true if the specified scheme can be used in this URL pattern, and |
Aaron Boodman
2012/02/15 21:31:18
.replace("specified scheme", "specified inner sche
ericu
2012/02/22 00:00:51
Done.
|
+ // false otherwise. Uses valid_inner_schemes_ to determine validity. |
+ bool IsValidInnerScheme(const std::string& scheme) const; |
+ |
// Returns true if this instance matches the specified URL. |
bool MatchesURL(const GURL& test) const; |
@@ -140,6 +158,10 @@ class URLPattern { |
// Returns true if |test| matches our scheme. |
bool MatchesScheme(const std::string& test) const; |
+ // Returns true if |test| matches our inner scheme. |
+ // Only use this if scheme is "filesystem". |
+ bool MatchesInnerScheme(const std::string& test) const; |
+ |
// Returns true if |test| matches our host. |
bool MatchesHost(const std::string& test) const; |
bool MatchesHost(const GURL& test) const; |
@@ -200,6 +222,11 @@ class URLPattern { |
// scheme. MatchesScheme uses this to decide whether a wildcard scheme_ |
// matches a given test scheme. |
int valid_schemes_; |
+ // A bitmask containing the inner schemes which are considered valid for this |
Aaron Boodman
2012/02/15 21:31:18
.insertBefore("\n");
ericu
2012/02/22 00:00:51
Done.
|
+ // pattern. Parse() uses this to decide whether a pattern contains a valid |
+ // scheme. MatchesInnerScheme uses this to decide whether a wildcard |
+ // inner_scheme_ matches a given test scheme. |
+ int valid_inner_schemes_; |
// True if this is a special-case "<all_urls>" pattern. |
bool match_all_urls_; |
@@ -207,6 +234,9 @@ class URLPattern { |
// The scheme for the pattern. |
std::string scheme_; |
+ // The inner scheme for the pattern, used only when scheme_ is "filesystem". |
+ std::string inner_scheme_; |
+ |
// The host without any leading "*" components. |
std::string host_; |