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

Unified Diff: chrome/common/extensions/url_pattern.cc

Issue 8312005: Ignore paths when matching patterns for extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 2 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: 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;

Powered by Google App Engine
This is Rietveld 408576698