summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/extension.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/common/extensions/extension.cc')
-rw-r--r--chrome/common/extensions/extension.cc24
1 files changed, 19 insertions, 5 deletions
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index 8dc62d2..41d5257 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -1385,11 +1385,7 @@ bool Extension::InitFromValue(const DictionaryValue& source, bool require_key,
return false;
}
- // We support http:// and https:// as well as chrome://favicon/.
- if (!(pattern.scheme() == chrome::kHttpScheme ||
- pattern.scheme() == chrome::kHttpsScheme ||
- (pattern.scheme() == chrome::kChromeUIScheme &&
- pattern.host() == chrome::kChromeUIFavIconHost))) {
+ if (!CanAccessURL(pattern)) {
*error = ExtensionErrorUtils::FormatErrorMessage(
errors::kInvalidPermissionScheme, IntToString(i));
return false;
@@ -1585,6 +1581,24 @@ Extension::Icons Extension::GetIconPathAllowLargerSize(
return EXTENSION_ICON_LARGE;
}
+// We support http:// and https:// as well as chrome://favicon//.
+// chrome://resources/ is supported but only for component extensions.
+bool Extension::CanAccessURL(const URLPattern pattern) const{
+ if (pattern.scheme() == chrome::kHttpScheme ||
+ pattern.scheme() == chrome::kHttpsScheme) {
+ return true;
+ }
+ if (pattern.scheme() == chrome::kChromeUIScheme &&
+ pattern.host() == chrome::kChromeUIFavIconHost) {
+ return true;
+ }
+ if (location() == Extension::COMPONENT &&
+ pattern.scheme() == chrome::kChromeUIScheme) {
+ return true;
+ }
+ return false;
+}
+
bool Extension::HasHostPermission(const GURL& url) const {
for (URLPatternList::const_iterator host = host_permissions_.begin();
host != host_permissions_.end(); ++host) {