summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/extension_extent.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/common/extensions/extension_extent.cc')
-rw-r--r--chrome/common/extensions/extension_extent.cc19
1 files changed, 16 insertions, 3 deletions
diff --git a/chrome/common/extensions/extension_extent.cc b/chrome/common/extensions/extension_extent.cc
index b479c5b..f716291 100644
--- a/chrome/common/extensions/extension_extent.cc
+++ b/chrome/common/extensions/extension_extent.cc
@@ -4,11 +4,24 @@
#include "chrome/common/extensions/extension_extent.h"
+#include "base/string_util.h"
+
bool ExtensionExtent::ContainsURL(const GURL& url) const {
- for (PatternList::const_iterator pattern = patterns_.begin();
- pattern != patterns_.end(); ++pattern) {
- if (pattern->MatchesUrl(url))
+ if (origin_.is_empty() || !url.is_valid())
+ return false;
+
+ if (url.GetOrigin() != origin_)
+ return false;
+
+ if (paths_.empty())
+ return true;
+
+ for (size_t i = 0; i < paths_.size(); ++i) {
+ if (StartsWithASCII(url.path(),
+ std::string("/") + paths_[i],
+ false)) { // not case sensitive
return true;
+ }
}
return false;