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

Side by Side Diff: extensions/renderer/dispatcher.cc

Issue 2499493004: Communicate ExtensionSettings policy to renderers (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "extensions/renderer/dispatcher.h" 5 #include "extensions/renderer/dispatcher.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 IPC_MESSAGE_HANDLER(ExtensionMsg_SetScriptingWhitelist, 927 IPC_MESSAGE_HANDLER(ExtensionMsg_SetScriptingWhitelist,
928 OnSetScriptingWhitelist) 928 OnSetScriptingWhitelist)
929 IPC_MESSAGE_HANDLER(ExtensionMsg_SetSystemFont, OnSetSystemFont) 929 IPC_MESSAGE_HANDLER(ExtensionMsg_SetSystemFont, OnSetSystemFont)
930 IPC_MESSAGE_HANDLER(ExtensionMsg_SetWebViewPartitionID, 930 IPC_MESSAGE_HANDLER(ExtensionMsg_SetWebViewPartitionID,
931 OnSetWebViewPartitionID) 931 OnSetWebViewPartitionID)
932 IPC_MESSAGE_HANDLER(ExtensionMsg_ShouldSuspend, OnShouldSuspend) 932 IPC_MESSAGE_HANDLER(ExtensionMsg_ShouldSuspend, OnShouldSuspend)
933 IPC_MESSAGE_HANDLER(ExtensionMsg_Suspend, OnSuspend) 933 IPC_MESSAGE_HANDLER(ExtensionMsg_Suspend, OnSuspend)
934 IPC_MESSAGE_HANDLER(ExtensionMsg_TransferBlobs, OnTransferBlobs) 934 IPC_MESSAGE_HANDLER(ExtensionMsg_TransferBlobs, OnTransferBlobs)
935 IPC_MESSAGE_HANDLER(ExtensionMsg_Unloaded, OnUnloaded) 935 IPC_MESSAGE_HANDLER(ExtensionMsg_Unloaded, OnUnloaded)
936 IPC_MESSAGE_HANDLER(ExtensionMsg_UpdatePermissions, OnUpdatePermissions) 936 IPC_MESSAGE_HANDLER(ExtensionMsg_UpdatePermissions, OnUpdatePermissions)
937 IPC_MESSAGE_HANDLER(ExtensionMsg_UpdatePolicy, OnUpdatePolicy)
937 IPC_MESSAGE_HANDLER(ExtensionMsg_UpdateTabSpecificPermissions, 938 IPC_MESSAGE_HANDLER(ExtensionMsg_UpdateTabSpecificPermissions,
938 OnUpdateTabSpecificPermissions) 939 OnUpdateTabSpecificPermissions)
939 IPC_MESSAGE_HANDLER(ExtensionMsg_ClearTabSpecificPermissions, 940 IPC_MESSAGE_HANDLER(ExtensionMsg_ClearTabSpecificPermissions,
940 OnClearTabSpecificPermissions) 941 OnClearTabSpecificPermissions)
941 IPC_MESSAGE_HANDLER(ExtensionMsg_SetActivityLoggingEnabled, 942 IPC_MESSAGE_HANDLER(ExtensionMsg_SetActivityLoggingEnabled,
942 OnSetActivityLoggingEnabled) 943 OnSetActivityLoggingEnabled)
943 IPC_MESSAGE_FORWARD(ExtensionMsg_WatchPages, 944 IPC_MESSAGE_FORWARD(ExtensionMsg_WatchPages,
944 content_watcher_.get(), 945 content_watcher_.get(),
945 ContentWatcher::OnWatchPages) 946 ContentWatcher::OnWatchPages)
946 IPC_MESSAGE_UNHANDLED(handled = false) 947 IPC_MESSAGE_UNHANDLED(handled = false)
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1180 1181
1181 // Invalidates the messages map for the extension in case the extension is 1182 // Invalidates the messages map for the extension in case the extension is
1182 // reloaded with a new messages map. 1183 // reloaded with a new messages map.
1183 EraseL10nMessagesMap(id); 1184 EraseL10nMessagesMap(id);
1184 1185
1185 // We don't do anything with existing platform-app stylesheets. They will 1186 // We don't do anything with existing platform-app stylesheets. They will
1186 // stay resident, but the URL pattern corresponding to the unloaded 1187 // stay resident, but the URL pattern corresponding to the unloaded
1187 // extension's URL just won't match anything anymore. 1188 // extension's URL just won't match anything anymore.
1188 } 1189 }
1189 1190
1191 void Dispatcher::OnUpdatePolicy(
1192 const ExtensionMsg_UpdatePolicy_Params& params) {
1193 const Extension* extension =
1194 RendererExtensionRegistry::Get()->GetByID(params.extension_id);
1195 if (!extension)
1196 return;
1197
1198 const URLPatternSet runtime_blocked_hosts =
1199 params.runtime_blocked_hosts;
1200
1201 const URLPatternSet runtime_allowed_hosts =
1202 params.runtime_allowed_hosts;
1203
1204 extension->permissions_data()->SetRuntimeBlockedAllowedHosts(
1205 runtime_blocked_hosts, runtime_allowed_hosts);
1206
1207 UpdateBindings(extension->id());
1208 }
1209
1190 void Dispatcher::OnUpdatePermissions( 1210 void Dispatcher::OnUpdatePermissions(
1191 const ExtensionMsg_UpdatePermissions_Params& params) { 1211 const ExtensionMsg_UpdatePermissions_Params& params) {
1192 const Extension* extension = 1212 const Extension* extension =
1193 RendererExtensionRegistry::Get()->GetByID(params.extension_id); 1213 RendererExtensionRegistry::Get()->GetByID(params.extension_id);
1194 if (!extension) 1214 if (!extension)
1195 return; 1215 return;
1196 1216
1197 std::unique_ptr<const PermissionSet> active = 1217 std::unique_ptr<const PermissionSet> active =
1198 params.active_permissions.ToPermissionSet(); 1218 params.active_permissions.ToPermissionSet();
1199 std::unique_ptr<const PermissionSet> withheld = 1219 std::unique_ptr<const PermissionSet> withheld =
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
1650 // The "guestViewDeny" module must always be loaded last. It registers 1670 // The "guestViewDeny" module must always be loaded last. It registers
1651 // error-providing custom elements for the GuestView types that are not 1671 // error-providing custom elements for the GuestView types that are not
1652 // available, and thus all of those types must have been checked and loaded 1672 // available, and thus all of those types must have been checked and loaded
1653 // (or not loaded) beforehand. 1673 // (or not loaded) beforehand.
1654 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { 1674 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) {
1655 module_system->Require("guestViewDeny"); 1675 module_system->Require("guestViewDeny");
1656 } 1676 }
1657 } 1677 }
1658 1678
1659 } // namespace extensions 1679 } // namespace extensions
OLDNEW
« extensions/common/permissions/permissions_data.cc ('K') | « extensions/renderer/dispatcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698