OLD | NEW |
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 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1066 // TODO(devlin): This may be fixed by crbug.com/528026. Monitor, and | 1066 // TODO(devlin): This may be fixed by crbug.com/528026. Monitor, and |
1067 // consider making this a release CHECK. | 1067 // consider making this a release CHECK. |
1068 NOTREACHED(); | 1068 NOTREACHED(); |
1069 } | 1069 } |
1070 if (param.uses_default_policy_blocked_allowed_hosts) { | 1070 if (param.uses_default_policy_blocked_allowed_hosts) { |
1071 extension->permissions_data()->SetUsesDefaultHostRestrictions(); | 1071 extension->permissions_data()->SetUsesDefaultHostRestrictions(); |
1072 } else { | 1072 } else { |
1073 extension->permissions_data()->SetPolicyHostRestrictions( | 1073 extension->permissions_data()->SetPolicyHostRestrictions( |
1074 param.policy_blocked_hosts, param.policy_allowed_hosts); | 1074 param.policy_blocked_hosts, param.policy_allowed_hosts); |
1075 } | 1075 } |
| 1076 |
| 1077 ExtensionsRendererClient::Get()->OnExtensionLoaded(*extension); |
1076 } | 1078 } |
1077 | 1079 |
1078 // Update the available bindings for all contexts. These may have changed if | 1080 // Update the available bindings for all contexts. These may have changed if |
1079 // an externally_connectable extension was loaded that can connect to an | 1081 // an externally_connectable extension was loaded that can connect to an |
1080 // open webpage. | 1082 // open webpage. |
1081 UpdateBindings(std::string()); | 1083 UpdateBindings(std::string()); |
1082 } | 1084 } |
1083 | 1085 |
1084 void Dispatcher::OnMessageInvoke(const std::string& extension_id, | 1086 void Dispatcher::OnMessageInvoke(const std::string& extension_id, |
1085 const std::string& module_name, | 1087 const std::string& module_name, |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 void Dispatcher::OnUnloaded(const std::string& id) { | 1169 void Dispatcher::OnUnloaded(const std::string& id) { |
1168 // See comment in OnLoaded for why it would be nice, but perhaps incorrect, | 1170 // See comment in OnLoaded for why it would be nice, but perhaps incorrect, |
1169 // to CHECK here rather than guarding. | 1171 // to CHECK here rather than guarding. |
1170 // TODO(devlin): This may be fixed by crbug.com/528026. Monitor, and | 1172 // TODO(devlin): This may be fixed by crbug.com/528026. Monitor, and |
1171 // consider making this a release CHECK. | 1173 // consider making this a release CHECK. |
1172 if (!RendererExtensionRegistry::Get()->Remove(id)) { | 1174 if (!RendererExtensionRegistry::Get()->Remove(id)) { |
1173 NOTREACHED(); | 1175 NOTREACHED(); |
1174 return; | 1176 return; |
1175 } | 1177 } |
1176 | 1178 |
| 1179 ExtensionsRendererClient::Get()->OnExtensionUnloaded(id); |
| 1180 |
1177 active_extension_ids_.erase(id); | 1181 active_extension_ids_.erase(id); |
1178 | 1182 |
1179 script_injection_manager_->OnExtensionUnloaded(id); | 1183 script_injection_manager_->OnExtensionUnloaded(id); |
1180 | 1184 |
1181 // If the extension is later reloaded with a different set of permissions, | 1185 // If the extension is later reloaded with a different set of permissions, |
1182 // we'd like it to get a new isolated world ID, so that it can pick up the | 1186 // we'd like it to get a new isolated world ID, so that it can pick up the |
1183 // changed origin whitelist. | 1187 // changed origin whitelist. |
1184 ScriptInjection::RemoveIsolatedWorld(id); | 1188 ScriptInjection::RemoveIsolatedWorld(id); |
1185 | 1189 |
1186 // Inform the bindings system that the contexts will be removed to allow time | 1190 // Inform the bindings system that the contexts will be removed to allow time |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1492 // The "guestViewDeny" module must always be loaded last. It registers | 1496 // The "guestViewDeny" module must always be loaded last. It registers |
1493 // error-providing custom elements for the GuestView types that are not | 1497 // error-providing custom elements for the GuestView types that are not |
1494 // available, and thus all of those types must have been checked and loaded | 1498 // available, and thus all of those types must have been checked and loaded |
1495 // (or not loaded) beforehand. | 1499 // (or not loaded) beforehand. |
1496 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { | 1500 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { |
1497 module_system->Require("guestViewDeny"); | 1501 module_system->Require("guestViewDeny"); |
1498 } | 1502 } |
1499 } | 1503 } |
1500 | 1504 |
1501 } // namespace extensions | 1505 } // namespace extensions |
OLD | NEW |