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

Unified Diff: extensions/common/manifest_handlers/externally_connectable.cc

Issue 599163003: Add whitelist for extensions to put <all_urls> in externally_connectable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed permission warnings unittest Created 6 years, 3 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: extensions/common/manifest_handlers/externally_connectable.cc
diff --git a/extensions/common/manifest_handlers/externally_connectable.cc b/extensions/common/manifest_handlers/externally_connectable.cc
index 0a06c019ae2b375fb9c86ec71e205dbb7778b914..1314c6d1cb0fa47b699aecf626353956489601d0 100644
--- a/extensions/common/manifest_handlers/externally_connectable.cc
+++ b/extensions/common/manifest_handlers/externally_connectable.cc
@@ -63,11 +63,13 @@ bool ExternallyConnectableHandler::Parse(Extension* extension,
const base::Value* externally_connectable = NULL;
CHECK(extension->manifest()->Get(keys::kExternallyConnectable,
&externally_connectable));
+ bool allow_all_urls = PermissionsParser::HasAPIPermission(
+ extension, APIPermission::kExternallyConnectableAllUrls);
+
std::vector<InstallWarning> install_warnings;
scoped_ptr<ExternallyConnectableInfo> info =
- ExternallyConnectableInfo::FromValue(*externally_connectable,
- &install_warnings,
- error);
+ ExternallyConnectableInfo::FromValue(
+ *externally_connectable, allow_all_urls, &install_warnings, error);
if (!info)
return false;
if (!info->matches.is_empty()) {
@@ -93,6 +95,7 @@ ExternallyConnectableInfo* ExternallyConnectableInfo::Get(
// static
scoped_ptr<ExternallyConnectableInfo> ExternallyConnectableInfo::FromValue(
const base::Value& value,
+ bool allow_all_urls,
std::vector<InstallWarning>* install_warnings,
base::string16* error) {
scoped_ptr<ExternallyConnectable> externally_connectable =
@@ -116,6 +119,11 @@ scoped_ptr<ExternallyConnectableInfo> ExternallyConnectableInfo::FromValue(
return scoped_ptr<ExternallyConnectableInfo>();
}
+ if (allow_all_urls && pattern.match_all_urls()) {
+ matches.AddPattern(pattern);
+ continue;
+ }
+
// Wildcard hosts are not allowed.
if (pattern.host().empty()) {
// Warning not error for forwards compatibility.

Powered by Google App Engine
This is Rietveld 408576698