summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/extension_extent.cc
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-19 20:45:46 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-19 20:45:46 +0000
commit867a73e1e2aad10f60952235da84f5d98cff9aa6 (patch)
tree5e977ff9c87a2cd3de2d7f50b057adbdad4c70bf /chrome/common/extensions/extension_extent.cc
parent35de4be0f924ef6279a6a25fe840522524fa177b (diff)
downloadchromium_src-867a73e1e2aad10f60952235da84f5d98cff9aa6.zip
chromium_src-867a73e1e2aad10f60952235da84f5d98cff9aa6.tar.gz
chromium_src-867a73e1e2aad10f60952235da84f5d98cff9aa6.tar.bz2
Resubmit 1025006: Refactor app-related manifest properties
so that they don't include the name 'app'. TBR=erikkay@chromium.org git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42146 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/extension_extent.cc')
-rw-r--r--chrome/common/extensions/extension_extent.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/chrome/common/extensions/extension_extent.cc b/chrome/common/extensions/extension_extent.cc
new file mode 100644
index 0000000..310673e
--- /dev/null
+++ b/chrome/common/extensions/extension_extent.cc
@@ -0,0 +1,28 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/common/extensions/extension_extent.h"
+
+#include "base/string_util.h"
+
+bool ExtensionExtent::ContainsURL(const GURL& url) {
+ if (!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;
+}