Index: chrome/common/extensions/url_pattern.cc |
diff --git a/chrome/common/extensions/url_pattern.cc b/chrome/common/extensions/url_pattern.cc |
index d854be49731263b71d08e9f4693e72d35d32303a..507f7c6c30ce4ed9224de97f5a973083d572a0ab 100644 |
--- a/chrome/common/extensions/url_pattern.cc |
+++ b/chrome/common/extensions/url_pattern.cc |
@@ -307,7 +307,7 @@ bool URLPattern::SetPort(const std::string& port) { |
return false; |
} |
-bool URLPattern::MatchesURL(const GURL &test) const { |
+bool URLPattern::MatchesURL(const GURL& test) const { |
if (!MatchesScheme(test.scheme())) |
return false; |
@@ -327,6 +327,24 @@ bool URLPattern::MatchesURL(const GURL &test) const { |
return true; |
} |
+bool URLPattern::MatchesSecurityOrigin(const GURL& test) const { |
+ // TODO(dcheng): Combine in a helper with the above? |
Aaron Boodman
2011/10/20 06:53:51
Yes please. Looks like MatchesURL is just MatchesS
|
+ if (!MatchesScheme(test.scheme())) |
+ return false; |
+ |
+ if (match_all_urls_) |
+ return true; |
+ |
+ // Ignore hostname if scheme is file://. |
+ if (scheme_ != chrome::kFileScheme && !MatchesHost(test)) |
+ return false; |
+ |
+ if (!MatchesPort(test.EffectiveIntPort())) |
+ return false; |
+ |
+ return true; |
+} |
+ |
bool URLPattern::MatchesScheme(const std::string& test) const { |
if (!IsValidScheme(test)) |
return false; |