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

Unified Diff: extensions/renderer/dispatcher.cc

Issue 2499493004: Communicate ExtensionSettings policy to renderers (Closed)
Patch Set: Fix effective TLD wildcard bug, move to Leaky LazyInstance in PermissionsData, removed unnecessary … Created 3 years, 9 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
« extensions/renderer/dispatcher.h ('K') | « extensions/renderer/dispatcher.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/dispatcher.cc
diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc
index fe1cff9c125c395142fc73e8489cfdee47110f17..2488ced85c3a0ba512da14a054a3b8adecc8fc21 100644
--- a/extensions/renderer/dispatcher.cc
+++ b/extensions/renderer/dispatcher.cc
@@ -934,6 +934,8 @@ bool Dispatcher::OnControlMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ExtensionMsg_TransferBlobs, OnTransferBlobs)
IPC_MESSAGE_HANDLER(ExtensionMsg_Unloaded, OnUnloaded)
IPC_MESSAGE_HANDLER(ExtensionMsg_UpdatePermissions, OnUpdatePermissions)
+ IPC_MESSAGE_HANDLER(ExtensionMsg_UpdateDefaultPolicyHostRestrictions,
+ OnUpdateDefaultPolicyHostRestrictions)
IPC_MESSAGE_HANDLER(ExtensionMsg_UpdateTabSpecificPermissions,
OnUpdateTabSpecificPermissions)
IPC_MESSAGE_HANDLER(ExtensionMsg_ClearTabSpecificPermissions,
@@ -1063,7 +1065,6 @@ void Dispatcher::OnLoaded(
extension_load_errors_[param.id] = error;
continue;
}
-
RendererExtensionRegistry* extension_registry =
RendererExtensionRegistry::Get();
// TODO(kalman): This test is deliberately not a CHECK (though I wish it
@@ -1080,12 +1081,15 @@ void Dispatcher::OnLoaded(
// consider making this a release CHECK.
NOTREACHED();
}
+ extension->permissions_data()->SetPolicyHostRestrictions(
+ param.policy_blocked_hosts, param.policy_allowed_hosts,
+ param.is_default_policy_blocked_allowed_hosts);
}
// Update the available bindings for all contexts. These may have changed if
// an externally_connectable extension was loaded that can connect to an
// open webpage.
- UpdateBindings("");
+ UpdateBindings(std::string());
}
void Dispatcher::OnMessageInvoke(const std::string& extension_id,
@@ -1187,6 +1191,14 @@ void Dispatcher::OnUnloaded(const std::string& id) {
// extension's URL just won't match anything anymore.
}
+void Dispatcher::OnUpdateDefaultPolicyHostRestrictions(
+ const ExtensionMsg_UpdateDefaultPolicyHostRestrictions_Params& params) {
+ PermissionsData::SetDefaultPolicyHostRestrictions(
+ params.default_policy_blocked_hosts,
+ params.default_policy_allowed_hosts);
+ UpdateBindings(std::string());
+}
+
void Dispatcher::OnUpdatePermissions(
const ExtensionMsg_UpdatePermissions_Params& params) {
const Extension* extension =
@@ -1206,6 +1218,15 @@ void Dispatcher::OnUpdatePermissions(
extension->permissions_data()->SetPermissions(std::move(active),
std::move(withheld));
+ URLPatternSet policy_blocked_hosts;
+ URLPatternSet policy_allowed_hosts;
+ if (!params.uses_default_policy_host_restrictions) {
+ policy_blocked_hosts = params.policy_blocked_hosts;
+ policy_allowed_hosts = params.policy_allowed_hosts;
+ }
+ extension->permissions_data()->SetPolicyHostRestrictions(
+ policy_blocked_hosts, policy_allowed_hosts,
+ params.uses_default_policy_host_restrictions);
UpdateBindings(extension->id());
}
« extensions/renderer/dispatcher.h ('K') | « extensions/renderer/dispatcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698